[pygrib] 01/02: upstream 1.9.9

Alastair McKinstry mckinstry at moszumanska.debian.org
Thu Jun 25 15:51:41 UTC 2015


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to tag unstable/1.9.9-2
in repository pygrib.

commit 8b7433aa87cd60612f6aef5b3fdfe5a3d6f8b03b
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Fri May 1 07:05:26 2015 +0100

    upstream 1.9.9
---
 COPYING                                            |    15 +
 MANIFEST.in                                        |    25 +
 PKG-INFO                                           |    11 +
 README                                             |    26 +
 README.macosx                                      |    21 +
 docs/api-objects.txt                               |    90 +
 docs/class-tree.html                               |   112 +
 docs/crarr.png                                     |   Bin 0 -> 340 bytes
 docs/epydoc.css                                    |   322 +
 docs/epydoc.js                                     |   293 +
 docs/help.html                                     |   262 +
 docs/identifier-index.html                         |   495 +
 docs/index.html                                    |   738 +
 docs/module-tree.html                              |   100 +
 docs/pygrib-module.html                            |   738 +
 docs/pygrib.gribmessage-class.html                 |   819 +
 docs/pygrib.index-class.html                       |   455 +
 docs/pygrib.open-class.html                        |   689 +
 docs/redirect.html                                 |    38 +
 g2clib.c                                           |  7183 ++++
 g2clib.pyx                                         |   741 +
 man/cnvgrib1to2.1                                  |    64 +
 man/cnvgrib2to1.1                                  |    45 +
 man/grib_list.1                                    |    49 +
 man/grib_repack.1                                  |    75 +
 ncepgrib2.py                                       |  1432 +
 ncepgrib2_docs/api-objects.txt                     |    61 +
 ncepgrib2_docs/class-tree.html                     |   105 +
 ncepgrib2_docs/crarr.png                           |   Bin 0 -> 340 bytes
 ncepgrib2_docs/epydoc.css                          |   322 +
 ncepgrib2_docs/epydoc.js                           |   293 +
 ncepgrib2_docs/help.html                           |   263 +
 ncepgrib2_docs/identifier-index.html               |   247 +
 ncepgrib2_docs/index.html                          |   266 +
 ncepgrib2_docs/module-tree.html                    |   100 +
 ncepgrib2_docs/ncepgrib2-module.html               |   266 +
 ncepgrib2_docs/ncepgrib2-pysrc.html                |  1538 +
 ncepgrib2_docs/ncepgrib2.Grib2Encode-class.html    |   527 +
 ncepgrib2_docs/ncepgrib2.Grib2Message-class.html   |   774 +
 ncepgrib2_docs/redirect.html                       |    38 +
 ports/README                                       |    14 +
 ports/python/py-pygrib/Portfile                    |    27 +
 pygrib.c                                           | 32986 +++++++++++++++++++
 pygrib.pyx                                         |  2069 ++
 redtoreg.c                                         |  5809 ++++
 redtoreg.pyx                                       |    54 +
 ...C_reg_WIND_ISBL_300_ps60km_2010052400_P012.grib |   Bin 0 -> 14524 bytes
 sampledata/cl00010000_ecoclimap_rot.grib1          |   Bin 0 -> 1164000 bytes
 sampledata/ds.maxt.bin                             |   Bin 0 -> 1018365 bytes
 sampledata/dspr.temp.bin                           |   Bin 0 -> 60108 bytes
 sampledata/ecmwf_tigge.grb                         |   Bin 0 -> 6797500 bytes
 sampledata/eta.grb                                 |   Bin 0 -> 920238 bytes
 sampledata/eumetsat_precip.grb                     |   Bin 0 -> 3297731 bytes
 sampledata/flux.grb                                |   Bin 0 -> 54151 bytes
 sampledata/gfs.grb                                 |   Bin 0 -> 3867577 bytes
 sampledata/gfs.t12z.pgrbf120.2p5deg.grib2          |   Bin 0 -> 3770738 bytes
 sampledata/ngm.grb                                 |   Bin 0 -> 14922 bytes
 sampledata/reduced_latlon_surface.grib2            |   Bin 0 -> 335528 bytes
 sampledata/regular_latlon_surface.grib1            |   Bin 0 -> 1200 bytes
 sampledata/regular_latlon_surface.grib2            |   Bin 0 -> 1188 bytes
 sampledata/rotated_ll.grib1                        |   Bin 0 -> 369446 bytes
 sampledata/safrica.grib2                           |   Bin 0 -> 1019925 bytes
 sampledata/spherical_pressure_level.grib1          |   Bin 0 -> 9360 bytes
 sampledata/tigge.grb                               |   Bin 0 -> 798662 bytes
 sampledata/tpcprblty.grib2                         |   Bin 0 -> 59098 bytes
 setup.cfg.template                                 |    31 +
 setup.py                                           |   160 +
 test.py                                            |   235 +
 test/README                                        |     6 +
 test/animate.py                                    |    41 +
 test/set_bitmap.py                                 |    34 +
 test/test_Grib2Encode.py                           |    56 +
 test/test_ectigge.py                               |    31 +
 test/test_eumetsat.py                              |    61 +
 test/test_gaussian.py                              |    15 +
 test/test_lambert.py                               |    26 +
 test/test_ndfd_conus.py                            |    36 +
 test/test_ndfd_pr.py                               |    35 +
 test/test_reduced_ll.py                            |    14 +
 test/test_reglatlon.py                             |    30 +
 test/test_rotated_ll.py                            |    19 +
 test/test_spectral.py                              |    54 +
 test/test_stere.py                                 |    47 +
 test/test_tigge.py                                 |    25 +
 test/test_tpcprblty.py                             |    24 +
 utils/cnvgrib1to2                                  |    35 +
 utils/cnvgrib2to1                                  |    26 +
 utils/grib_list                                    |    41 +
 utils/grib_repack                                  |    74 +
 89 files changed, 61753 insertions(+)

diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..fc9a27f
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,15 @@
+copyright: copyright 2010 by Jeffrey Whitaker.
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation.
+
+THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100755
index 0000000..bf583ac
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,25 @@
+include MANIFEST.in
+include COPYING
+include pygrib.pyx
+include pygrib.c
+include g2clib.pyx
+include g2clib.c
+include redtoreg.pyx
+include redtoreg.c
+include ncepgrib2.py
+include setup.cfg.template
+include setup.py
+include test.py
+include README
+include README.macosx
+include utils/*grib*
+recursive-include docs *
+recursive-include ports *
+recursive-include ncepgrib2_docs *
+include sampledata/*.grb
+include sampledata/*.grib*
+include sampledata/*.bin
+recursive-include g2clib_src *
+include test/README
+include test/*py
+include man/*.1
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..e51bbfc
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,11 @@
+Metadata-Version: 1.1
+Name: pygrib
+Version: 1.9.9
+Summary: Python module for reading/writing GRIB files
+Home-page: http://code.google.com/p/pygrib
+Author: Jeff Whitaker
+Author-email: jeffrey.s.whitaker at noaa.gov
+License: UNKNOWN
+Download-URL: http://code.google.com/p/pygrib/downloads/list
+Description: UNKNOWN
+Platform: UNKNOWN
diff --git a/README b/README
new file mode 100644
index 0000000..7edc0ac
--- /dev/null
+++ b/README
@@ -0,0 +1,26 @@
+Python module for reading and writing GRIB files (edition 1 and edition 2).
+
+GRIB is the World Meteorological Organization (WMO) standard
+file format for the exchange of weather data.
+
+Provides a interfaces for the ECWMF GRIB_API C library and
+the NCEP grib2 C library, including 
+command line utilities for listing (grib_list) and repacking (grib_repack)
+GRIB files.
+
+Quickstart:
+
+* Copy setup.cfg.template to setup.cfg, open in text editor, follow instructions in
+comments for editing.
+
+* Run 'python setup.py build'
+
+* Run 'python setup.py install' (with sudo if necessary)
+
+* Run 'python test.py' to test your pygrib installation.
+
+For full installation instructions and API documentation, see docs/index.html or
+http://pygrib.googlecode.com/svn/trunk/docs/index.html.
+
+Questions or comments - contact Jeff Whitaker <jeffrey.s.whitaker at noaa.gov>
+or use http://code.google.com/p/pygrib/issues.
diff --git a/README.macosx b/README.macosx
new file mode 100644
index 0000000..a2ab295
--- /dev/null
+++ b/README.macosx
@@ -0,0 +1,21 @@
+pygrib is now available in macports (py-pygrib package), so the 
+instructions below are obsolete (unless you want to keep up to date with the 
+latest pygrib and let macports manage the installation).
+
+--------------------
+
+Although pygrib is not yet part of MacPorts (http://www.macports.org), you can use 
+the included Portfile to install it using a local Portfile repository.  See 
+ports/README for more details.  Once macports is installed, and your local 
+Portfile repo is set up, all you have to do to install pygrib and it's 
+dependencies is run "sudo port install py27-pygrib".
+
+This will install pygrib from svn HEAD. To periodically upgrade, just do
+   - sudo port uninstall py27-pygrib
+   - sudo port install py27-pygrib (this will re-download and rebuild)
+
+google "macports local portfile" for more information on creating a local Portfile 
+repository.
+
+pygrib has been submitted to the macports tracker, but has not yet been accepted.  
+The ticket is here: https://trac.macports.org/ticket/32192.
diff --git a/docs/api-objects.txt b/docs/api-objects.txt
new file mode 100644
index 0000000..8346eed
--- /dev/null
+++ b/docs/api-objects.txt
@@ -0,0 +1,90 @@
+pygrib	pygrib-module.html
+pygrib.missingvalue_int	pygrib-module.html#missingvalue_int
+pygrib.tolerate_badgrib_on	pygrib-module.html#tolerate_badgrib_on
+pygrib.default_encoding	pygrib-module.html#default_encoding
+pygrib.multi_support_off	pygrib-module.html#multi_support_off
+pygrib._find	pygrib-module.html#_find
+pygrib.multi_support_on	pygrib-module.html#multi_support_on
+pygrib._private_atts	pygrib-module.html#_private_atts
+pygrib.julian_to_datetime	pygrib-module.html#julian_to_datetime
+pygrib.reload	pygrib-module.html#reload
+pygrib._is_stringlike	pygrib-module.html#_is_stringlike
+pygrib.__package__	pygrib-module.html#__package__
+pygrib._ftimedict	pygrib-module.html#_ftimedict
+pygrib.__version__	pygrib-module.html#__version__
+pygrib._is_container	pygrib-module.html#_is_container
+pygrib._get_grib_api_version	pygrib-module.html#_get_grib_api_version
+pygrib.tolerate_badgrib_off	pygrib-module.html#tolerate_badgrib_off
+pygrib.missingvalue_float	pygrib-module.html#missingvalue_float
+pygrib.gaulats	pygrib-module.html#gaulats
+pygrib.fromstring	pygrib-module.html#fromstring
+pygrib.grib_api_version	pygrib-module.html#grib_api_version
+pygrib.setdates	pygrib-module.html#setdates
+pygrib.datetime_to_julian	pygrib-module.html#datetime_to_julian
+pygrib.tolerate_badgrib	pygrib-module.html#tolerate_badgrib
+pygrib.gribmessage	pygrib.gribmessage-class.html
+pygrib.gribmessage.latlons	pygrib.gribmessage-class.html#latlons
+pygrib.gribmessage.__getattribute__	pygrib.gribmessage-class.html#__getattribute__
+pygrib.gribmessage.has_key	pygrib.gribmessage-class.html#has_key
+pygrib.gribmessage._all_keys	pygrib.gribmessage-class.html#_all_keys
+pygrib.gribmessage.__init__	pygrib.gribmessage-class.html#__init__
+pygrib.gribmessage.__setattr__	pygrib.gribmessage-class.html#__setattr__
+pygrib.gribmessage.__new__	pygrib.gribmessage-class.html#__new__
+pygrib.gribmessage.is_missing	pygrib.gribmessage-class.html#is_missing
+pygrib.gribmessage._read_only_keys	pygrib.gribmessage-class.html#_read_only_keys
+pygrib.gribmessage.projparams	pygrib.gribmessage-class.html#projparams
+pygrib.gribmessage.fcstimeunits	pygrib.gribmessage-class.html#fcstimeunits
+pygrib.gribmessage.__getattr__	pygrib.gribmessage-class.html#__getattr__
+pygrib.gribmessage.messagenumber	pygrib.gribmessage-class.html#messagenumber
+pygrib.gribmessage._unshape_mask	pygrib.gribmessage-class.html#_unshape_mask
+pygrib.gribmessage._ro_keys	pygrib.gribmessage-class.html#_ro_keys
+pygrib.gribmessage._get_key	pygrib.gribmessage-class.html#_get_key
+pygrib.gribmessage._reshape_mask	pygrib.gribmessage-class.html#_reshape_mask
+pygrib.gribmessage.analDate	pygrib.gribmessage-class.html#analDate
+pygrib.gribmessage.__getitem__	pygrib.gribmessage-class.html#__getitem__
+pygrib.gribmessage.keys	pygrib.gribmessage-class.html#keys
+pygrib.gribmessage.validDate	pygrib.gribmessage-class.html#validDate
+pygrib.gribmessage.expand_grid	pygrib.gribmessage-class.html#expand_grid
+pygrib.gribmessage.__setitem__	pygrib.gribmessage-class.html#__setitem__
+pygrib.gribmessage.tostring	pygrib.gribmessage-class.html#tostring
+pygrib.gribmessage.data	pygrib.gribmessage-class.html#data
+pygrib.gribmessage.__delitem__	pygrib.gribmessage-class.html#__delitem__
+pygrib.gribmessage.valid_key	pygrib.gribmessage-class.html#valid_key
+pygrib.gribmessage._set_projparams	pygrib.gribmessage-class.html#_set_projparams
+pygrib.gribmessage.__delattr__	pygrib.gribmessage-class.html#__delattr__
+pygrib.gribmessage.__repr__	pygrib.gribmessage-class.html#__repr__
+pygrib.gribmessage.expand_reduced	pygrib.gribmessage-class.html#expand_reduced
+pygrib.index	pygrib.index-class.html
+pygrib.index.__new__	pygrib.index-class.html#__new__
+pygrib.index.keys	pygrib.index-class.html#keys
+pygrib.index.write	pygrib.index-class.html#write
+pygrib.index.select	pygrib.index-class.html#select
+pygrib.index.types	pygrib.index-class.html#types
+pygrib.index.__call__	pygrib.index-class.html#__call__
+pygrib.index.close	pygrib.index-class.html#close
+pygrib.index.__init__	pygrib.index-class.html#__init__
+pygrib.index.name	pygrib.index-class.html#name
+pygrib.open	pygrib.open-class.html
+pygrib.open.close	pygrib.open-class.html#close
+pygrib.open.message	pygrib.open-class.html#message
+pygrib.open.next	pygrib.open-class.html#next
+pygrib.open.seek	pygrib.open-class.html#seek
+pygrib.open.__init__	pygrib.open-class.html#__init__
+pygrib.open.__new__	pygrib.open-class.html#__new__
+pygrib.open.__enter__	pygrib.open-class.html#__enter__
+pygrib.open.messagenumber	pygrib.open-class.html#messagenumber
+pygrib.open.select	pygrib.open-class.html#select
+pygrib.open.closed	pygrib.open-class.html#closed
+pygrib.open.rewind	pygrib.open-class.html#rewind
+pygrib.open.__call__	pygrib.open-class.html#__call__
+pygrib.open.tell	pygrib.open-class.html#tell
+pygrib.open._advance	pygrib.open-class.html#_advance
+pygrib.open.__exit__	pygrib.open-class.html#__exit__
+pygrib.open.__getitem__	pygrib.open-class.html#__getitem__
+pygrib.open.read	pygrib.open-class.html#read
+pygrib.open.__next__	pygrib.open-class.html#__next__
+pygrib.open.has_multi_field_msgs	pygrib.open-class.html#has_multi_field_msgs
+pygrib.open.__iter__	pygrib.open-class.html#__iter__
+pygrib.open.readline	pygrib.open-class.html#readline
+pygrib.open.name	pygrib.open-class.html#name
+pygrib.open.messages	pygrib.open-class.html#messages
diff --git a/docs/class-tree.html b/docs/class-tree.html
new file mode 100644
index 0000000..64d13c1
--- /dev/null
+++ b/docs/class-tree.html
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>Class Hierarchy</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="pygrib-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Trees   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%"> </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<center><b>
+ [ <a href="module-tree.html">Module Hierarchy</a>
+ | <a href="class-tree.html">Class Hierarchy</a> ]
+</b></center><br />
+<h1 class="epydoc">Class Hierarchy</h1>
+<ul class="nomargin-top">
+    <li> <strong class="uidlink">object</strong>:
+      <em class="summary">The most base type</em>
+    <ul>
+    <li> <strong class="uidlink"><a href="pygrib.gribmessage-class.html">pygrib.gribmessage</a></strong>:
+      <em class="summary">Grib message object.</em>
+    </li>
+    <li> <strong class="uidlink"><a href="pygrib.index-class.html">pygrib.index</a></strong>:
+      <em class="summary">index(filename, *args)</em>
+    </li>
+    <li> <strong class="uidlink"><a href="pygrib.open-class.html">pygrib.open</a></strong>:
+      <em class="summary">open(filename)</em>
+    </li>
+    </ul>
+    </li>
+</ul>
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="pygrib-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Trees   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1 on Fri Feb  7 15:35:47 2014
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/docs/crarr.png b/docs/crarr.png
new file mode 100644
index 0000000..26b43c5
Binary files /dev/null and b/docs/crarr.png differ
diff --git a/docs/epydoc.css b/docs/epydoc.css
new file mode 100644
index 0000000..86d4170
--- /dev/null
+++ b/docs/epydoc.css
@@ -0,0 +1,322 @@
+
+
+/* Epydoc CSS Stylesheet
+ *
+ * This stylesheet can be used to customize the appearance of epydoc's
+ * HTML output.
+ *
+ */
+
+/* Default Colors & Styles
+ *   - Set the default foreground & background color with 'body'; and 
+ *     link colors with 'a:link' and 'a:visited'.
+ *   - Use bold for decision list terms.
+ *   - The heading styles defined here are used for headings *within*
+ *     docstring descriptions.  All headings used by epydoc itself use
+ *     either class='epydoc' or class='toc' (CSS styles for both
+ *     defined below).
+ */
+body                        { background: #ffffff; color: #000000; }
+p                           { margin-top: 0.5em; margin-bottom: 0.5em; }
+a:link                      { color: #0000ff; }
+a:visited                   { color: #204080; }
+dt                          { font-weight: bold; }
+h1                          { font-size: +140%; font-style: italic;
+                              font-weight: bold; }
+h2                          { font-size: +125%; font-style: italic;
+                              font-weight: bold; }
+h3                          { font-size: +110%; font-style: italic;
+                              font-weight: normal; }
+code                        { font-size: 100%; }
+/* N.B.: class, not pseudoclass */
+a.link                      { font-family: monospace; }
+ 
+/* Page Header & Footer
+ *   - The standard page header consists of a navigation bar (with
+ *     pointers to standard pages such as 'home' and 'trees'); a
+ *     breadcrumbs list, which can be used to navigate to containing
+ *     classes or modules; options links, to show/hide private
+ *     variables and to show/hide frames; and a page title (using
+ *     <h1>).  The page title may be followed by a link to the
+ *     corresponding source code (using 'span.codelink').
+ *   - The footer consists of a navigation bar, a timestamp, and a
+ *     pointer to epydoc's homepage.
+ */ 
+h1.epydoc                   { margin: 0; font-size: +140%; font-weight: bold; }
+h2.epydoc                   { font-size: +130%; font-weight: bold; }
+h3.epydoc                   { font-size: +115%; font-weight: bold;
+                              margin-top: 0.2em; }
+td h3.epydoc                { font-size: +115%; font-weight: bold;
+                              margin-bottom: 0; }
+table.navbar                { background: #a0c0ff; color: #000000;
+                              border: 2px groove #c0d0d0; }
+table.navbar table          { color: #000000; }
+th.navbar-select            { background: #70b0ff;
+                              color: #000000; } 
+table.navbar a              { text-decoration: none; }  
+table.navbar a:link         { color: #0000ff; }
+table.navbar a:visited      { color: #204080; }
+span.breadcrumbs            { font-size: 85%; font-weight: bold; }
+span.options                { font-size: 70%; }
+span.codelink               { font-size: 85%; }
+td.footer                   { font-size: 85%; }
+
+/* Table Headers
+ *   - Each summary table and details section begins with a 'header'
+ *     row.  This row contains a section title (marked by
+ *     'span.table-header') as well as a show/hide private link
+ *     (marked by 'span.options', defined above).
+ *   - Summary tables that contain user-defined groups mark those
+ *     groups using 'group header' rows.
+ */
+td.table-header             { background: #70b0ff; color: #000000;
+                              border: 1px solid #608090; }
+td.table-header table       { color: #000000; }
+td.table-header table a:link      { color: #0000ff; }
+td.table-header table a:visited   { color: #204080; }
+span.table-header           { font-size: 120%; font-weight: bold; }
+th.group-header             { background: #c0e0f8; color: #000000;
+                              text-align: left; font-style: italic; 
+                              font-size: 115%; 
+                              border: 1px solid #608090; }
+
+/* Summary Tables (functions, variables, etc)
+ *   - Each object is described by a single row of the table with
+ *     two cells.  The left cell gives the object's type, and is
+ *     marked with 'code.summary-type'.  The right cell gives the
+ *     object's name and a summary description.
+ *   - CSS styles for the table's header and group headers are
+ *     defined above, under 'Table Headers'
+ */
+table.summary               { border-collapse: collapse;
+                              background: #e8f0f8; color: #000000;
+                              border: 1px solid #608090;
+                              margin-bottom: 0.5em; }
+td.summary                  { border: 1px solid #608090; }
+code.summary-type           { font-size: 85%; }
+table.summary a:link        { color: #0000ff; }
+table.summary a:visited     { color: #204080; }
+
+
+/* Details Tables (functions, variables, etc)
+ *   - Each object is described in its own div.
+ *   - A single-row summary table w/ table-header is used as
+ *     a header for each details section (CSS style for table-header
+ *     is defined above, under 'Table Headers').
+ */
+table.details               { border-collapse: collapse;
+                              background: #e8f0f8; color: #000000;
+                              border: 1px solid #608090;
+                              margin: .2em 0 0 0; }
+table.details table         { color: #000000; }
+table.details a:link        { color: #0000ff; }
+table.details a:visited     { color: #204080; }
+
+/* Fields */
+dl.fields                   { margin-left: 2em; margin-top: 1em;
+                              margin-bottom: 1em; }
+dl.fields dd ul             { margin-left: 0em; padding-left: 0em; }
+dl.fields dd ul li ul       { margin-left: 2em; padding-left: 0em; }
+div.fields                  { margin-left: 2em; }
+div.fields p                { margin-bottom: 0.5em; }
+
+/* Index tables (identifier index, term index, etc)
+ *   - link-index is used for indices containing lists of links
+ *     (namely, the identifier index & term index).
+ *   - index-where is used in link indices for the text indicating
+ *     the container/source for each link.
+ *   - metadata-index is used for indices containing metadata
+ *     extracted from fields (namely, the bug index & todo index).
+ */
+table.link-index            { border-collapse: collapse;
+                              background: #e8f0f8; color: #000000;
+                              border: 1px solid #608090; }
+td.link-index               { border-width: 0px; }
+table.link-index a:link     { color: #0000ff; }
+table.link-index a:visited  { color: #204080; }
+span.index-where            { font-size: 70%; }
+table.metadata-index        { border-collapse: collapse;
+                              background: #e8f0f8; color: #000000;
+                              border: 1px solid #608090; 
+                              margin: .2em 0 0 0; }
+td.metadata-index           { border-width: 1px; border-style: solid; }
+table.metadata-index a:link { color: #0000ff; }
+table.metadata-index a:visited  { color: #204080; }
+
+/* Function signatures
+ *   - sig* is used for the signature in the details section.
+ *   - .summary-sig* is used for the signature in the summary 
+ *     table, and when listing property accessor functions.
+ * */
+.sig-name                   { color: #006080; }
+.sig-arg                    { color: #008060; }
+.sig-default                { color: #602000; }
+.summary-sig                { font-family: monospace; }
+.summary-sig-name           { color: #006080; font-weight: bold; }
+table.summary a.summary-sig-name:link
+                            { color: #006080; font-weight: bold; }
+table.summary a.summary-sig-name:visited
+                            { color: #006080; font-weight: bold; }
+.summary-sig-arg            { color: #006040; }
+.summary-sig-default        { color: #501800; }
+
+/* Subclass list
+ */
+ul.subclass-list { display: inline; }
+ul.subclass-list li { display: inline; }
+
+/* To render variables, classes etc. like functions */
+table.summary .summary-name { color: #006080; font-weight: bold;
+                              font-family: monospace; }
+table.summary
+     a.summary-name:link    { color: #006080; font-weight: bold;
+                              font-family: monospace; }
+table.summary
+    a.summary-name:visited  { color: #006080; font-weight: bold;
+                              font-family: monospace; }
+
+/* Variable values
+ *   - In the 'variable details' sections, each varaible's value is
+ *     listed in a 'pre.variable' box.  The width of this box is
+ *     restricted to 80 chars; if the value's repr is longer than
+ *     this it will be wrapped, using a backslash marked with
+ *     class 'variable-linewrap'.  If the value's repr is longer
+ *     than 3 lines, the rest will be ellided; and an ellipsis
+ *     marker ('...' marked with 'variable-ellipsis') will be used.
+ *   - If the value is a string, its quote marks will be marked
+ *     with 'variable-quote'.
+ *   - If the variable is a regexp, it is syntax-highlighted using
+ *     the re* CSS classes.
+ */
+pre.variable                { padding: .5em; margin: 0;
+                              background: #dce4ec; color: #000000;
+                              border: 1px solid #708890; }
+.variable-linewrap          { color: #604000; font-weight: bold; }
+.variable-ellipsis          { color: #604000; font-weight: bold; }
+.variable-quote             { color: #604000; font-weight: bold; }
+.variable-group             { color: #008000; font-weight: bold; }
+.variable-op                { color: #604000; font-weight: bold; }
+.variable-string            { color: #006030; }
+.variable-unknown           { color: #a00000; font-weight: bold; }
+.re                         { color: #000000; }
+.re-char                    { color: #006030; }
+.re-op                      { color: #600000; }
+.re-group                   { color: #003060; }
+.re-ref                     { color: #404040; }
+
+/* Base tree
+ *   - Used by class pages to display the base class hierarchy.
+ */
+pre.base-tree               { font-size: 80%; margin: 0; }
+
+/* Frames-based table of contents headers
+ *   - Consists of two frames: one for selecting modules; and
+ *     the other listing the contents of the selected module.
+ *   - h1.toc is used for each frame's heading
+ *   - h2.toc is used for subheadings within each frame.
+ */
+h1.toc                      { text-align: center; font-size: 105%;
+                              margin: 0; font-weight: bold;
+                              padding: 0; }
+h2.toc                      { font-size: 100%; font-weight: bold; 
+                              margin: 0.5em 0 0 -0.3em; }
+
+/* Syntax Highlighting for Source Code
+ *   - doctest examples are displayed in a 'pre.py-doctest' block.
+ *     If the example is in a details table entry, then it will use
+ *     the colors specified by the 'table pre.py-doctest' line.
+ *   - Source code listings are displayed in a 'pre.py-src' block.
+ *     Each line is marked with 'span.py-line' (used to draw a line
+ *     down the left margin, separating the code from the line
+ *     numbers).  Line numbers are displayed with 'span.py-lineno'.
+ *     The expand/collapse block toggle button is displayed with
+ *     'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not
+ *     modify the font size of the text.)
+ *   - If a source code page is opened with an anchor, then the
+ *     corresponding code block will be highlighted.  The code
+ *     block's header is highlighted with 'py-highlight-hdr'; and
+ *     the code block's body is highlighted with 'py-highlight'.
+ *   - The remaining py-* classes are used to perform syntax
+ *     highlighting (py-string for string literals, py-name for names,
+ *     etc.)
+ */
+pre.py-doctest              { padding: .5em; margin: 1em;
+                              background: #e8f0f8; color: #000000;
+                              border: 1px solid #708890; }
+table pre.py-doctest        { background: #dce4ec;
+                              color: #000000; }
+pre.py-src                  { border: 2px solid #000000; 
+                              background: #f0f0f0; color: #000000; }
+.py-line                    { border-left: 2px solid #000000; 
+                              margin-left: .2em; padding-left: .4em; }
+.py-lineno                  { font-style: italic; font-size: 90%;
+                              padding-left: .5em; }
+a.py-toggle                 { text-decoration: none; }
+div.py-highlight-hdr        { border-top: 2px solid #000000;
+                              border-bottom: 2px solid #000000;
+                              background: #d8e8e8; }
+div.py-highlight            { border-bottom: 2px solid #000000;
+                              background: #d0e0e0; }
+.py-prompt                  { color: #005050; font-weight: bold;}
+.py-more                    { color: #005050; font-weight: bold;}
+.py-string                  { color: #006030; }
+.py-comment                 { color: #003060; }
+.py-keyword                 { color: #600000; }
+.py-output                  { color: #404040; }
+.py-name                    { color: #000050; }
+.py-name:link               { color: #000050 !important; }
+.py-name:visited            { color: #000050 !important; }
+.py-number                  { color: #005000; }
+.py-defname                 { color: #000060; font-weight: bold; }
+.py-def-name                { color: #000060; font-weight: bold; }
+.py-base-class              { color: #000060; }
+.py-param                   { color: #000060; }
+.py-docstring               { color: #006030; }
+.py-decorator               { color: #804020; }
+/* Use this if you don't want links to names underlined: */
+/*a.py-name                   { text-decoration: none; }*/
+
+/* Graphs & Diagrams
+ *   - These CSS styles are used for graphs & diagrams generated using
+ *     Graphviz dot.  'img.graph-without-title' is used for bare
+ *     diagrams (to remove the border created by making the image
+ *     clickable).
+ */
+img.graph-without-title     { border: none; }
+img.graph-with-title        { border: 1px solid #000000; }
+span.graph-title            { font-weight: bold; }
+span.graph-caption          { }
+
+/* General-purpose classes
+ *   - 'p.indent-wrapped-lines' defines a paragraph whose first line
+ *     is not indented, but whose subsequent lines are.
+ *   - The 'nomargin-top' class is used to remove the top margin (e.g.
+ *     from lists).  The 'nomargin' class is used to remove both the
+ *     top and bottom margin (but not the left or right margin --
+ *     for lists, that would cause the bullets to disappear.)
+ */
+p.indent-wrapped-lines      { padding: 0 0 0 7em; text-indent: -7em; 
+                              margin: 0; }
+.nomargin-top               { margin-top: 0; }
+.nomargin                   { margin-top: 0; margin-bottom: 0; }
+
+/* HTML Log */
+div.log-block               { padding: 0; margin: .5em 0 .5em 0;
+                              background: #e8f0f8; color: #000000;
+                              border: 1px solid #000000; }
+div.log-error               { padding: .1em .3em .1em .3em; margin: 4px;
+                              background: #ffb0b0; color: #000000;
+                              border: 1px solid #000000; }
+div.log-warning             { padding: .1em .3em .1em .3em; margin: 4px;
+                              background: #ffffb0; color: #000000;
+                              border: 1px solid #000000; }
+div.log-info               { padding: .1em .3em .1em .3em; margin: 4px;
+                              background: #b0ffb0; color: #000000;
+                              border: 1px solid #000000; }
+h2.log-hdr                  { background: #70b0ff; color: #000000;
+                              margin: 0; padding: 0em 0.5em 0em 0.5em;
+                              border-bottom: 1px solid #000000; font-size: 110%; }
+p.log                       { font-weight: bold; margin: .5em 0 .5em 0; }
+tr.opt-changed              { color: #000000; font-weight: bold; }
+tr.opt-default              { color: #606060; }
+pre.log                     { margin: 0; padding: 0; padding-left: 1em; }
diff --git a/docs/epydoc.js b/docs/epydoc.js
new file mode 100644
index 0000000..e787dbc
--- /dev/null
+++ b/docs/epydoc.js
@@ -0,0 +1,293 @@
+function toggle_private() {
+        // Search for any private/public links on this page.  Store
+        // their old text in "cmd," so we will know what action to
+        // take; and change their text to the opposite action.
+        var cmd = "?";
+        var elts = document.getElementsByTagName("a");
+        for(var i=0; i<elts.length; i++) {
+          if (elts[i].className == "privatelink") {
+            cmd = elts[i].innerHTML;
+            elts[i].innerHTML = ((cmd && cmd.substr(0,4)=="show")?
+                                    "hide private":"show private");
+          }
+        }
+        // Update all DIVs containing private objects.
+        var elts = document.getElementsByTagName("div");
+        for(var i=0; i<elts.length; i++) {
+          if (elts[i].className == "private") {
+            elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"none":"block");
+          }
+          else if (elts[i].className == "public") {
+            elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"block":"none");
+          }
+        }
+        // Update all table rows containing private objects.  Note, we
+        // use "" instead of "block" becaue IE & firefox disagree on what
+        // this should be (block vs table-row), and "" just gives the
+        // default for both browsers.
+        var elts = document.getElementsByTagName("tr");
+        for(var i=0; i<elts.length; i++) {
+          if (elts[i].className == "private") {
+            elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"none":"");
+          }
+        }
+        // Update all list items containing private objects.
+        var elts = document.getElementsByTagName("li");
+        for(var i=0; i<elts.length; i++) {
+          if (elts[i].className == "private") {
+            elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?
+                                        "none":"");
+          }
+        }
+        // Update all list items containing private objects.
+        var elts = document.getElementsByTagName("ul");
+        for(var i=0; i<elts.length; i++) {
+          if (elts[i].className == "private") {
+            elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"none":"block");
+          }
+        }
+        // Set a cookie to remember the current option.
+        document.cookie = "EpydocPrivate="+cmd;
+      }
+function show_private() {
+        var elts = document.getElementsByTagName("a");
+        for(var i=0; i<elts.length; i++) {
+          if (elts[i].className == "privatelink") {
+            cmd = elts[i].innerHTML;
+            if (cmd && cmd.substr(0,4)=="show")
+                toggle_private();
+          }
+        }
+      }
+function getCookie(name) {
+        var dc = document.cookie;
+        var prefix = name + "=";
+        var begin = dc.indexOf("; " + prefix);
+        if (begin == -1) {
+          begin = dc.indexOf(prefix);
+          if (begin != 0) return null;
+        } else
+        { begin += 2; }
+        var end = document.cookie.indexOf(";", begin);
+        if (end == -1)
+        { end = dc.length; }
+        return unescape(dc.substring(begin + prefix.length, end));
+      }
+function setFrame(url1, url2) {
+          parent.frames[1].location.href = url1;
+          parent.frames[2].location.href = url2;
+      }
+function checkCookie() {
+        var cmd=getCookie("EpydocPrivate");
+        if (cmd && cmd.substr(0,4)!="show" && location.href.indexOf("#_") < 0)
+            toggle_private();
+      }
+function toggleCallGraph(id) {
+        var elt = document.getElementById(id);
+        if (elt.style.display == "none")
+            elt.style.display = "block";
+        else
+            elt.style.display = "none";
+      }
+function expand(id) {
+  var elt = document.getElementById(id+"-expanded");
+  if (elt) elt.style.display = "block";
+  var elt = document.getElementById(id+"-expanded-linenums");
+  if (elt) elt.style.display = "block";
+  var elt = document.getElementById(id+"-collapsed");
+  if (elt) { elt.innerHTML = ""; elt.style.display = "none"; }
+  var elt = document.getElementById(id+"-collapsed-linenums");
+  if (elt) { elt.innerHTML = ""; elt.style.display = "none"; }
+  var elt = document.getElementById(id+"-toggle");
+  if (elt) { elt.innerHTML = "-"; }
+}
+
+function collapse(id) {
+  var elt = document.getElementById(id+"-expanded");
+  if (elt) elt.style.display = "none";
+  var elt = document.getElementById(id+"-expanded-linenums");
+  if (elt) elt.style.display = "none";
+  var elt = document.getElementById(id+"-collapsed-linenums");
+  if (elt) { elt.innerHTML = "<br />"; elt.style.display="block"; }
+  var elt = document.getElementById(id+"-toggle");
+  if (elt) { elt.innerHTML = "+"; }
+  var elt = document.getElementById(id+"-collapsed");
+  if (elt) {
+    elt.style.display = "block";
+    
+    var indent = elt.getAttribute("indent");
+    var pad = elt.getAttribute("pad");
+    var s = "<tt class='py-lineno'>";
+    for (var i=0; i<pad.length; i++) { s += " " }
+    s += "</tt>";
+    s += "  <tt class='py-line'>";
+    for (var i=0; i<indent.length; i++) { s += " " }
+    s += "<a href='#' onclick='expand(\"" + id;
+    s += "\");return false'>...</a></tt><br />";
+    elt.innerHTML = s;
+  }
+}
+
+function toggle(id) {
+  elt = document.getElementById(id+"-toggle");
+  if (elt.innerHTML == "-")
+      collapse(id); 
+  else
+      expand(id);
+  return false;
+}
+
+function highlight(id) {
+  var elt = document.getElementById(id+"-def");
+  if (elt) elt.className = "py-highlight-hdr";
+  var elt = document.getElementById(id+"-expanded");
+  if (elt) elt.className = "py-highlight";
+  var elt = document.getElementById(id+"-collapsed");
+  if (elt) elt.className = "py-highlight";
+}
+
+function num_lines(s) {
+  var n = 1;
+  var pos = s.indexOf("\n");
+  while ( pos > 0) {
+    n += 1;
+    pos = s.indexOf("\n", pos+1);
+  }
+  return n;
+}
+
+// Collapse all blocks that mave more than `min_lines` lines.
+function collapse_all(min_lines) {
+  var elts = document.getElementsByTagName("div");
+  for (var i=0; i<elts.length; i++) {
+    var elt = elts[i];
+    var split = elt.id.indexOf("-");
+    if (split > 0)
+      if (elt.id.substring(split, elt.id.length) == "-expanded")
+        if (num_lines(elt.innerHTML) > min_lines)
+          collapse(elt.id.substring(0, split));
+  }
+}
+
+function expandto(href) {
+  var start = href.indexOf("#")+1;
+  if (start != 0 && start != href.length) {
+    if (href.substring(start, href.length) != "-") {
+      collapse_all(4);
+      pos = href.indexOf(".", start);
+      while (pos != -1) {
+        var id = href.substring(start, pos);
+        expand(id);
+        pos = href.indexOf(".", pos+1);
+      }
+      var id = href.substring(start, href.length);
+      expand(id);
+      highlight(id);
+    }
+  }
+}
+
+function kill_doclink(id) {
+  var parent = document.getElementById(id);
+  parent.removeChild(parent.childNodes.item(0));
+}
+function auto_kill_doclink(ev) {
+  if (!ev) var ev = window.event;
+  if (!this.contains(ev.toElement)) {
+    var parent = document.getElementById(this.parentID);
+    parent.removeChild(parent.childNodes.item(0));
+  }
+}
+
+function doclink(id, name, targets_id) {
+  var elt = document.getElementById(id);
+
+  // If we already opened the box, then destroy it.
+  // (This case should never occur, but leave it in just in case.)
+  if (elt.childNodes.length > 1) {
+    elt.removeChild(elt.childNodes.item(0));
+  }
+  else {
+    // The outer box: relative + inline positioning.
+    var box1 = document.createElement("div");
+    box1.style.position = "relative";
+    box1.style.display = "inline";
+    box1.style.top = 0;
+    box1.style.left = 0;
+  
+    // A shadow for fun
+    var shadow = document.createElement("div");
+    shadow.style.position = "absolute";
+    shadow.style.left = "-1.3em";
+    shadow.style.top = "-1.3em";
+    shadow.style.background = "#404040";
+    
+    // The inner box: absolute positioning.
+    var box2 = document.createElement("div");
+    box2.style.position = "relative";
+    box2.style.border = "1px solid #a0a0a0";
+    box2.style.left = "-.2em";
+    box2.style.top = "-.2em";
+    box2.style.background = "white";
+    box2.style.padding = ".3em .4em .3em .4em";
+    box2.style.fontStyle = "normal";
+    box2.onmouseout=auto_kill_doclink;
+    box2.parentID = id;
+
+    // Get the targets
+    var targets_elt = document.getElementById(targets_id);
+    var targets = targets_elt.getAttribute("targets");
+    var links = "";
+    target_list = targets.split(",");
+    for (var i=0; i<target_list.length; i++) {
+        var target = target_list[i].split("=");
+        links += "<li><a href='" + target[1] + 
+               "' style='text-decoration:none'>" +
+               target[0] + "</a></li>";
+    }
+  
+    // Put it all together.
+    elt.insertBefore(box1, elt.childNodes.item(0));
+    //box1.appendChild(box2);
+    box1.appendChild(shadow);
+    shadow.appendChild(box2);
+    box2.innerHTML =
+        "Which <b>"+name+"</b> do you want to see documentation for?" +
+        "<ul style='margin-bottom: 0;'>" +
+        links + 
+        "<li><a href='#' style='text-decoration:none' " +
+        "onclick='kill_doclink(\""+id+"\");return false;'>"+
+        "<i>None of the above</i></a></li></ul>";
+  }
+  return false;
+}
+
+function get_anchor() {
+          var href = location.href;
+          var start = href.indexOf("#")+1;
+          if ((start != 0) && (start != href.length))
+              return href.substring(start, href.length);
+      }
+function redirect_url(dottedName) {
+          // Scan through each element of the "pages" list, and check
+          // if "name" matches with any of them.
+          for (var i=0; i<pages.length; i++) {
+
+              // Each page has the form "<pagename>-m" or "<pagename>-c";
+              // extract the <pagename> portion & compare it to dottedName.
+              var pagename = pages[i].substring(0, pages[i].length-2);
+              if (pagename == dottedName.substring(0,pagename.length)) {
+
+                  // We've found a page that matches `dottedName`;
+                  // construct its URL, using leftover `dottedName`
+                  // content to form an anchor.
+                  var pagetype = pages[i].charAt(pages[i].length-1);
+                  var url = pagename + ((pagetype=="m")?"-module.html":
+                                                        "-class.html");
+                  if (dottedName.length > pagename.length)
+                      url += "#" + dottedName.substring(pagename.length+1,
+                                                        dottedName.length);
+                  return url;
+              }
+          }
+      }
diff --git a/docs/help.html b/docs/help.html
new file mode 100644
index 0000000..19be57b
--- /dev/null
+++ b/docs/help.html
@@ -0,0 +1,262 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>Help</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="pygrib-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Help   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%"> </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+
+<h1 class="epydoc"> API Documentation </h1>
+
+<p> This document contains the API (Application Programming Interface)
+documentation for this project.  Documentation for the Python
+objects defined by the project is divided into separate pages for each
+package, module, and class.  The API documentation also includes two
+pages containing information about the project as a whole: a trees
+page, and an index page.  </p>
+
+<h2> Object Documentation </h2>
+
+  <p>Each <strong>Package Documentation</strong> page contains: </p>
+  <ul>
+    <li> A description of the package. </li>
+    <li> A list of the modules and sub-packages contained by the
+    package.  </li>
+    <li> A summary of the classes defined by the package. </li>
+    <li> A summary of the functions defined by the package. </li>
+    <li> A summary of the variables defined by the package. </li>
+    <li> A detailed description of each function defined by the
+    package. </li>
+    <li> A detailed description of each variable defined by the
+    package. </li>
+  </ul>
+  
+  <p>Each <strong>Module Documentation</strong> page contains:</p>
+  <ul>
+    <li> A description of the module. </li>
+    <li> A summary of the classes defined by the module. </li>
+    <li> A summary of the functions defined by the module. </li>
+    <li> A summary of the variables defined by the module. </li>
+    <li> A detailed description of each function defined by the
+    module. </li>
+    <li> A detailed description of each variable defined by the
+    module. </li>
+  </ul>
+  
+  <p>Each <strong>Class Documentation</strong> page contains: </p>
+  <ul>
+    <li> A class inheritance diagram. </li>
+    <li> A list of known subclasses. </li>
+    <li> A description of the class. </li>
+    <li> A summary of the methods defined by the class. </li>
+    <li> A summary of the instance variables defined by the class. </li>
+    <li> A summary of the class (static) variables defined by the
+    class. </li> 
+    <li> A detailed description of each method defined by the
+    class. </li>
+    <li> A detailed description of each instance variable defined by the
+    class. </li> 
+    <li> A detailed description of each class (static) variable defined
+    by the class. </li> 
+  </ul>
+
+<h2> Project Documentation </h2>
+
+  <p> The <strong>Trees</strong> page contains the module and class hierarchies: </p>
+  <ul>
+    <li> The <em>module hierarchy</em> lists every package and module, with
+    modules grouped into packages.  At the top level, and within each
+    package, modules and sub-packages are listed alphabetically. </li>
+    <li> The <em>class hierarchy</em> lists every class, grouped by base
+    class.  If a class has more than one base class, then it will be
+    listed under each base class.  At the top level, and under each base
+    class, classes are listed alphabetically. </li>
+  </ul>
+  
+  <p> The <strong>Index</strong> page contains indices of terms and
+  identifiers: </p>
+  <ul>
+    <li> The <em>term index</em> lists every term indexed by any object's
+    documentation.  For each term, the index provides links to each
+    place where the term is indexed. </li>
+    <li> The <em>identifier index</em> lists the (short) name of every package,
+    module, class, method, function, variable, and parameter.  For each
+    identifier, the index provides a short description, and a link to
+    its documentation. </li>
+  </ul>
+
+<h2> The Table of Contents </h2>
+
+<p> The table of contents occupies the two frames on the left side of
+the window.  The upper-left frame displays the <em>project
+contents</em>, and the lower-left frame displays the <em>module
+contents</em>: </p>
+
+<table class="help summary" border="1" cellspacing="0" cellpadding="3">
+  <tr style="height: 30%">
+    <td align="center" style="font-size: small">
+       Project<br />Contents<hr />...</td>
+    <td align="center" style="font-size: small" rowspan="2" width="70%">
+      API<br />Documentation<br />Frame<br /><br /><br />
+    </td>
+  </tr>
+  <tr>
+    <td align="center" style="font-size: small">
+      Module<br />Contents<hr /> <br />...<br /> 
+    </td>
+  </tr>
+</table><br />
+
+<p> The <strong>project contents frame</strong> contains a list of all packages
+and modules that are defined by the project.  Clicking on an entry
+will display its contents in the module contents frame.  Clicking on a
+special entry, labeled "Everything," will display the contents of
+the entire project. </p>
+
+<p> The <strong>module contents frame</strong> contains a list of every
+submodule, class, type, exception, function, and variable defined by a
+module or package.  Clicking on an entry will display its
+documentation in the API documentation frame.  Clicking on the name of
+the module, at the top of the frame, will display the documentation
+for the module itself. </p>
+
+<p> The "<strong>frames</strong>" and "<strong>no frames</strong>" buttons below the top
+navigation bar can be used to control whether the table of contents is
+displayed or not. </p>
+
+<h2> The Navigation Bar </h2>
+
+<p> A navigation bar is located at the top and bottom of every page.
+It indicates what type of page you are currently viewing, and allows
+you to go to related pages.  The following table describes the labels
+on the navigation bar.  Note that not some labels (such as
+[Parent]) are not displayed on all pages. </p>
+
+<table class="summary" border="1" cellspacing="0" cellpadding="3" width="100%">
+<tr class="summary">
+  <th>Label</th>
+  <th>Highlighted when...</th>
+  <th>Links to...</th>
+</tr>
+  <tr><td valign="top"><strong>[Parent]</strong></td>
+      <td valign="top"><em>(never highlighted)</em></td>
+      <td valign="top"> the parent of the current package </td></tr>
+  <tr><td valign="top"><strong>[Package]</strong></td>
+      <td valign="top">viewing a package</td>
+      <td valign="top">the package containing the current object
+      </td></tr>
+  <tr><td valign="top"><strong>[Module]</strong></td>
+      <td valign="top">viewing a module</td>
+      <td valign="top">the module containing the current object
+      </td></tr> 
+  <tr><td valign="top"><strong>[Class]</strong></td>
+      <td valign="top">viewing a class </td>
+      <td valign="top">the class containing the current object</td></tr>
+  <tr><td valign="top"><strong>[Trees]</strong></td>
+      <td valign="top">viewing the trees page</td>
+      <td valign="top"> the trees page </td></tr>
+  <tr><td valign="top"><strong>[Index]</strong></td>
+      <td valign="top">viewing the index page</td>
+      <td valign="top"> the index page </td></tr>
+  <tr><td valign="top"><strong>[Help]</strong></td>
+      <td valign="top">viewing the help page</td>
+      <td valign="top"> the help page </td></tr>
+</table>
+
+<p> The "<strong>show private</strong>" and "<strong>hide private</strong>" buttons below
+the top navigation bar can be used to control whether documentation
+for private objects is displayed.  Private objects are usually defined
+as objects whose (short) names begin with a single underscore, but do
+not end with an underscore.  For example, "<code>_x</code>",
+"<code>__pprint</code>", and "<code>epydoc.epytext._tokenize</code>"
+are private objects; but "<code>re.sub</code>",
+"<code>__init__</code>", and "<code>type_</code>" are not.  However,
+if a module defines the "<code>__all__</code>" variable, then its
+contents are used to decide which objects are private. </p>
+
+<p> A timestamp below the bottom navigation bar indicates when each
+page was last updated. </p>
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="pygrib-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Help   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1 on Fri Feb  7 15:35:47 2014
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/docs/identifier-index.html b/docs/identifier-index.html
new file mode 100644
index 0000000..188ec16
--- /dev/null
+++ b/docs/identifier-index.html
@@ -0,0 +1,495 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>Identifier Index</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="pygrib-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Indices   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%"> </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<table border="0" width="100%">
+<tr valign="bottom"><td>
+<h1 class="epydoc">Identifier Index</h1>
+</td><td>
+[
+ <a href="#A">A</a>
+  B
+ <a href="#C">C</a>
+ <a href="#D">D</a>
+ <a href="#E">E</a>
+ <a href="#F">F</a>
+ <a href="#G">G</a>
+ <a href="#H">H</a>
+ <a href="#I">I</a>
+ <a href="#J">J</a>
+ <a href="#K">K</a>
+ <a href="#L">L</a>
+ <a href="#M">M</a>
+ <a href="#N">N</a>
+ <a href="#O">O</a>
+ <a href="#P">P</a>
+  Q
+ <a href="#R">R</a>
+ <a href="#S">S</a>
+ <a href="#T">T</a>
+  U
+ <a href="#V">V</a>
+ <a href="#W">W</a>
+  X
+  Y
+  Z
+ <a href="#_">_</a>
+]
+</td></table>
+<table border="0" width="100%">
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="A">A</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#analDate">analDate</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="C">C</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.index-class.html#close">close()</a><br />
+<span class="index-where">(in <a href="pygrib.index-class.html">index</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#close">close()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#closed">closed</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="D">D</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#data">data()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#datetime_to_julian">datetime_to_julian()</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#default_encoding">default_encoding</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="E">E</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#expand_grid">expand_grid()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#expand_reduced">expand_reduced</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="F">F</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#fcstimeunits">fcstimeunits</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#fromstring">fromstring()</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="G">G</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib-module.html#gaulats">gaulats()</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#grib_api_version">grib_api_version</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html">gribmessage</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="H">H</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#has_key">has_key()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#has_multi_field_msgs">has_multi_field_msgs</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="I">I</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.index-class.html">index</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#is_missing">is_missing()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="J">J</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib-module.html#julian_to_datetime">julian_to_datetime()</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="K">K</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.index-class.html#keys">keys</a><br />
+<span class="index-where">(in <a href="pygrib.index-class.html">index</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#keys">keys()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="L">L</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#latlons">latlons()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="M">M</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#message">message()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#messages">messages</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#multi_support_off">multi_support_off()</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#messagenumber">messagenumber</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#missingvalue_float">missingvalue_float</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#multi_support_on">multi_support_on()</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#messagenumber">messagenumber</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#missingvalue_int">missingvalue_int</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="N">N</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.index-class.html#name">name</a><br />
+<span class="index-where">(in <a href="pygrib.index-class.html">index</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#name">name</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#next">next()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="O">O</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html">open</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="P">P</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#projparams">projparams</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html">pygrib</a></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="R">R</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#read">read()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#reload">reload()</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#readline">readline()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#rewind">rewind()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="S">S</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#seek">seek()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#select">select()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.index-class.html#select">select()</a><br />
+<span class="index-where">(in <a href="pygrib.index-class.html">index</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#setdates">setdates()</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="T">T</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#tell">tell()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#tolerate_badgrib_off">tolerate_badgrib_off()</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#tostring">tostring()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="pygrib-module.html#tolerate_badgrib">tolerate_badgrib</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#tolerate_badgrib_on">tolerate_badgrib_on()</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.index-class.html#types">types</a><br />
+<span class="index-where">(in <a href="pygrib.index-class.html">index</a>)</span></td>
+</tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="V">V</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#valid_key">valid_key()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#validDate">validDate</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="W">W</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.index-class.html#write">write()</a><br />
+<span class="index-where">(in <a href="pygrib.index-class.html">index</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="_">_</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.index-class.html#__call__">__call__()</a><br />
+<span class="index-where">(in <a href="pygrib.index-class.html">index</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#__getitem__">__getitem__()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#__package__">__package__</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#__call__">__call__()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#__init__">__init__()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#__repr__">__repr__()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#__delattr__">__delattr__()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.index-class.html#__init__">__init__()</a><br />
+<span class="index-where">(in <a href="pygrib.index-class.html">index</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#__setattr__">__setattr__()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#__delitem__">__delitem__()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#__init__">__init__()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#__setitem__">__setitem__()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#__enter__">__enter__()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#__iter__">__iter__()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#__version__">__version__</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#__exit__">__exit__()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#__new__">__new__()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#_ftimedict">_ftimedict</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#__getattr__">__getattr__()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.index-class.html#__new__">__new__()</a><br />
+<span class="index-where">(in <a href="pygrib.index-class.html">index</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib-module.html#_private_atts">_private_atts</a><br />
+<span class="index-where">(in <a href="pygrib-module.html">pygrib</a>)</span></td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#__getattribute__">__getattribute__()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#__new__">__new__()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="pygrib.gribmessage-class.html#__getitem__">__getitem__()</a><br />
+<span class="index-where">(in <a href="pygrib.gribmessage-class.html">gribmessage</a>)</span></td>
+<td width="33%" class="link-index"><a href="pygrib.open-class.html#__next__">__next__()</a><br />
+<span class="index-where">(in <a href="pygrib.open-class.html">open</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+</table>
+</td></tr>
+</table>
+<br /><br /><!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="pygrib-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Indices   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1 on Fri Feb  7 15:35:47 2014
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/docs/index.html b/docs/index.html
new file mode 100644
index 0000000..3bbe171
--- /dev/null
+++ b/docs/index.html
@@ -0,0 +1,738 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>pygrib</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Home   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%">
+      <span class="breadcrumbs">
+        Module pygrib
+      </span>
+    </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<!-- ==================== MODULE DESCRIPTION ==================== -->
+<h1 class="epydoc">Module pygrib</h1><p class="nomargin-top"></p>
+<h1 class="heading">Introduction</h1>
+    <p>Python module for reading and writing GRIB (editions 1 and 2) files.
+    GRIB is the World Meterological Organization <a 
+    href="http://www.wmo.ch/pages/prog/www/WMOCodes/GRIB.html" 
+    target="_top">standard</a> for distributing gridded data. The module is
+    a python interface to the <a 
+    href="https://software.ecmwf.int/wiki/display/GRIB/Home" 
+    target="_top">GRIB API</a> C library from the European Centre for 
+    Medium-Range Weather Forecasts (<a href="http://www.ecmwf.int" 
+    target="_top">ECMWF</a>).</p>
+  <h1 class="heading">Required</h1>
+    <ul>
+      <li>
+        <a href="http://python.org" target="_top">Python</a> 2.4 or higher.
+      </li>
+      <li>
+        <a 
+        href="http://sourceforge.net/project/showfiles.php?group_id=1369" 
+        target="_top">numpy</a> N-dimensional array object for python. 
+        Version 1.2.1 or higher (version 1.5.1 required for Python 3).
+      </li>
+      <li>
+        <a href="http://code.google.com/p/pyproj/" target="_top">pyproj</a>
+        Python interface to <a href="http://trac.osgeo.org/proj" 
+        target="_top">PROJ.4</a> library for cartographic transformations 
+        <b>or</b> <a href="http://matplotlib.sf.net" 
+        target="_top">matplotlib</a> and the <a 
+        href="http://matplotlib.sf.net/basemap/doc/html" 
+        target="_top">basemap</a> toolkit. Pyproj 1.8.9 is required for 
+        Python 3.
+      </li>
+      <li>
+        <a href="https://software.ecmwf.int/wiki/display/GRIB/Home" 
+        target="_top">GRIB API</a> C library for encoding and decoding GRIB
+        messages (edition 1 and edition 2). Version 1.8.0 or higher 
+        required. To be fully functional, the GRIB API library requires <a 
+        href="http://www.ece.uvic.ca/~mdadams/jasper" 
+        target="_top">Jasper</a> or <a href="http://www.openjpeg.org" 
+        target="_top">OpenJPEG</a> for JPEG200 encoding, and <a 
+        href="http://www.libpng.org/pub/png/libpng.html" 
+        target="_top">PNG</a> for PNG encoding.
+      </li>
+    </ul>
+    <p>These dependencies are available via the package management system 
+    of most Linux distributions, and on MacOS X using <a 
+    href="http://macports.org/" target="_top">macports</a>. If you build 
+    grib_api yourself as a static library on a 64-bit system you may need 
+    to set <code>CFLAGS</code> to <code>'-O2 -fPIC'</code> before running 
+    the <code>configure</code> script.  To use pygrib on Windows, you must 
+    use the <a href="http://cygwin.com" target="_top">Cygwin</a> 
+    environment, since the grib_api library requires a posix environment.  
+    Cygwin installation instructions are available <a 
+    href="http://code.google.com/p/pygrib/wiki/CygwinWindowsInstall" 
+    target="_top">here</a>.</p>
+  <h1 class="heading">Installation</h1>
+    <ul>
+      <li>
+        <a href="http://code.google.com/p/pygrib/downloads/list" 
+        target="_top">Download</a> the source code.
+      </li>
+      <li>
+        pygrib installation options can either be set with environment 
+        variables, or specified in a text file (setup.cfg).  To use 
+        environment variables, set <code>$GRIBAPI_DIR</code>, 
+        <code>$JASPER_DIR</code>, <code>$OPENJPEG_DIR</code>, 
+        <code>$PNG_DIR</code> and <code>$ZLIB_DIR</code> so that the 
+        include files and libraries for GRIB API, Jasper, OpenJPEG, PNG and
+        zlib will be found. For example, the include files for jasper 
+        should be found in <code>$JASPER_DIR/include</code> or 
+        <code>$JASPER_DIR/include/jasper</code>, and the jasper library 
+        should be found in <code>$JASPER_DIR/lib</code> or 
+        <code>$JASPER_DIR/lib64</code>. If any of those environment 
+        variables are not set, then it is assumed that GRIB API was not 
+        built with support for that library. If the libraries and include 
+        files are installed in separate locations, the environment 
+        variables <code>$GRIBAPI_INCDIR</code> and 
+        <code>$GRIBAPI_LIBDIR</code> can be used to define the locations 
+        separately (same goes for <code>JASPER</code>, 
+        <code>OPENJPEG</code>, <code>PNG</code> and <code>ZLIB</code>). 
+        Note that if both <code>$GRIBAPI_DIR</code> and 
+        <code>$GRIBAPI_INCDIR</code>/<code>$GRIBAPI_LIBDIR</code> are 
+        specified, <code>$GRIBAPI_DIR</code> takes precedence. To use 
+        setup.cfg, copy setup.cfg.template to setup.cfg, open setup.cfg in 
+        a text editor and follow the instructions in the comments for 
+        editing.
+      </li>
+      <li>
+        Run 'python setup.py build' and then 'python setup.py install', as 
+        root if necessary. Note that if you are using environment variables
+        to specify the build options, you cannot build and install in one 
+        step with 'sudo python setup.py install', since sudo does not pass 
+        environment variables.  Instead, run 'python setup.py build' first 
+        as a regular user, then run 'sudo python setup.py install' if the 
+        install directory requires admin or root privileges.
+      </li>
+      <li>
+        Run 'python test.py' to test your installation.
+      </li>
+      <li>
+        Look at examples in <code>test</code> directory (most require <a 
+        href="http://matplotlib.sf.net" target="_top">matplotlib</a> and <a
+        href="http://matplotlib.sourceforge.net/basemap/doc/html/" 
+        target="_top">basemap</a>).
+      </li>
+      <li>
+        If you're on MacOS X, see <a 
+        href="http://pygrib.googlecode.com/svn/trunk/README.macosx" 
+        target="_top">README.macosx</a> for special instruction on how to 
+        install pygrib and all it's dependencies using <a 
+        href="http://macports.org" target="_top">macports</a>.
+      </li>
+    </ul>
+  <h1 class="heading">Example usage</h1>
+    <ul>
+      <li>
+        from the python interpreter prompt, import the package:
+<pre class="literalblock">
+  >>> import pygrib
+</pre>
+      </li>
+      <li>
+        open a GRIB file, create a grib message iterator:
+<pre class="literalblock">
+  >>> grbs = pygrib.open('sampledata/flux.grb')  
+</pre>
+      </li>
+      <li>
+        pygrib open instances behave like regular python file objects, with
+        <code>seek</code>, <code>tell</code>, <code>read</code>, 
+        <code>readline</code> and <code>close</code> methods, except that 
+        offsets are measured in grib messages instead of bytes:
+<pre class="literalblock">
+  >>> grbs.seek(2)
+  >>> grbs.tell()
+  2
+  >>> grb = grbs.read(1)[0] # read returns a list with the next N (N=1 in this case) messages.
+  >>> grb # printing a grib message object displays summary info
+  3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+  >>> grbs.tell()
+  3
+</pre>
+      </li>
+      <li>
+        print an inventory of the file:
+<pre class="literalblock">
+  >>> grbs.seek(0)
+  >>> for grb in grbs:
+  >>>     grb 
+  1:Precipitation rate:kg m**-2 s**-1 (avg):regular_gg:surface:level 0:fcst time 108-120 hrs (avg):from 200402291200
+  2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200
+  3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+  4:Minimum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+</pre>
+      </li>
+      <li>
+        find the first grib message with a matching name:
+<pre class="literalblock">
+  >>> grb = grbs.select(name='Maximum temperature')[0]
+</pre>
+      </li>
+      <li>
+        extract the data values using the 'values' key (grb.keys() will 
+        return a list of the available keys):
+<pre class="literalblock">
+  # The data is returned as a numpy array, or if missing values or a bitmap
+  # are present, a numpy masked array.  Reduced lat/lon or gaussian grid
+  # data is automatically expanded to a regular grid. Details of the internal
+  # representation of the grib data (such as the scanning mode) are handled
+  # automatically.
+  >>> maxt = grb.values # same as grb['values']
+  >>> maxt.shape, maxt.min(), maxt.max()
+  (94, 192) 223.7 319.9
+</pre>
+      </li>
+      <li>
+        get the latitudes and longitudes of the grid:
+<pre class="literalblock">
+  >>> lats, lons = grb.latlons()
+  >>> lats.shape, lats.min(), lats.max(), lons.shape, lons.min(), lons.max()
+  (94, 192) -88.5419501373 88.5419501373  0.0 358.125
+</pre>
+      </li>
+      <li>
+        get the second grib message:
+<pre class="literalblock">
+  >>> grb = grbs.message(2) # same as grbs.seek(1); grb=grbs.readline()
+  >>> grb
+  2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200
+</pre>
+      </li>
+      <li>
+        extract data and get lat/lon values for a subset over North 
+        America:
+<pre class="literalblock">
+  >>> data, lats, lons = grb.data(lat1=20,lat2=70,lon1=220,lon2=320)
+  >>> data.shape, lats.min(), lats.max(), lons.min(), lons.max()
+  (26, 53) 21.904439458 69.5216630593 221.25 318.75
+</pre>
+      </li>
+      <li>
+        modify the values associated with existing keys (either via 
+        attribute or dictionary access):
+<pre class="literalblock">
+  >>> grb['forecastTime'] = 240
+  >>> grb.dataDate = 20100101
+</pre>
+      </li>
+      <li>
+        get the binary string associated with the coded message:
+<pre class="literalblock">
+  >>> msg = grb.tostring()
+  >>> grbs.close() # close the grib file.
+</pre>
+      </li>
+      <li>
+        write the modified message to a new GRIB file:
+<pre class="literalblock">
+  >>> grbout = open('test.grb','wb')
+  >>> grbout.write(msg)
+  >>> grbout.close()
+  >>> pygrib.open('test.grb').readline() 
+  1:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 240 hrs:from 201001011200
+</pre>
+      </li>
+    </ul>
+  <h1 class="heading">Documentation</h1>
+    <ul>
+      <li>
+        see below for the full python API documentation.
+      </li>
+    </ul>
+  <h1 class="heading">Changelog</h1>
+    <ul>
+      <li>
+        see <a href="http://pygrib.googlecode.com/svn/trunk/Changelog" 
+        target="_top">Changelog</a> file.
+      </li>
+    </ul>
+
+<hr />
+<div class="fields">      <p><strong>Author:</strong>
+        Jeffrey Whitaker.
+      </p>
+      <p><strong>Contact:</strong>
+        <a href="mailto:jeffrey.s.whitaker at noaa.gov" target="_top">Jeff 
+        Whitaker</a>
+      </p>
+      <p><strong>Version:</strong>
+        1.9.9
+      </p>
+      <p><strong>Copyright:</strong>
+        copyright 2010 by Jeffrey Whitaker.
+      </p>
+      <p><strong>License:</strong>
+        Permission to use, copy, modify, and distribute this software and 
+        its documentation for any purpose and without fee is hereby 
+        granted, provided that the above copyright notice appear in all 
+        copies and that both that copyright notice and this permission 
+        notice appear in supporting documentation. THE AUTHOR DISCLAIMS ALL
+        WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED 
+        WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 
+        AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
+        OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 
+        PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 
+        TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 
+        PERFORMANCE OF THIS SOFTWARE.
+      </p>
+</div><!-- ==================== CLASSES ==================== -->
+<a name="section-Classes"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Classes</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="pygrib.gribmessage-class.html" class="summary-name">gribmessage</a><br />
+      Grib message object.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="pygrib.index-class.html" class="summary-name">index</a><br />
+      index(filename, *args)
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="pygrib.open-class.html" class="summary-name">open</a><br />
+      open(filename)
+    </td>
+  </tr>
+</table>
+<!-- ==================== FUNCTIONS ==================== -->
+<a name="section-Functions"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Functions</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="datetime_to_julian"></a><span class="summary-sig-name">datetime_to_julian</span>(<span class="summary-sig-arg">date</span>)</span><br />
+      convert python datetime instance to Julian day number.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="fromstring"></a><span class="summary-sig-name">fromstring</span>(<span class="summary-sig-arg">string</span>)</span><br />
+      Create a gribmessage instance from a python bytes object representing
+      a binary grib message (the reverse of <a 
+      href="pygrib.gribmessage-class.html#tostring" 
+      class="link">gribmessage.tostring</a>).</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib-module.html#gaulats" class="summary-sig-name">gaulats</a>(<span class="summary-sig-arg">nlats</span>)</span><br />
+      Returns nlats gaussian latitudes, in degrees, oriented from north to 
+      south.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib-module.html#julian_to_datetime" class="summary-sig-name">julian_to_datetime</a>(<span class="summary-sig-arg">julday</span>)</span><br />
+      convert Julian day number to python datetime instance.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="multi_support_off"></a><span class="summary-sig-name">multi_support_off</span>(<span class="summary-sig-arg">...</span>)</span><br />
+      turn off support for multi-field grib messages</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="multi_support_on"></a><span class="summary-sig-name">multi_support_on</span>(<span class="summary-sig-arg">...</span>)</span><br />
+      turn on support for multi-field grib messages (default)</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib-module.html#reload" class="summary-sig-name">reload</a>(<span class="summary-sig-arg">grb</span>)</span><br />
+      Recreate gribmessage object, updating all the keys to be consistent 
+      with each other.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib-module.html#setdates" class="summary-sig-name">setdates</a>(<span class="summary-sig-arg">grb</span>)</span><br />
+      set fcstimeunits, analDate and validDate attributes using julianDay, 
+      forecastTime and indicatorOfUnitOfTimeRange.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="tolerate_badgrib_off"></a><span class="summary-sig-name">tolerate_badgrib_off</span>(<span class="summary-sig-arg">...</span>)</span><br />
+      raise an exception when a missing or malformed key is encountered 
+      (default behavior).</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="tolerate_badgrib_on"></a><span class="summary-sig-name">tolerate_badgrib_on</span>(<span class="summary-sig-arg">...</span>)</span><br />
+      don't raise an exception when a missing or malformed key is 
+      encountered.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+</table>
+<!-- ==================== VARIABLES ==================== -->
+<a name="section-Variables"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Variables</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="None">None</code>
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="__version__"></a><span class="summary-name">__version__</span> = <code title="'1.9.9'"><code class="variable-quote">'</code><code class="variable-string">1.9.9</code><code class="variable-quote">'</code></code>
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="default_encoding"></a><span class="summary-name">default_encoding</span> = <code title="'ascii'"><code class="variable-quote">'</code><code class="variable-string">ascii</code><code class="variable-quote">'</code></code>
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="grib_api_version"></a><span class="summary-name">grib_api_version</span> = <code title="'1.11.0'"><code class="variable-quote">'</code><code class="variable-string">1.11.0</code><code class="variable-quote">'</code></code>
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="missingvalue_float"></a><span class="summary-name">missingvalue_float</span> = <code title="-1e+100">-1e+100</code>
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="missingvalue_int"></a><span class="summary-name">missingvalue_int</span> = <code title="4294967295">4294967295</code>
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="tolerate_badgrib"></a><span class="summary-name">tolerate_badgrib</span> = <code title="False">False</code>
+    </td>
+  </tr>
+</table>
+<!-- ==================== FUNCTION DETAILS ==================== -->
+<a name="section-FunctionDetails"></a>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Function Details</span></td>
+</tr>
+</table>
+<a name="gaulats"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">gaulats</span>(<span class="sig-arg">nlats</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>Returns nlats gaussian latitudes, in degrees, oriented from north to 
+  south.  nlats must be even.</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="julian_to_datetime"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">julian_to_datetime</span>(<span class="sig-arg">julday</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>convert Julian day number to python datetime instance.</p>
+  <p>Used to create validDate and analDate attributes from julianDay and 
+  forecastTime keys.</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="reload"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">reload</span>(<span class="sig-arg">grb</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>Recreate gribmessage object, updating all the keys to be consistent 
+  with each other.  For example, if the forecastTime key is changed, 
+  recreating the gribmessage object with this function will cause the 
+  analDate and verifDate keys to be updated accordingly.</p>
+  <p>Equivalent to fromstring(grb.tostring())</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="setdates"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">setdates</span>(<span class="sig-arg">grb</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>set fcstimeunits, analDate and validDate attributes using julianDay, 
+  forecastTime and indicatorOfUnitOfTimeRange. Called automatically when 
+  gribmessage instance created, but can be called manually to update keys 
+  if one of them is modified after instance creation.</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<br />
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Home   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1 on Fri Feb  7 15:35:47 2014
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/docs/module-tree.html b/docs/module-tree.html
new file mode 100644
index 0000000..912cca2
--- /dev/null
+++ b/docs/module-tree.html
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>Module Hierarchy</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="pygrib-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Trees   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%"> </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<center><b>
+ [ <a href="module-tree.html">Module Hierarchy</a>
+ | <a href="class-tree.html">Class Hierarchy</a> ]
+</b></center><br />
+<h1 class="epydoc">Module Hierarchy</h1>
+<ul class="nomargin-top">
+    <li> <strong class="uidlink"><a href="pygrib-module.html">pygrib</a></strong>: <em class="summary">Python module for reading and writing GRIB (editions 1 and 2) 
+        files.</em>    </li>
+</ul>
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="pygrib-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Trees   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1 on Fri Feb  7 15:35:47 2014
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/docs/pygrib-module.html b/docs/pygrib-module.html
new file mode 100644
index 0000000..3bbe171
--- /dev/null
+++ b/docs/pygrib-module.html
@@ -0,0 +1,738 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>pygrib</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Home   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%">
+      <span class="breadcrumbs">
+        Module pygrib
+      </span>
+    </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<!-- ==================== MODULE DESCRIPTION ==================== -->
+<h1 class="epydoc">Module pygrib</h1><p class="nomargin-top"></p>
+<h1 class="heading">Introduction</h1>
+    <p>Python module for reading and writing GRIB (editions 1 and 2) files.
+    GRIB is the World Meterological Organization <a 
+    href="http://www.wmo.ch/pages/prog/www/WMOCodes/GRIB.html" 
+    target="_top">standard</a> for distributing gridded data. The module is
+    a python interface to the <a 
+    href="https://software.ecmwf.int/wiki/display/GRIB/Home" 
+    target="_top">GRIB API</a> C library from the European Centre for 
+    Medium-Range Weather Forecasts (<a href="http://www.ecmwf.int" 
+    target="_top">ECMWF</a>).</p>
+  <h1 class="heading">Required</h1>
+    <ul>
+      <li>
+        <a href="http://python.org" target="_top">Python</a> 2.4 or higher.
+      </li>
+      <li>
+        <a 
+        href="http://sourceforge.net/project/showfiles.php?group_id=1369" 
+        target="_top">numpy</a> N-dimensional array object for python. 
+        Version 1.2.1 or higher (version 1.5.1 required for Python 3).
+      </li>
+      <li>
+        <a href="http://code.google.com/p/pyproj/" target="_top">pyproj</a>
+        Python interface to <a href="http://trac.osgeo.org/proj" 
+        target="_top">PROJ.4</a> library for cartographic transformations 
+        <b>or</b> <a href="http://matplotlib.sf.net" 
+        target="_top">matplotlib</a> and the <a 
+        href="http://matplotlib.sf.net/basemap/doc/html" 
+        target="_top">basemap</a> toolkit. Pyproj 1.8.9 is required for 
+        Python 3.
+      </li>
+      <li>
+        <a href="https://software.ecmwf.int/wiki/display/GRIB/Home" 
+        target="_top">GRIB API</a> C library for encoding and decoding GRIB
+        messages (edition 1 and edition 2). Version 1.8.0 or higher 
+        required. To be fully functional, the GRIB API library requires <a 
+        href="http://www.ece.uvic.ca/~mdadams/jasper" 
+        target="_top">Jasper</a> or <a href="http://www.openjpeg.org" 
+        target="_top">OpenJPEG</a> for JPEG200 encoding, and <a 
+        href="http://www.libpng.org/pub/png/libpng.html" 
+        target="_top">PNG</a> for PNG encoding.
+      </li>
+    </ul>
+    <p>These dependencies are available via the package management system 
+    of most Linux distributions, and on MacOS X using <a 
+    href="http://macports.org/" target="_top">macports</a>. If you build 
+    grib_api yourself as a static library on a 64-bit system you may need 
+    to set <code>CFLAGS</code> to <code>'-O2 -fPIC'</code> before running 
+    the <code>configure</code> script.  To use pygrib on Windows, you must 
+    use the <a href="http://cygwin.com" target="_top">Cygwin</a> 
+    environment, since the grib_api library requires a posix environment.  
+    Cygwin installation instructions are available <a 
+    href="http://code.google.com/p/pygrib/wiki/CygwinWindowsInstall" 
+    target="_top">here</a>.</p>
+  <h1 class="heading">Installation</h1>
+    <ul>
+      <li>
+        <a href="http://code.google.com/p/pygrib/downloads/list" 
+        target="_top">Download</a> the source code.
+      </li>
+      <li>
+        pygrib installation options can either be set with environment 
+        variables, or specified in a text file (setup.cfg).  To use 
+        environment variables, set <code>$GRIBAPI_DIR</code>, 
+        <code>$JASPER_DIR</code>, <code>$OPENJPEG_DIR</code>, 
+        <code>$PNG_DIR</code> and <code>$ZLIB_DIR</code> so that the 
+        include files and libraries for GRIB API, Jasper, OpenJPEG, PNG and
+        zlib will be found. For example, the include files for jasper 
+        should be found in <code>$JASPER_DIR/include</code> or 
+        <code>$JASPER_DIR/include/jasper</code>, and the jasper library 
+        should be found in <code>$JASPER_DIR/lib</code> or 
+        <code>$JASPER_DIR/lib64</code>. If any of those environment 
+        variables are not set, then it is assumed that GRIB API was not 
+        built with support for that library. If the libraries and include 
+        files are installed in separate locations, the environment 
+        variables <code>$GRIBAPI_INCDIR</code> and 
+        <code>$GRIBAPI_LIBDIR</code> can be used to define the locations 
+        separately (same goes for <code>JASPER</code>, 
+        <code>OPENJPEG</code>, <code>PNG</code> and <code>ZLIB</code>). 
+        Note that if both <code>$GRIBAPI_DIR</code> and 
+        <code>$GRIBAPI_INCDIR</code>/<code>$GRIBAPI_LIBDIR</code> are 
+        specified, <code>$GRIBAPI_DIR</code> takes precedence. To use 
+        setup.cfg, copy setup.cfg.template to setup.cfg, open setup.cfg in 
+        a text editor and follow the instructions in the comments for 
+        editing.
+      </li>
+      <li>
+        Run 'python setup.py build' and then 'python setup.py install', as 
+        root if necessary. Note that if you are using environment variables
+        to specify the build options, you cannot build and install in one 
+        step with 'sudo python setup.py install', since sudo does not pass 
+        environment variables.  Instead, run 'python setup.py build' first 
+        as a regular user, then run 'sudo python setup.py install' if the 
+        install directory requires admin or root privileges.
+      </li>
+      <li>
+        Run 'python test.py' to test your installation.
+      </li>
+      <li>
+        Look at examples in <code>test</code> directory (most require <a 
+        href="http://matplotlib.sf.net" target="_top">matplotlib</a> and <a
+        href="http://matplotlib.sourceforge.net/basemap/doc/html/" 
+        target="_top">basemap</a>).
+      </li>
+      <li>
+        If you're on MacOS X, see <a 
+        href="http://pygrib.googlecode.com/svn/trunk/README.macosx" 
+        target="_top">README.macosx</a> for special instruction on how to 
+        install pygrib and all it's dependencies using <a 
+        href="http://macports.org" target="_top">macports</a>.
+      </li>
+    </ul>
+  <h1 class="heading">Example usage</h1>
+    <ul>
+      <li>
+        from the python interpreter prompt, import the package:
+<pre class="literalblock">
+  >>> import pygrib
+</pre>
+      </li>
+      <li>
+        open a GRIB file, create a grib message iterator:
+<pre class="literalblock">
+  >>> grbs = pygrib.open('sampledata/flux.grb')  
+</pre>
+      </li>
+      <li>
+        pygrib open instances behave like regular python file objects, with
+        <code>seek</code>, <code>tell</code>, <code>read</code>, 
+        <code>readline</code> and <code>close</code> methods, except that 
+        offsets are measured in grib messages instead of bytes:
+<pre class="literalblock">
+  >>> grbs.seek(2)
+  >>> grbs.tell()
+  2
+  >>> grb = grbs.read(1)[0] # read returns a list with the next N (N=1 in this case) messages.
+  >>> grb # printing a grib message object displays summary info
+  3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+  >>> grbs.tell()
+  3
+</pre>
+      </li>
+      <li>
+        print an inventory of the file:
+<pre class="literalblock">
+  >>> grbs.seek(0)
+  >>> for grb in grbs:
+  >>>     grb 
+  1:Precipitation rate:kg m**-2 s**-1 (avg):regular_gg:surface:level 0:fcst time 108-120 hrs (avg):from 200402291200
+  2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200
+  3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+  4:Minimum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+</pre>
+      </li>
+      <li>
+        find the first grib message with a matching name:
+<pre class="literalblock">
+  >>> grb = grbs.select(name='Maximum temperature')[0]
+</pre>
+      </li>
+      <li>
+        extract the data values using the 'values' key (grb.keys() will 
+        return a list of the available keys):
+<pre class="literalblock">
+  # The data is returned as a numpy array, or if missing values or a bitmap
+  # are present, a numpy masked array.  Reduced lat/lon or gaussian grid
+  # data is automatically expanded to a regular grid. Details of the internal
+  # representation of the grib data (such as the scanning mode) are handled
+  # automatically.
+  >>> maxt = grb.values # same as grb['values']
+  >>> maxt.shape, maxt.min(), maxt.max()
+  (94, 192) 223.7 319.9
+</pre>
+      </li>
+      <li>
+        get the latitudes and longitudes of the grid:
+<pre class="literalblock">
+  >>> lats, lons = grb.latlons()
+  >>> lats.shape, lats.min(), lats.max(), lons.shape, lons.min(), lons.max()
+  (94, 192) -88.5419501373 88.5419501373  0.0 358.125
+</pre>
+      </li>
+      <li>
+        get the second grib message:
+<pre class="literalblock">
+  >>> grb = grbs.message(2) # same as grbs.seek(1); grb=grbs.readline()
+  >>> grb
+  2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200
+</pre>
+      </li>
+      <li>
+        extract data and get lat/lon values for a subset over North 
+        America:
+<pre class="literalblock">
+  >>> data, lats, lons = grb.data(lat1=20,lat2=70,lon1=220,lon2=320)
+  >>> data.shape, lats.min(), lats.max(), lons.min(), lons.max()
+  (26, 53) 21.904439458 69.5216630593 221.25 318.75
+</pre>
+      </li>
+      <li>
+        modify the values associated with existing keys (either via 
+        attribute or dictionary access):
+<pre class="literalblock">
+  >>> grb['forecastTime'] = 240
+  >>> grb.dataDate = 20100101
+</pre>
+      </li>
+      <li>
+        get the binary string associated with the coded message:
+<pre class="literalblock">
+  >>> msg = grb.tostring()
+  >>> grbs.close() # close the grib file.
+</pre>
+      </li>
+      <li>
+        write the modified message to a new GRIB file:
+<pre class="literalblock">
+  >>> grbout = open('test.grb','wb')
+  >>> grbout.write(msg)
+  >>> grbout.close()
+  >>> pygrib.open('test.grb').readline() 
+  1:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 240 hrs:from 201001011200
+</pre>
+      </li>
+    </ul>
+  <h1 class="heading">Documentation</h1>
+    <ul>
+      <li>
+        see below for the full python API documentation.
+      </li>
+    </ul>
+  <h1 class="heading">Changelog</h1>
+    <ul>
+      <li>
+        see <a href="http://pygrib.googlecode.com/svn/trunk/Changelog" 
+        target="_top">Changelog</a> file.
+      </li>
+    </ul>
+
+<hr />
+<div class="fields">      <p><strong>Author:</strong>
+        Jeffrey Whitaker.
+      </p>
+      <p><strong>Contact:</strong>
+        <a href="mailto:jeffrey.s.whitaker at noaa.gov" target="_top">Jeff 
+        Whitaker</a>
+      </p>
+      <p><strong>Version:</strong>
+        1.9.9
+      </p>
+      <p><strong>Copyright:</strong>
+        copyright 2010 by Jeffrey Whitaker.
+      </p>
+      <p><strong>License:</strong>
+        Permission to use, copy, modify, and distribute this software and 
+        its documentation for any purpose and without fee is hereby 
+        granted, provided that the above copyright notice appear in all 
+        copies and that both that copyright notice and this permission 
+        notice appear in supporting documentation. THE AUTHOR DISCLAIMS ALL
+        WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED 
+        WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 
+        AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
+        OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 
+        PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 
+        TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 
+        PERFORMANCE OF THIS SOFTWARE.
+      </p>
+</div><!-- ==================== CLASSES ==================== -->
+<a name="section-Classes"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Classes</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="pygrib.gribmessage-class.html" class="summary-name">gribmessage</a><br />
+      Grib message object.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="pygrib.index-class.html" class="summary-name">index</a><br />
+      index(filename, *args)
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="pygrib.open-class.html" class="summary-name">open</a><br />
+      open(filename)
+    </td>
+  </tr>
+</table>
+<!-- ==================== FUNCTIONS ==================== -->
+<a name="section-Functions"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Functions</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="datetime_to_julian"></a><span class="summary-sig-name">datetime_to_julian</span>(<span class="summary-sig-arg">date</span>)</span><br />
+      convert python datetime instance to Julian day number.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="fromstring"></a><span class="summary-sig-name">fromstring</span>(<span class="summary-sig-arg">string</span>)</span><br />
+      Create a gribmessage instance from a python bytes object representing
+      a binary grib message (the reverse of <a 
+      href="pygrib.gribmessage-class.html#tostring" 
+      class="link">gribmessage.tostring</a>).</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib-module.html#gaulats" class="summary-sig-name">gaulats</a>(<span class="summary-sig-arg">nlats</span>)</span><br />
+      Returns nlats gaussian latitudes, in degrees, oriented from north to 
+      south.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib-module.html#julian_to_datetime" class="summary-sig-name">julian_to_datetime</a>(<span class="summary-sig-arg">julday</span>)</span><br />
+      convert Julian day number to python datetime instance.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="multi_support_off"></a><span class="summary-sig-name">multi_support_off</span>(<span class="summary-sig-arg">...</span>)</span><br />
+      turn off support for multi-field grib messages</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="multi_support_on"></a><span class="summary-sig-name">multi_support_on</span>(<span class="summary-sig-arg">...</span>)</span><br />
+      turn on support for multi-field grib messages (default)</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib-module.html#reload" class="summary-sig-name">reload</a>(<span class="summary-sig-arg">grb</span>)</span><br />
+      Recreate gribmessage object, updating all the keys to be consistent 
+      with each other.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib-module.html#setdates" class="summary-sig-name">setdates</a>(<span class="summary-sig-arg">grb</span>)</span><br />
+      set fcstimeunits, analDate and validDate attributes using julianDay, 
+      forecastTime and indicatorOfUnitOfTimeRange.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="tolerate_badgrib_off"></a><span class="summary-sig-name">tolerate_badgrib_off</span>(<span class="summary-sig-arg">...</span>)</span><br />
+      raise an exception when a missing or malformed key is encountered 
+      (default behavior).</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="tolerate_badgrib_on"></a><span class="summary-sig-name">tolerate_badgrib_on</span>(<span class="summary-sig-arg">...</span>)</span><br />
+      don't raise an exception when a missing or malformed key is 
+      encountered.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+</table>
+<!-- ==================== VARIABLES ==================== -->
+<a name="section-Variables"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Variables</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="None">None</code>
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="__version__"></a><span class="summary-name">__version__</span> = <code title="'1.9.9'"><code class="variable-quote">'</code><code class="variable-string">1.9.9</code><code class="variable-quote">'</code></code>
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="default_encoding"></a><span class="summary-name">default_encoding</span> = <code title="'ascii'"><code class="variable-quote">'</code><code class="variable-string">ascii</code><code class="variable-quote">'</code></code>
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="grib_api_version"></a><span class="summary-name">grib_api_version</span> = <code title="'1.11.0'"><code class="variable-quote">'</code><code class="variable-string">1.11.0</code><code class="variable-quote">'</code></code>
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="missingvalue_float"></a><span class="summary-name">missingvalue_float</span> = <code title="-1e+100">-1e+100</code>
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="missingvalue_int"></a><span class="summary-name">missingvalue_int</span> = <code title="4294967295">4294967295</code>
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="tolerate_badgrib"></a><span class="summary-name">tolerate_badgrib</span> = <code title="False">False</code>
+    </td>
+  </tr>
+</table>
+<!-- ==================== FUNCTION DETAILS ==================== -->
+<a name="section-FunctionDetails"></a>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Function Details</span></td>
+</tr>
+</table>
+<a name="gaulats"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">gaulats</span>(<span class="sig-arg">nlats</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>Returns nlats gaussian latitudes, in degrees, oriented from north to 
+  south.  nlats must be even.</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="julian_to_datetime"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">julian_to_datetime</span>(<span class="sig-arg">julday</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>convert Julian day number to python datetime instance.</p>
+  <p>Used to create validDate and analDate attributes from julianDay and 
+  forecastTime keys.</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="reload"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">reload</span>(<span class="sig-arg">grb</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>Recreate gribmessage object, updating all the keys to be consistent 
+  with each other.  For example, if the forecastTime key is changed, 
+  recreating the gribmessage object with this function will cause the 
+  analDate and verifDate keys to be updated accordingly.</p>
+  <p>Equivalent to fromstring(grb.tostring())</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="setdates"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">setdates</span>(<span class="sig-arg">grb</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>set fcstimeunits, analDate and validDate attributes using julianDay, 
+  forecastTime and indicatorOfUnitOfTimeRange. Called automatically when 
+  gribmessage instance created, but can be called manually to update keys 
+  if one of them is modified after instance creation.</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<br />
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Home   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1 on Fri Feb  7 15:35:47 2014
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/docs/pygrib.gribmessage-class.html b/docs/pygrib.gribmessage-class.html
new file mode 100644
index 0000000..f35d294
--- /dev/null
+++ b/docs/pygrib.gribmessage-class.html
@@ -0,0 +1,819 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>pygrib.gribmessage</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="pygrib-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%">
+      <span class="breadcrumbs">
+        <a href="pygrib-module.html">Module pygrib</a> ::
+        Class gribmessage
+      </span>
+    </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<!-- ==================== CLASS DESCRIPTION ==================== -->
+<h1 class="epydoc">Class gribmessage</h1><p class="nomargin-top"></p>
+<pre class="base-tree">
+object --+
+         |
+        <strong class="uidshort">gribmessage</strong>
+</pre>
+
+<hr />
+<p>Grib message object.</p>
+  <p>Each grib message has attributes corresponding to grib message keys 
+  for <a 
+  href="http://www.ecmwf.int/publications/manuals/d/gribapi/fm92/grib1" 
+  target="_top">GRIB1</a> and <a 
+  href="http://www.ecmwf.int/publications/manuals/d/gribapi/fm92/grib2/" 
+  target="_top">GRIB2</a>. Parameter names are are given by the 
+  <code>name</code>, <code>shortName</code> and <code>paramID</code> <a 
+  href="http://www.ecmwf.int/publications/manuals/d/gribapi/param/" 
+  target="_top">keys</a>. pygrib also defines some special attributes which
+  are defined below under the heading <b>Instance Variables</b>.</p>
+
+<!-- ==================== INSTANCE METHODS ==================== -->
+<a name="section-InstanceMethods"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Instance Methods</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.gribmessage-class.html#__delattr__" class="summary-sig-name">__delattr__</a>(<span class="summary-sig-arg">...</span>)</span><br />
+      x.__delattr__('name') <==> del x.name</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="__delitem__"></a><span class="summary-sig-name">__delitem__</span>(<span class="summary-sig-arg">x</span>,
+        <span class="summary-sig-arg">y</span>)</span><br />
+      del x[y]</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="__getattr__"></a><span class="summary-sig-name">__getattr__</span>(<span class="summary-sig-arg">...</span>)</span></td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.gribmessage-class.html#__getattribute__" class="summary-sig-name">__getattribute__</a>(<span class="summary-sig-arg">...</span>)</span><br />
+      x.__getattribute__('name') <==> x.name</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.gribmessage-class.html#__getitem__" class="summary-sig-name">__getitem__</a>(<span class="summary-sig-arg">...</span>)</span><br />
+      access values associated with grib keys.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.gribmessage-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">...</span>)</span><br />
+      x.__init__(...) initializes x; see help(type(x)) for signature</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type">a new object with type S, a subtype of T</span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.gribmessage-class.html#__new__" class="summary-sig-name">__new__</a>(<span class="summary-sig-arg">T</span>,
+        <span class="summary-sig-arg">S</span>,
+        <span class="summary-sig-arg">...</span>)</span></td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.gribmessage-class.html#__repr__" class="summary-sig-name">__repr__</a>(<span class="summary-sig-arg">...</span>)</span><br />
+      prints a short inventory of the grib message</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.gribmessage-class.html#__setattr__" class="summary-sig-name">__setattr__</a>(<span class="summary-sig-arg">...</span>)</span><br />
+      x.__setattr__('name', value) <==> x.name = value</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="__setitem__"></a><span class="summary-sig-name">__setitem__</span>(<span class="summary-sig-arg">...</span>)</span><br />
+      change values associated with existing grib keys.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.gribmessage-class.html#data" class="summary-sig-name">data</a>(<span class="summary-sig-arg">lat1</span>=<span class="summary-sig-default">None</span>,
+        <span class="summary-sig-arg">lat2</span>=<span class="summary-sig-default">None</span>,
+        <span class="summary-sig-arg">lon1</span>=<span class="summary-sig-default">None</span>,
+        <span class="summary-sig-arg">lon2</span>=<span class="summary-sig-default">None</span>)</span><br />
+      extract data, lats and lons for a subset region defined by the 
+      keywords lat1,lat2,lon1,lon2.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="expand_grid"></a><span class="summary-sig-name">expand_grid</span>(<span class="summary-sig-arg">...</span>)</span><br />
+      toggle expansion of 1D reduced grid data to a regular (2D) grid</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="has_key"></a><span class="summary-sig-name">has_key</span>(<span class="summary-sig-arg">key</span>)</span><br />
+      tests whether a grib message object has a specified key.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="is_missing"></a><span class="summary-sig-name">is_missing</span>(<span class="summary-sig-arg">key</span>)</span><br />
+      returns True if value associated with key is equal to grib missing 
+      value flag (False otherwise)</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="keys"></a><span class="summary-sig-name">keys</span>()</span><br />
+      return keys associated with a grib message (a dictionary-like object)</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.gribmessage-class.html#latlons" class="summary-sig-name">latlons</a>()</span><br />
+      compute lats and lons (in degrees) of grid.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="tostring"></a><span class="summary-sig-name">tostring</span>()</span><br />
+      return coded grib message in a binary string.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="valid_key"></a><span class="summary-sig-name">valid_key</span>(<span class="summary-sig-arg">key</span>)</span><br />
+      tests whether a grib message object has a specified key, it is not 
+      missing and it has a value that can be read.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+  <tr>
+    <td colspan="2" class="summary">
+    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
+      <code>__format__</code>,
+      <code>__hash__</code>,
+      <code>__reduce__</code>,
+      <code>__reduce_ex__</code>,
+      <code>__sizeof__</code>,
+      <code>__str__</code>,
+      <code>__subclasshook__</code>
+      </p>
+    </td>
+  </tr>
+</table>
+<!-- ==================== INSTANCE VARIABLES ==================== -->
+<a name="section-InstanceVariables"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Instance Variables</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="pygrib.gribmessage-class.html#analDate" class="summary-name">analDate</a><br />
+      A python datetime instance describing the analysis date and time for 
+      the forecast.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="pygrib.gribmessage-class.html#expand_reduced" class="summary-name">expand_reduced</a><br />
+      If True (default), reduced lat/lon and gaussian grids will be 
+      expanded to regular grids when data is accessed via 
+      "values" key.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="fcstimeunits"></a><span class="summary-name">fcstimeunits</span><br />
+      A string representing the forecast time units (an empty string if not
+      defined).
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="messagenumber"></a><span class="summary-name">messagenumber</span><br />
+      The grib message number in the file.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="pygrib.gribmessage-class.html#projparams" class="summary-name">projparams</a><br />
+      A dictionary containing proj4 key/value pairs describing the grid.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="pygrib.gribmessage-class.html#validDate" class="summary-name">validDate</a><br />
+      A python datetime instance describing the valid date and time for the
+      forecast.
+    </td>
+  </tr>
+</table>
+<!-- ==================== PROPERTIES ==================== -->
+<a name="section-Properties"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Properties</span></td>
+</tr>
+  <tr>
+    <td colspan="2" class="summary">
+    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
+      <code>__class__</code>
+      </p>
+    </td>
+  </tr>
+</table>
+<!-- ==================== METHOD DETAILS ==================== -->
+<a name="section-MethodDetails"></a>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Method Details</span></td>
+</tr>
+</table>
+<a name="__delattr__"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">__delattr__</span>(<span class="sig-arg">...</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>x.__delattr__('name') <==> del x.name</p>
+  <dl class="fields">
+    <dt>Overrides:
+        object.__delattr__
+    </dt>
+  </dl>
+</td></tr></table>
+</div>
+<a name="__getattribute__"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">__getattribute__</span>(<span class="sig-arg">...</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>x.__getattribute__('name') <==> x.name</p>
+  <dl class="fields">
+    <dt>Overrides:
+        object.__getattribute__
+    </dt>
+  </dl>
+</td></tr></table>
+</div>
+<a name="__getitem__"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">__getitem__</span>(<span class="sig-arg">...</span>)</span>
+    <br /><em class="fname">(Indexing operator)</em>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>access values associated with grib keys.</p>
+  <p>The key "values" will return the data associated with the 
+  grib message. The data is returned as a numpy array, or if missing values
+  or a bitmap are present, a numpy masked array.  Reduced lat/lon or 
+  gaussian grid data is automatically expanded to a regular grid using 
+  linear interpolation (nearest neighbor if an adjacent grid point is a 
+  missing value).</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="__init__"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">...</span>)</span>
+    <br /><em class="fname">(Constructor)</em>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>x.__init__(...) initializes x; see help(type(x)) for signature</p>
+  <dl class="fields">
+    <dt>Overrides:
+        object.__init__
+    </dt>
+  </dl>
+</td></tr></table>
+</div>
+<a name="__new__"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">__new__</span>(<span class="sig-arg">T</span>,
+        <span class="sig-arg">S</span>,
+        <span class="sig-arg">...</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  
+  <dl class="fields">
+    <dt>Returns: a new object with type S, a subtype of T</dt>
+    <dt>Overrides:
+        object.__new__
+    </dt>
+  </dl>
+</td></tr></table>
+</div>
+<a name="__repr__"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">__repr__</span>(<span class="sig-arg">...</span>)</span>
+    <br /><em class="fname">(Representation operator)</em>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>prints a short inventory of the grib message</p>
+  <dl class="fields">
+    <dt>Overrides:
+        object.__repr__
+    </dt>
+  </dl>
+</td></tr></table>
+</div>
+<a name="__setattr__"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">__setattr__</span>(<span class="sig-arg">...</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>x.__setattr__('name', value) <==> x.name = value</p>
+  <dl class="fields">
+    <dt>Overrides:
+        object.__setattr__
+    </dt>
+  </dl>
+</td></tr></table>
+</div>
+<a name="data"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">data</span>(<span class="sig-arg">lat1</span>=<span class="sig-default">None</span>,
+        <span class="sig-arg">lat2</span>=<span class="sig-default">None</span>,
+        <span class="sig-arg">lon1</span>=<span class="sig-default">None</span>,
+        <span class="sig-arg">lon2</span>=<span class="sig-default">None</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>extract data, lats and lons for a subset region defined by the 
+  keywords lat1,lat2,lon1,lon2.</p>
+  <p>The default values of lat1,lat2,lon1,lon2 are None, which means the 
+  entire grid is returned.</p>
+  <p>If the grid type is unprojected lat/lon and a geographic subset is 
+  requested (by using the lat1,lat2,lon1,lon2 keywords), then 2-d arrays 
+  are returned, otherwise 1-d arrays are returned.</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="latlons"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">latlons</span>()</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>compute lats and lons (in degrees) of grid. Currently handles reg. 
+  lat/lon, global gaussian, mercator, stereographic, lambert conformal, 
+  albers equal-area, space-view, azimuthal equidistant, reduced gaussian, 
+  reduced lat/lon, lambert azimuthal equal-area, rotated lat/lon and 
+  rotated gaussian grids.</p>
+  <dl class="fields">
+    <dt>Returns:</dt>
+        <dd><code><b>lats</b>,<b>lons</b></code>, numpy arrays containing 
+          latitudes and longitudes of grid (in degrees).</dd>
+  </dl>
+</td></tr></table>
+</div>
+<br />
+<!-- ==================== INSTANCE VARIABLE DETAILS ==================== -->
+<a name="section-InstanceVariableDetails"></a>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Instance Variable Details</span></td>
+</tr>
+</table>
+<a name="analDate"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <h3 class="epydoc">analDate</h3>
+  A python datetime instance describing the analysis date and time for the 
+  forecast. Only set if forecastTime and julianDay keys exist.
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="expand_reduced"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <h3 class="epydoc">expand_reduced</h3>
+  If True (default), reduced lat/lon and gaussian grids will be expanded to
+  regular grids when data is accessed via "values" key. If False,
+  data is kept on unstructured reduced grid, and is returned in a 1-d 
+  array.
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="projparams"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <h3 class="epydoc">projparams</h3>
+  A dictionary containing proj4 key/value pairs describing the grid.  Set 
+  to <code>None</code> for unsupported grid types.
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="validDate"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <h3 class="epydoc">validDate</h3>
+  A python datetime instance describing the valid date and time for the 
+  forecast. Only set if forecastTime and julianDay keys exist, and 
+  fcstimeunits is defined. If forecast time is a range, then 
+  <code>validDate</code> corresponds to the end of the range.
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<br />
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="pygrib-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1 on Fri Feb  7 15:35:47 2014
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/docs/pygrib.index-class.html b/docs/pygrib.index-class.html
new file mode 100644
index 0000000..23e9bd2
--- /dev/null
+++ b/docs/pygrib.index-class.html
@@ -0,0 +1,455 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>pygrib.index</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="pygrib-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%">
+      <span class="breadcrumbs">
+        <a href="pygrib-module.html">Module pygrib</a> ::
+        Class index
+      </span>
+    </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<!-- ==================== CLASS DESCRIPTION ==================== -->
+<h1 class="epydoc">Class index</h1><p class="nomargin-top"></p>
+<pre class="base-tree">
+object --+
+         |
+        <strong class="uidshort">index</strong>
+</pre>
+
+<hr />
+<p>index(filename, *args)</p>
+  <p>returns grib index object given GRIB filename indexed by keys given in
+  *args.  The <a href="pygrib.index-class.html#select" 
+  class="link">select</a> or <a href="pygrib.index-class.html#__call__" 
+  class="link">__call__</a> method can then be used to selected grib 
+  messages based on specified values of indexed keys. Unlike <a 
+  href="pygrib.open-class.html#select" class="link">open.select</a>, 
+  containers or callables cannot be used to select multiple key values. 
+  However, using <a href="pygrib.index-class.html#select" 
+  class="link">index.select</a> is much faster than <a 
+  href="pygrib.open-class.html#select" class="link">open.select</a>.</p>
+  <p><b>Warning</b>:  Searching for data within multi-field grib messages 
+  does not work using an index (and is not supported by the <a 
+  href="https://software.ecmwf.int/wiki/display/GRIB/Home" 
+  target="_top">GRIB API</a> library).  NCEP often puts u and v winds 
+  together in a single multi-field grib message.  You will get incorrect 
+  results if you try to use an index to find data in these messages.  Use 
+  the slower, but more robust <a href="pygrib.open-class.html#select" 
+  class="link">open.select</a> in this case.</p>
+  <p>If no key are given (i.e. *args is empty), it is assumed the filename 
+  represents a previously saved index (created using the 
+  <code>grib_index_build</code> tool or <a 
+  href="pygrib.index-class.html#write" class="link">index.write</a>) 
+  instead of a GRIB file.</p>
+  <p>Example usage:</p>
+<pre class="py-doctest">
+<span class="py-prompt">>>> </span><span class="py-keyword">import</span> pygrib
+<span class="py-prompt">>>> </span>grbindx=pygrib.index(<span class="py-string">'sampledata/gfs.grb'</span>,<span class="py-string">'shortName'</span>,<span class="py-string">'typeOfLevel'</span>,<span class="py-string">'level'</span>)
+<span class="py-prompt">>>> </span>selected_grbs=grbindx.select(shortName=<span class="py-string">'gh'</span>,typeOfLevel=<span class="py-string">'isobaricInhPa'</span>,level=500)
+<span class="py-prompt">>>> </span><span class="py-keyword">for</span> grb <span class="py-keyword">in</span> selected_grbs:
+<span class="py-prompt">>>> </span>    grb
+<span class="py-output">1:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 500 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span>
+<span class="py-output"></span><span class="py-prompt">>>> </span><span class="py-comment"># __call__ method does same thing as select</span>
+<span class="py-prompt">>>> </span>selected_grbs=grbindx(shortName=<span class="py-string">'u'</span>,typeOfLevel=<span class="py-string">'isobaricInhPa'</span>,level=250)
+<span class="py-prompt">>>> </span><span class="py-keyword">for</span> grb <span class="py-keyword">in</span> selected_grbs:
+<span class="py-prompt">>>> </span>    grb
+<span class="py-output">1:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 250 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span>
+<span class="py-output"></span><span class="py-prompt">>>> </span>grbindx.write(<span class="py-string">'gfs.grb.idx'</span>) <span class="py-comment"># save index to a file</span>
+<span class="py-prompt">>>> </span>grbindx.close()
+<span class="py-prompt">>>> </span>grbindx = pygrib.index(<span class="py-string">'gfs.grb.idx'</span>) <span class="py-comment"># re-open index (no keys specified)</span>
+<span class="py-prompt">>>> </span><span class="py-keyword">for</span> grb <span class="py-keyword">in</span> selected_grbs:
+<span class="py-prompt">>>> </span>    grb
+<span class="py-output">1:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 250 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span></pre>
+
+<!-- ==================== INSTANCE METHODS ==================== -->
+<a name="section-InstanceMethods"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Instance Methods</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="__call__"></a><span class="summary-sig-name">__call__</span>(<span class="summary-sig-arg">...</span>)</span><br />
+      same as <a href="pygrib.index-class.html#select" 
+      class="link">select</a></td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.index-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">filename</span>,
+        <span class="summary-sig-arg">*args</span>)</span><br />
+      x.__init__(...) initializes x; see help(type(x)) for signature</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type">a new object with type S, a subtype of T</span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.index-class.html#__new__" class="summary-sig-name">__new__</a>(<span class="summary-sig-arg">T</span>,
+        <span class="summary-sig-arg">S</span>,
+        <span class="summary-sig-arg">...</span>)</span></td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="close"></a><span class="summary-sig-name">close</span>()</span><br />
+      deallocate C structures associated with class instance</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.index-class.html#select" class="summary-sig-name">select</a>(<span class="summary-sig-arg">**kwargs</span>)</span><br />
+      return a list of <a href="pygrib.gribmessage-class.html" 
+      class="link">gribmessage</a> instances from grib index object 
+      corresponding to specific values of indexed keys (given by kwargs).</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="write"></a><span class="summary-sig-name">write</span>(<span class="summary-sig-arg">filename</span>)</span><br />
+      save grib index to file</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+  <tr>
+    <td colspan="2" class="summary">
+    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
+      <code>__delattr__</code>,
+      <code>__format__</code>,
+      <code>__getattribute__</code>,
+      <code>__hash__</code>,
+      <code>__reduce__</code>,
+      <code>__reduce_ex__</code>,
+      <code>__repr__</code>,
+      <code>__setattr__</code>,
+      <code>__sizeof__</code>,
+      <code>__str__</code>,
+      <code>__subclasshook__</code>
+      </p>
+    </td>
+  </tr>
+</table>
+<!-- ==================== INSTANCE VARIABLES ==================== -->
+<a name="section-InstanceVariables"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Instance Variables</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="keys"></a><span class="summary-name">keys</span><br />
+      list of strings containing keys used in the index.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="pygrib.index-class.html#types" class="summary-name">types</a><br />
+      if keys are typed, this list contains the type declarations 
+      (<code>l</code>, <code>s</code> or <code>d</code>).
+    </td>
+  </tr>
+</table>
+<!-- ==================== PROPERTIES ==================== -->
+<a name="section-Properties"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Properties</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="name"></a><span class="summary-name">name</span>
+    </td>
+  </tr>
+  <tr>
+    <td colspan="2" class="summary">
+    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
+      <code>__class__</code>
+      </p>
+    </td>
+  </tr>
+</table>
+<!-- ==================== METHOD DETAILS ==================== -->
+<a name="section-MethodDetails"></a>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Method Details</span></td>
+</tr>
+</table>
+<a name="__init__"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">filename</span>,
+        <span class="sig-arg">*args</span>)</span>
+    <br /><em class="fname">(Constructor)</em>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>x.__init__(...) initializes x; see help(type(x)) for signature</p>
+  <dl class="fields">
+    <dt>Overrides:
+        object.__init__
+    </dt>
+  </dl>
+</td></tr></table>
+</div>
+<a name="__new__"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">__new__</span>(<span class="sig-arg">T</span>,
+        <span class="sig-arg">S</span>,
+        <span class="sig-arg">...</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  
+  <dl class="fields">
+    <dt>Returns: a new object with type S, a subtype of T</dt>
+    <dt>Overrides:
+        object.__new__
+    </dt>
+  </dl>
+</td></tr></table>
+</div>
+<a name="select"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">select</span>(<span class="sig-arg">**kwargs</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>return a list of <a href="pygrib.gribmessage-class.html" 
+  class="link">gribmessage</a> instances from grib index object 
+  corresponding to specific values of indexed keys (given by kwargs). 
+  Unlike <a href="pygrib.open-class.html#select" 
+  class="link">open.select</a>, containers or callables cannot be used to 
+  select multiple key values. However, using <a 
+  href="pygrib.index-class.html#select" class="link">index.select</a> is 
+  much faster than <a href="pygrib.open-class.html#select" 
+  class="link">open.select</a>.</p>
+  <p>Example usage:</p>
+<pre class="py-doctest">
+<span class="py-prompt">>>> </span><span class="py-keyword">import</span> pygrib
+<span class="py-prompt">>>> </span>grbindx=pygrib.index(<span class="py-string">'sampledata/gfs.grb'</span>,<span class="py-string">'shortName'</span>,<span class="py-string">'typeOfLevel'</span>,<span class="py-string">'level'</span>)
+<span class="py-prompt">>>> </span>selected_grbs=grbindx.select(shortName=<span class="py-string">'gh'</span>,typeOfLevel=<span class="py-string">'isobaricInhPa'</span>,level=500)
+<span class="py-prompt">>>> </span><span class="py-keyword">for</span> grb <span class="py-keyword">in</span> selected_grbs:
+<span class="py-prompt">>>> </span>    grb
+<span class="py-output">1:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 500 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span>
+<span class="py-output"></span><span class="py-prompt">>>> </span><span class="py-comment"># __call__ method does same thing as select</span>
+<span class="py-prompt">>>> </span>selected_grbs=grbindx(shortName=<span class="py-string">'u'</span>,typeOfLevel=<span class="py-string">'isobaricInhPa'</span>,level=250)
+<span class="py-prompt">>>> </span><span class="py-keyword">for</span> grb <span class="py-keyword">in</span> selected_grbs:
+<span class="py-prompt">>>> </span>    grb
+<span class="py-output">1:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 250 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span>
+<span class="py-output"></span><span class="py-prompt">>>> </span>grbindx.close()</pre>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<br />
+<!-- ==================== INSTANCE VARIABLE DETAILS ==================== -->
+<a name="section-InstanceVariableDetails"></a>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Instance Variable Details</span></td>
+</tr>
+</table>
+<a name="types"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <h3 class="epydoc">types</h3>
+  if keys are typed, this list contains the type declarations 
+  (<code>l</code>, <code>s</code> or <code>d</code>). Type declarations are
+  specified by appending to the key name (i.e. <code>level:l</code> will 
+  search for values of <code>level</code> that are longs).
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<br />
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="pygrib-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1 on Fri Feb  7 15:35:47 2014
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/docs/pygrib.open-class.html b/docs/pygrib.open-class.html
new file mode 100644
index 0000000..6819963
--- /dev/null
+++ b/docs/pygrib.open-class.html
@@ -0,0 +1,689 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>pygrib.open</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="pygrib-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%">
+      <span class="breadcrumbs">
+        <a href="pygrib-module.html">Module pygrib</a> ::
+        Class open
+      </span>
+    </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<!-- ==================== CLASS DESCRIPTION ==================== -->
+<h1 class="epydoc">Class open</h1><p class="nomargin-top"></p>
+<pre class="base-tree">
+object --+
+         |
+        <strong class="uidshort">open</strong>
+</pre>
+
+<hr />
+<p>open(filename)</p>
+  <p>returns GRIB file iterator object given GRIB filename. When iterated, 
+  returns instances of the <a href="pygrib.gribmessage-class.html" 
+  class="link">gribmessage</a> class. Behaves much like a python file 
+  object, with <a href="pygrib.open-class.html#seek" class="link">seek</a>,
+  <a href="pygrib.open-class.html#tell" class="link">tell</a>, <a 
+  href="pygrib.open-class.html#read" class="link">read</a> and <a 
+  href="pygrib.open-class.html#close" class="link">close</a> methods, 
+  except that offsets are measured in grib messages instead of bytes. 
+  Additional methods include <a href="pygrib.open-class.html#rewind" 
+  class="link">rewind</a> (like <code>seek(0)</code>), <a 
+  href="pygrib.open-class.html#message" class="link">message</a> (like 
+  <code>seek(N-1)</code>; followed by <code>readline()</code>), and <a 
+  href="pygrib.open-class.html#select" class="link">select</a> (filters 
+  messages based on specified conditions).  The <code>__call__</code> 
+  method forwards to <a href="pygrib.open-class.html#select" 
+  class="link">select</a>, and instances can be sliced with 
+  <code>__getitem__</code> (returning lists of <a 
+  href="pygrib.gribmessage-class.html" class="link">gribmessage</a> 
+  instances).  The position of the iterator is not altered by slicing with 
+  <code>__getitem__</code>.</p>
+
+<!-- ==================== INSTANCE METHODS ==================== -->
+<a name="section-InstanceMethods"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Instance Methods</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="__call__"></a><span class="summary-sig-name">__call__</span>(<span class="summary-sig-arg">...</span>)</span><br />
+      same as <a href="pygrib.open-class.html#select" 
+      class="link">select</a></td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="__enter__"></a><span class="summary-sig-name">__enter__</span>(<span class="summary-sig-arg">...</span>)</span></td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="__exit__"></a><span class="summary-sig-name">__exit__</span>(<span class="summary-sig-arg">...</span>)</span></td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="__getitem__"></a><span class="summary-sig-name">__getitem__</span>(<span class="summary-sig-arg">x</span>,
+        <span class="summary-sig-arg">y</span>)</span><br />
+      x[y]</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.open-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">filename</span>)</span><br />
+      x.__init__(...) initializes x; see help(type(x)) for signature</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="__iter__"></a><span class="summary-sig-name">__iter__</span>(<span class="summary-sig-arg">x</span>)</span><br />
+      iter(x)</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type">a new object with type S, a subtype of T</span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.open-class.html#__new__" class="summary-sig-name">__new__</a>(<span class="summary-sig-arg">T</span>,
+        <span class="summary-sig-arg">S</span>,
+        <span class="summary-sig-arg">...</span>)</span></td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="__next__"></a><span class="summary-sig-name">__next__</span>(<span class="summary-sig-arg">...</span>)</span></td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="close"></a><span class="summary-sig-name">close</span>()</span><br />
+      close GRIB file, deallocate C structures associated with class 
+      instance</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.open-class.html#message" class="summary-sig-name">message</a>(<span class="summary-sig-arg">N</span>)</span><br />
+      retrieve N'th message in iterator.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type">the next value, or raise StopIteration</span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="next"></a><span class="summary-sig-name">next</span>(<span class="summary-sig-arg">x</span>)</span></td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.open-class.html#read" class="summary-sig-name">read</a>(<span class="summary-sig-arg">N</span>=<span class="summary-sig-default">None</span>)</span><br />
+      read N messages from current position, returning grib messages 
+      instances in a list.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.open-class.html#readline" class="summary-sig-name">readline</a>()</span><br />
+      read one entire grib message from the file.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="rewind"></a><span class="summary-sig-name">rewind</span>(<span class="summary-sig-arg">...</span>)</span><br />
+      rewind iterator (same as seek(0))</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="seek"></a><span class="summary-sig-name">seek</span>(<span class="summary-sig-arg">N</span>,
+        <span class="summary-sig-arg">from_what</span>=<span class="summary-sig-default">0</span>)</span><br />
+      advance iterator N grib messages from beginning of file (if 
+      <code>from_what=0</code>), from current position (if 
+      <code>from_what=1</code>) or from the end of file (if 
+      <code>from_what=2</code>).</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="pygrib.open-class.html#select" class="summary-sig-name">select</a>(<span class="summary-sig-arg">**kwargs</span>)</span><br />
+      return a list of <a href="pygrib.gribmessage-class.html" 
+      class="link">gribmessage</a> instances from iterator filtered by 
+      kwargs.</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="tell"></a><span class="summary-sig-name">tell</span>(<span class="summary-sig-arg">...</span>)</span><br />
+      returns position of iterator (grib message number, 0 means iterator 
+      is positioned at beginning of file).</td>
+          <td align="right" valign="top">
+            
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+  <tr>
+    <td colspan="2" class="summary">
+    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
+      <code>__delattr__</code>,
+      <code>__format__</code>,
+      <code>__getattribute__</code>,
+      <code>__hash__</code>,
+      <code>__reduce__</code>,
+      <code>__reduce_ex__</code>,
+      <code>__repr__</code>,
+      <code>__setattr__</code>,
+      <code>__sizeof__</code>,
+      <code>__str__</code>,
+      <code>__subclasshook__</code>
+      </p>
+    </td>
+  </tr>
+</table>
+<!-- ==================== INSTANCE VARIABLES ==================== -->
+<a name="section-InstanceVariables"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Instance Variables</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="messagenumber"></a><span class="summary-name">messagenumber</span><br />
+      The grib message number that the iterator currently points to (the 
+      value returned by <a href="pygrib.open-class.html#tell" 
+      class="link">tell</a>).
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="messages"></a><span class="summary-name">messages</span><br />
+      The total number of grib messages in the file.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="name"></a><span class="summary-name">name</span><br />
+      The GRIB file which the instance represents.
+    </td>
+  </tr>
+</table>
+<!-- ==================== PROPERTIES ==================== -->
+<a name="section-Properties"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Properties</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="closed"></a><span class="summary-name">closed</span>
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="has_multi_field_msgs"></a><span class="summary-name">has_multi_field_msgs</span>
+    </td>
+  </tr>
+  <tr>
+    <td colspan="2" class="summary">
+    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
+      <code>__class__</code>
+      </p>
+    </td>
+  </tr>
+</table>
+<!-- ==================== METHOD DETAILS ==================== -->
+<a name="section-MethodDetails"></a>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Method Details</span></td>
+</tr>
+</table>
+<a name="__init__"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">filename</span>)</span>
+    <br /><em class="fname">(Constructor)</em>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>x.__init__(...) initializes x; see help(type(x)) for signature</p>
+  <dl class="fields">
+    <dt>Overrides:
+        object.__init__
+    </dt>
+  </dl>
+</td></tr></table>
+</div>
+<a name="__new__"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">__new__</span>(<span class="sig-arg">T</span>,
+        <span class="sig-arg">S</span>,
+        <span class="sig-arg">...</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  
+  <dl class="fields">
+    <dt>Returns: a new object with type S, a subtype of T</dt>
+    <dt>Overrides:
+        object.__new__
+    </dt>
+  </dl>
+</td></tr></table>
+</div>
+<a name="message"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">message</span>(<span class="sig-arg">N</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>retrieve N'th message in iterator. same as seek(N-1) followed by 
+  readline().</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="read"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">read</span>(<span class="sig-arg">N</span>=<span class="sig-default">None</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>read N messages from current position, returning grib messages 
+  instances in a list.  If N=None, all the messages to the end of the file 
+  are read. <code>pygrib.open(f).read()</code> is equivalent to 
+  <code>list(pygrib.open(f))</code>, both return a list containing <a 
+  href="pygrib.gribmessage-class.html" class="link">gribmessage</a> 
+  instances for all the grib messages in the file <code>f</code>.</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="readline"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">readline</span>()</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>read one entire grib message from the file. Returns a <a 
+  href="pygrib.gribmessage-class.html" class="link">gribmessage</a> 
+  instance, or None if an EOF is encountered.</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="select"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">select</span>(<span class="sig-arg">**kwargs</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    > 
+    </td>
+  </tr></table>
+  
+  <p>return a list of <a href="pygrib.gribmessage-class.html" 
+  class="link">gribmessage</a> instances from iterator filtered by kwargs. 
+  If keyword is a container object, each grib message in the iterator is 
+  searched for membership in the container. If keyword is a callable (has a
+  _call__ method), each grib message in the iterator is tested using the 
+  callable (which should return a boolean). If keyword is not a container 
+  object or a callable, each grib message in the iterator is tested for 
+  equality.</p>
+  <p>Example usage:</p>
+<pre class="py-doctest">
+<span class="py-prompt">>>> </span><span class="py-keyword">import</span> pygrib
+<span class="py-prompt">>>> </span>grbs = pygrib.open(<span class="py-string">'sampledata/gfs.grb'</span>)
+<span class="py-prompt">>>> </span>selected_grbs=grbs.select(shortName=<span class="py-string">'gh'</span>,typeOfLevel=<span class="py-string">'isobaricInhPa'</span>,level=10)
+<span class="py-prompt">>>> </span><span class="py-keyword">for</span> grb <span class="py-keyword">in</span> selected_grbs: grb
+<span class="py-output">26:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 10 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span>
+<span class="py-output"></span><span class="py-prompt">>>> </span><span class="py-comment"># the __call__ method does the same thing</span>
+<span class="py-prompt">>>> </span>selected_grbs=grbs(shortName=<span class="py-string">'gh'</span>,typeOfLevel=<span class="py-string">'isobaricInhPa'</span>,level=10)
+<span class="py-prompt">>>> </span><span class="py-keyword">for</span> grb <span class="py-keyword">in</span> selected_grbs: grb
+<span class="py-output">26:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 10 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span>
+<span class="py-output"></span><span class="py-prompt">>>> </span><span class="py-comment"># to select multiple specific key values, use containers (e.g. sequences)</span>
+<span class="py-prompt">>>> </span>selected_grbs=grbs(shortName=[<span class="py-string">'u'</span>,<span class="py-string">'v'</span>],typeOfLevel=<span class="py-string">'isobaricInhPa'</span>,level=[10,50])
+<span class="py-prompt">>>> </span><span class="py-keyword">for</span> grb <span class="py-keyword">in</span> selected_grbs: grb
+<span class="py-output">193:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 50 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span>
+<span class="py-output">194:v-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 50 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span>
+<span class="py-output">199:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 10 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span>
+<span class="py-output">200:v-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 10 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span>
+<span class="py-output"></span><span class="py-prompt">>>> </span><span class="py-comment"># to select key values based on a conditional expression, use a function</span>
+<span class="py-prompt">>>> </span>selected_grbs=grbs(shortName=<span class="py-string">'gh'</span>,level=<span class="py-keyword">lambda</span> l: l < 500 <span class="py-keyword">and</span> l >= 300)
+<span class="py-prompt">>>> </span><span class="py-keyword">for</span> grb <span class="py-keyword">in</span> selected_grbs: grb
+<span class="py-output">14:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 45000 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span>
+<span class="py-output">15:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span>
+<span class="py-output">16:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span>
+<span class="py-output">17:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst</span></pre>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<br />
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="pygrib-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1 on Fri Feb  7 15:35:47 2014
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/docs/redirect.html b/docs/redirect.html
new file mode 100644
index 0000000..8048c7a
--- /dev/null
+++ b/docs/redirect.html
@@ -0,0 +1,38 @@
+<html><head><title>Epydoc Redirect Page</title>
+<meta http-equiv="cache-control" content="no-cache" />
+<meta http-equiv="expires" content="0" />
+<meta http-equiv="pragma" content="no-cache" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+<body>
+<script type="text/javascript">
+<!--
+var pages = ["pygrib.gribmessage-c", "pygrib.index-c", "pygrib.open-c", "pygrib-m"];
+var dottedName = get_anchor();
+if (dottedName) {
+    var target = redirect_url(dottedName);
+    if (target) window.location.replace(target);
+}
+// -->
+</script>
+
+<h3>Epydoc Auto-redirect page</h3>
+
+<p>When javascript is enabled, this page will redirect URLs of
+the form <tt>redirect.html#<i>dotted.name</i></tt> to the
+documentation for the object with the given fully-qualified
+dotted name.</p>
+<p><a id="message">   </a></p>
+
+<script type="text/javascript">
+<!--
+if (dottedName) {
+    var msg = document.getElementById("message");
+    msg.innerHTML = "No documentation found for <tt>"+
+                    dottedName+"</tt>";
+}
+// -->
+</script>
+
+</body>
+</html>
diff --git a/g2clib.c b/g2clib.c
new file mode 100644
index 0000000..45fc2bf
--- /dev/null
+++ b/g2clib.c
@@ -0,0 +1,7183 @@
+/* Generated by Cython 0.17.4 on Fri Jan 11 07:16:35 2013 */
+
+#define PY_SSIZE_T_CLEAN
+#include "Python.h"
+#ifndef Py_PYTHON_H
+    #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 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 > 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_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
+
+
+#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__g2clib
+#define __PYX_HAVE_API__g2clib
+#include "stdlib.h"
+#include "inttypes.h"
+#include "grib2.h"
+#ifdef _OPENMP
+#include <omp.h>
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+
+/* inline attribute */
+#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
+
+/* unused attribute */
+#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 long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+
+/* Type Conversion Predeclarations */
+
+#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
+#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
+
+#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))
+
+#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_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[] = {
+  "g2clib.pyx",
+};
+
+/*--- Type declarations ---*/
+#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_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)
+
+static PyObject *__Pyx_GetName(PyObject *dict, 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*/
+
+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 Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */
+
+static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
+
+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;
+}
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        PyObject *r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
+        PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        PyObject *r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+        return r;
+    }
+    else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
+        PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
+        Py_INCREF(r);
+        return r;
+    }
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+#else
+    return PySequence_GetItem(o, i);
+#endif
+}
+#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_Fast(o, i) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
+#if CYTHON_COMPILING_IN_CPYTHON
+    if (PyList_CheckExact(o)) {
+        Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
+        if (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 = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
+        if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, n);
+            Py_INCREF(r);
+            return r;
+        }
+    } else {  /* inlined PySequence_GetItem() */
+        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
+        if (likely(m && m->sq_item)) {
+            if (unlikely(i < 0) && likely(m->sq_length)) {
+                Py_ssize_t l = m->sq_length(o);
+                if (unlikely(l < 0)) return NULL;
+                i += l;
+            }
+            return m->sq_item(o, i);
+        }
+    }
+#else
+    if (PySequence_Check(o)) {
+        return PySequence_GetItem(o, i);
+    }
+#endif
+    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
+}
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t);
+
+static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/
+#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
+static PyObject* __pyx_print = 0;
+static PyObject* __pyx_print_kwargs = 0;
+#endif
+
+static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*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);
+
+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 'g2clib' */
+static PyObject *__pyx_f_6g2clib__toarray(void *, PyObject *); /*proto*/
+#define __Pyx_MODULE_NAME "g2clib"
+int __pyx_module_is_main_g2clib = 0;
+
+/* Implementation of 'g2clib' */
+static PyObject *__pyx_builtin_RuntimeError;
+static PyObject *__pyx_pf_6g2clib_rtoi_ieee(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rarr, PyObject *__pyx_v_iarr); /* proto */
+static PyObject *__pyx_pf_6g2clib_2itor_ieee(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_iarr, PyObject *__pyx_v_rarr); /* proto */
+static PyObject *__pyx_pf_6g2clib_4unpack1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_ipos, PyObject *__pyx_v_zeros); /* proto */
+static PyObject *__pyx_pf_6g2clib_6unpack3(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_ipos, PyObject *__pyx_v_zeros); /* proto */
+static PyObject *__pyx_pf_6g2clib_8unpack4(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_ipos, PyObject *__pyx_v_zeros); /* proto */
+static PyObject *__pyx_pf_6g2clib_10unpack5(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_ipos, PyObject *__pyx_v_zeros); /* proto */
+static PyObject *__pyx_pf_6g2clib_12unpack6(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_ndpts, PyObject *__pyx_v_ipos, PyObject *__pyx_v_zeros); /* proto */
+static PyObject *__pyx_pf_6g2clib_14unpack7(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_gdtnum, PyObject *__pyx_v_gdtmpl, PyObject *__pyx_v_drtnum, PyObject *__pyx_v_drtmpl, PyObject *__pyx_v_ndpts, PyObject *__pyx_v_ipos, PyObject *__pyx_v_zeros, PyObject *__pyx_v_printminmax, PyObject *__pyx_v_storageorder); /* proto */
+static PyObject *__pyx_pf_6g2clib_16grib2_create(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_listsec0, PyObject *__pyx_v_listsec1); /* proto */
+static PyObject *__pyx_pf_6g2clib_18grib2_end(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg); /* proto */
+static PyObject *__pyx_pf_6g2clib_20grib2_addgrid(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_gds, PyObject *__pyx_v_gdstmpl, PyObject *__pyx_v_deflist, CYTHON_UNUSED PyObject *__pyx_v_defnum); /* proto */
+static PyObject *__pyx_pf_6g2clib_22grib2_addfield(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_pdsnum, PyObject *__pyx_v_pdstmpl, PyObject *__pyx_v_coordlist, PyObject *__pyx_v_drsnum, PyObject *__pyx_v_drstmpl, PyObject *__pyx_v_field, PyObject *__pyx_v_ibitmap, PyObject *__pyx_v_bitmap); /* proto */
+static char __pyx_k_1[] = "error getting buffer for input real array";
+static char __pyx_k_2[] = "error getting buffer for output integer array";
+static char __pyx_k_3[] = "integer output array must be as least as long a real input array";
+static char __pyx_k_4[] = "error getting buffer for output real array";
+static char __pyx_k_5[] = "error getting buffer for input integer array";
+static char __pyx_k_6[] = "real output array must be as least as long a integerinput array";
+static char __pyx_k_7[] = "unknown array type %s";
+static char __pyx_k_8[] = "Error unpacking section 1 - error code = %i";
+static char __pyx_k_9[] = "Error unpacking section 3 - error code = %i";
+static char __pyx_k_11[] = "Error unpacking section 4 - error code = %i";
+static char __pyx_k_12[] = "Error unpacking section 5 - error code = %i";
+static char __pyx_k_13[] = "Error unpacking section 6 - error code = %i";
+static char __pyx_k_15[] = "Error unpacking section 7 - error code = %i";
+static char __pyx_k_16[] = "%.";
+static char __pyx_k_17[] = "min/max=";
+static char __pyx_k_18[] = "/";
+static char __pyx_k_19[] = " ";
+static char __pyx_k_20[] = "Error in grib2_create, error code = %i";
+static char __pyx_k_21[] = "        ";
+static char __pyx_k_22[] = "error in grib2_end, error code = %i";
+static char __pyx_k_23[] = "error in grib2_addgrid, error code = %i";
+static char __pyx_k_24[] = "error in grib2_addfield, error code = %i";
+static char __pyx_k_25[] = "Pyrex code to provide python interfaces to functions\nin the NCEP grib2c library. Make changes to this file, not the\nc-wrappers that Pyrex generates.";
+static char __pyx_k_28[] = "/Users/jsw/python/pygrib/g2clib.pyx";
+static char __pyx_k__C[] = "C";
+static char __pyx_k__g[] = "g";
+static char __pyx_k__i[] = "i";
+static char __pyx_k__n[] = "n";
+static char __pyx_k__f4[] = "f4";
+static char __pyx_k__i1[] = "i1";
+static char __pyx_k__i4[] = "i4";
+static char __pyx_k__r1[] = "r1";
+static char __pyx_k__fld[] = "fld";
+static char __pyx_k__gds[] = "gds";
+static char __pyx_k__ids[] = "ids";
+static char __pyx_k__msg[] = "msg";
+static char __pyx_k__pow[] = "pow";
+static char __pyx_k__bmap[] = "bmap";
+static char __pyx_k__ceil[] = "ceil";
+static char __pyx_k__data[] = "data";
+static char __pyx_k__iarr[] = "iarr";
+static char __pyx_k__idat[] = "idat";
+static char __pyx_k__ierr[] = "ierr";
+static char __pyx_k__igds[] = "igds";
+static char __pyx_k__ipos[] = "ipos";
+static char __pyx_k__math[] = "math";
+static char __pyx_k__rarr[] = "rarr";
+static char __pyx_k__rdat[] = "rdat";
+static char __pyx_k__rmax[] = "rmax";
+static char __pyx_k__rmin[] = "rmin";
+static char __pyx_k__cgrib[] = "cgrib";
+static char __pyx_k__dtype[] = "dtype";
+static char __pyx_k__field[] = "field";
+static char __pyx_k__ibmap[] = "ibmap";
+static char __pyx_k__idata[] = "idata";
+static char __pyx_k__int32[] = "int32";
+static char __pyx_k__iofst[] = "iofst";
+static char __pyx_k__isec0[] = "isec0";
+static char __pyx_k__isec1[] = "isec1";
+static char __pyx_k__lgrib[] = "lgrib";
+static char __pyx_k__log10[] = "log10";
+static char __pyx_k__ndpts[] = "ndpts";
+static char __pyx_k__ngpts[] = "ngpts";
+static char __pyx_k__order[] = "order";
+static char __pyx_k__rdata[] = "rdata";
+static char __pyx_k__zeros[] = "zeros";
+static char __pyx_k__bitmap[] = "bitmap";
+static char __pyx_k__buflen[] = "buflen";
+static char __pyx_k__defnum[] = "defnum";
+static char __pyx_k__drsnum[] = "drsnum";
+static char __pyx_k__drtmpl[] = "drtmpl";
+static char __pyx_k__drtnum[] = "drtnum";
+static char __pyx_k__fldmax[] = "fldmax";
+static char __pyx_k__fldmin[] = "fldmin";
+static char __pyx_k__format[] = "format";
+static char __pyx_k__g2clib[] = "g2clib";
+static char __pyx_k__gdsdat[] = "gdsdat";
+static char __pyx_k__gdtmpl[] = "gdtmpl";
+static char __pyx_k__gdtnum[] = "gdtnum";
+static char __pyx_k__idsect[] = "idsect";
+static char __pyx_k__idslen[] = "idslen";
+static char __pyx_k__pdsnum[] = "pdsnum";
+static char __pyx_k__pdtmpl[] = "pdtmpl";
+static char __pyx_k__bufleni[] = "bufleni";
+static char __pyx_k__buflenr[] = "buflenr";
+static char __pyx_k__deflist[] = "deflist";
+static char __pyx_k__drstmpl[] = "drstmpl";
+static char __pyx_k__float32[] = "float32";
+static char __pyx_k__gdstmpl[] = "gdstmpl";
+static char __pyx_k__gribmsg[] = "gribmsg";
+static char __pyx_k__ibitmap[] = "ibitmap";
+static char __pyx_k__idefnum[] = "idefnum";
+static char __pyx_k__idrsnum[] = "idrsnum";
+static char __pyx_k__igdsnum[] = "igdsnum";
+static char __pyx_k__ipdsnum[] = "ipdsnum";
+static char __pyx_k__ngrdpts[] = "ngrdpts";
+static char __pyx_k__pdstmpl[] = "pdstmpl";
+static char __pyx_k__unpack1[] = "unpack1";
+static char __pyx_k__unpack3[] = "unpack3";
+static char __pyx_k__unpack4[] = "unpack4";
+static char __pyx_k__unpack5[] = "unpack5";
+static char __pyx_k__unpack6[] = "unpack6";
+static char __pyx_k__unpack7[] = "unpack7";
+static char __pyx_k____main__[] = "__main__";
+static char __pyx_k____test__[] = "__test__";
+static char __pyx_k__fielddat[] = "fielddat";
+static char __pyx_k__ideflist[] = "ideflist";
+static char __pyx_k__idrstmpl[] = "idrstmpl";
+static char __pyx_k__igdstmpl[] = "igdstmpl";
+static char __pyx_k__ipdstmpl[] = "ipdstmpl";
+static char __pyx_k__listsec0[] = "listsec0";
+static char __pyx_k__listsec1[] = "listsec1";
+static char __pyx_k__numcoord[] = "numcoord";
+static char __pyx_k__bitmapdat[] = "bitmapdat";
+static char __pyx_k__coordlist[] = "coordlist";
+static char __pyx_k__drtmpldat[] = "drtmpldat";
+static char __pyx_k__gdtmpldat[] = "gdtmpldat";
+static char __pyx_k__grib2_end[] = "grib2_end";
+static char __pyx_k__itor_ieee[] = "itor_ieee";
+static char __pyx_k__mapdrslen[] = "mapdrslen";
+static char __pyx_k__mappdslen[] = "mappdslen";
+static char __pyx_k__pdtmpldat[] = "pdtmpldat";
+static char __pyx_k__rtoi_ieee[] = "rtoi_ieee";
+static char __pyx_k__deflistdat[] = "deflistdat";
+static char __pyx_k__fcoordlist[] = "fcoordlist";
+static char __pyx_k__gdstmpldat[] = "gdstmpldat";
+static char __pyx_k__icoordlist[] = "icoordlist";
+static char __pyx_k__mapgridlen[] = "mapgridlen";
+static char __pyx_k__listsec0dat[] = "listsec0dat";
+static char __pyx_k__listsec1dat[] = "listsec1dat";
+static char __pyx_k__printminmax[] = "printminmax";
+static char __pyx_k__RuntimeError[] = "RuntimeError";
+static char __pyx_k__coordlistdat[] = "coordlistdat";
+static char __pyx_k__grib2_create[] = "grib2_create";
+static char __pyx_k__minmaxstring[] = "minmaxstring";
+static char __pyx_k__storageorder[] = "storageorder";
+static char __pyx_k__grib2_addgrid[] = "grib2_addgrid";
+static char __pyx_k__grib2_addfield[] = "grib2_addfield";
+static char __pyx_k__bitsofprecision[] = "bitsofprecision";
+static char __pyx_k__digitsofprecision[] = "digitsofprecision";
+static PyObject *__pyx_kp_s_1;
+static PyObject *__pyx_kp_s_11;
+static PyObject *__pyx_kp_s_12;
+static PyObject *__pyx_kp_s_13;
+static PyObject *__pyx_kp_s_15;
+static PyObject *__pyx_kp_s_16;
+static PyObject *__pyx_kp_s_17;
+static PyObject *__pyx_kp_s_18;
+static PyObject *__pyx_kp_b_19;
+static PyObject *__pyx_kp_s_2;
+static PyObject *__pyx_kp_s_20;
+static PyObject *__pyx_kp_b_21;
+static PyObject *__pyx_kp_s_22;
+static PyObject *__pyx_kp_s_23;
+static PyObject *__pyx_kp_s_24;
+static PyObject *__pyx_kp_s_28;
+static PyObject *__pyx_kp_s_3;
+static PyObject *__pyx_kp_s_4;
+static PyObject *__pyx_kp_s_5;
+static PyObject *__pyx_kp_s_6;
+static PyObject *__pyx_kp_s_7;
+static PyObject *__pyx_kp_s_8;
+static PyObject *__pyx_kp_s_9;
+static PyObject *__pyx_n_s__C;
+static PyObject *__pyx_n_s__RuntimeError;
+static PyObject *__pyx_n_s____main__;
+static PyObject *__pyx_n_s____test__;
+static PyObject *__pyx_n_s__bitmap;
+static PyObject *__pyx_n_s__bitmapdat;
+static PyObject *__pyx_n_s__bitsofprecision;
+static PyObject *__pyx_n_s__bmap;
+static PyObject *__pyx_n_s__buflen;
+static PyObject *__pyx_n_s__bufleni;
+static PyObject *__pyx_n_s__buflenr;
+static PyObject *__pyx_n_s__ceil;
+static PyObject *__pyx_n_s__cgrib;
+static PyObject *__pyx_n_s__coordlist;
+static PyObject *__pyx_n_s__coordlistdat;
+static PyObject *__pyx_n_s__data;
+static PyObject *__pyx_n_s__deflist;
+static PyObject *__pyx_n_s__deflistdat;
+static PyObject *__pyx_n_s__defnum;
+static PyObject *__pyx_n_s__digitsofprecision;
+static PyObject *__pyx_n_s__drsnum;
+static PyObject *__pyx_n_s__drstmpl;
+static PyObject *__pyx_n_s__drtmpl;
+static PyObject *__pyx_n_s__drtmpldat;
+static PyObject *__pyx_n_s__drtnum;
+static PyObject *__pyx_n_s__dtype;
+static PyObject *__pyx_n_s__f4;
+static PyObject *__pyx_n_s__fcoordlist;
+static PyObject *__pyx_n_s__field;
+static PyObject *__pyx_n_s__fielddat;
+static PyObject *__pyx_n_s__fld;
+static PyObject *__pyx_n_s__fldmax;
+static PyObject *__pyx_n_s__fldmin;
+static PyObject *__pyx_n_s__float32;
+static PyObject *__pyx_n_s__format;
+static PyObject *__pyx_n_s__g;
+static PyObject *__pyx_n_s__g2clib;
+static PyObject *__pyx_n_s__gds;
+static PyObject *__pyx_n_s__gdsdat;
+static PyObject *__pyx_n_s__gdstmpl;
+static PyObject *__pyx_n_s__gdstmpldat;
+static PyObject *__pyx_n_s__gdtmpl;
+static PyObject *__pyx_n_s__gdtmpldat;
+static PyObject *__pyx_n_s__gdtnum;
+static PyObject *__pyx_n_s__grib2_addfield;
+static PyObject *__pyx_n_s__grib2_addgrid;
+static PyObject *__pyx_n_s__grib2_create;
+static PyObject *__pyx_n_s__grib2_end;
+static PyObject *__pyx_n_s__gribmsg;
+static PyObject *__pyx_n_s__i;
+static PyObject *__pyx_n_s__i1;
+static PyObject *__pyx_n_s__i4;
+static PyObject *__pyx_n_s__iarr;
+static PyObject *__pyx_n_s__ibitmap;
+static PyObject *__pyx_n_s__ibmap;
+static PyObject *__pyx_n_s__icoordlist;
+static PyObject *__pyx_n_s__idat;
+static PyObject *__pyx_n_s__idata;
+static PyObject *__pyx_n_s__ideflist;
+static PyObject *__pyx_n_s__idefnum;
+static PyObject *__pyx_n_s__idrsnum;
+static PyObject *__pyx_n_s__idrstmpl;
+static PyObject *__pyx_n_s__ids;
+static PyObject *__pyx_n_s__idsect;
+static PyObject *__pyx_n_s__idslen;
+static PyObject *__pyx_n_s__ierr;
+static PyObject *__pyx_n_s__igds;
+static PyObject *__pyx_n_s__igdsnum;
+static PyObject *__pyx_n_s__igdstmpl;
+static PyObject *__pyx_n_s__int32;
+static PyObject *__pyx_n_s__iofst;
+static PyObject *__pyx_n_s__ipdsnum;
+static PyObject *__pyx_n_s__ipdstmpl;
+static PyObject *__pyx_n_s__ipos;
+static PyObject *__pyx_n_s__isec0;
+static PyObject *__pyx_n_s__isec1;
+static PyObject *__pyx_n_s__itor_ieee;
+static PyObject *__pyx_n_s__lgrib;
+static PyObject *__pyx_n_s__listsec0;
+static PyObject *__pyx_n_s__listsec0dat;
+static PyObject *__pyx_n_s__listsec1;
+static PyObject *__pyx_n_s__listsec1dat;
+static PyObject *__pyx_n_s__log10;
+static PyObject *__pyx_n_s__mapdrslen;
+static PyObject *__pyx_n_s__mapgridlen;
+static PyObject *__pyx_n_s__mappdslen;
+static PyObject *__pyx_n_s__math;
+static PyObject *__pyx_n_s__minmaxstring;
+static PyObject *__pyx_n_s__msg;
+static PyObject *__pyx_n_s__n;
+static PyObject *__pyx_n_s__ndpts;
+static PyObject *__pyx_n_s__ngpts;
+static PyObject *__pyx_n_s__ngrdpts;
+static PyObject *__pyx_n_s__numcoord;
+static PyObject *__pyx_n_s__order;
+static PyObject *__pyx_n_s__pdsnum;
+static PyObject *__pyx_n_s__pdstmpl;
+static PyObject *__pyx_n_s__pdtmpl;
+static PyObject *__pyx_n_s__pdtmpldat;
+static PyObject *__pyx_n_s__pow;
+static PyObject *__pyx_n_s__printminmax;
+static PyObject *__pyx_n_s__r1;
+static PyObject *__pyx_n_s__rarr;
+static PyObject *__pyx_n_s__rdat;
+static PyObject *__pyx_n_s__rdata;
+static PyObject *__pyx_n_s__rmax;
+static PyObject *__pyx_n_s__rmin;
+static PyObject *__pyx_n_s__rtoi_ieee;
+static PyObject *__pyx_n_s__storageorder;
+static PyObject *__pyx_n_s__unpack1;
+static PyObject *__pyx_n_s__unpack3;
+static PyObject *__pyx_n_s__unpack4;
+static PyObject *__pyx_n_s__unpack5;
+static PyObject *__pyx_n_s__unpack6;
+static PyObject *__pyx_n_s__unpack7;
+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_4;
+static PyObject *__pyx_int_5;
+static PyObject *__pyx_int_8;
+static PyObject *__pyx_int_254;
+static PyObject *__pyx_int_260;
+static PyObject *__pyx_k_14;
+static PyObject *__pyx_k_tuple_10;
+static PyObject *__pyx_k_tuple_26;
+static PyObject *__pyx_k_tuple_29;
+static PyObject *__pyx_k_tuple_31;
+static PyObject *__pyx_k_tuple_33;
+static PyObject *__pyx_k_tuple_35;
+static PyObject *__pyx_k_tuple_37;
+static PyObject *__pyx_k_tuple_39;
+static PyObject *__pyx_k_tuple_41;
+static PyObject *__pyx_k_tuple_43;
+static PyObject *__pyx_k_tuple_45;
+static PyObject *__pyx_k_tuple_47;
+static PyObject *__pyx_k_tuple_49;
+static PyObject *__pyx_k_codeobj_27;
+static PyObject *__pyx_k_codeobj_30;
+static PyObject *__pyx_k_codeobj_32;
+static PyObject *__pyx_k_codeobj_34;
+static PyObject *__pyx_k_codeobj_36;
+static PyObject *__pyx_k_codeobj_38;
+static PyObject *__pyx_k_codeobj_40;
+static PyObject *__pyx_k_codeobj_42;
+static PyObject *__pyx_k_codeobj_44;
+static PyObject *__pyx_k_codeobj_46;
+static PyObject *__pyx_k_codeobj_48;
+static PyObject *__pyx_k_codeobj_50;
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6g2clib_1rtoi_ieee(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6g2clib_rtoi_ieee[] = "\n Converts a float32 array into an int32 array of IEEE formatted values\n    ";
+static PyMethodDef __pyx_mdef_6g2clib_1rtoi_ieee = {__Pyx_NAMESTR("rtoi_ieee"), (PyCFunction)__pyx_pw_6g2clib_1rtoi_ieee, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6g2clib_rtoi_ieee)};
+static PyObject *__pyx_pw_6g2clib_1rtoi_ieee(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_rarr = 0;
+  PyObject *__pyx_v_iarr = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("rtoi_ieee (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__rarr,&__pyx_n_s__iarr,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__rarr)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iarr)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("rtoi_ieee", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rtoi_ieee") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __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_rarr = values[0];
+    __pyx_v_iarr = values[1];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("rtoi_ieee", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("g2clib.rtoi_ieee", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6g2clib_rtoi_ieee(__pyx_self, __pyx_v_rarr, __pyx_v_iarr);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "g2clib.pyx":55
+ * # routines for convert to/from IEEE integers.
+ * 
+ * def rtoi_ieee(object rarr, object iarr):             # <<<<<<<<<<<<<<
+ *     """
+ *  Converts a float32 array into an int32 array of IEEE formatted values
+ */
+
+static PyObject *__pyx_pf_6g2clib_rtoi_ieee(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rarr, PyObject *__pyx_v_iarr) {
+  void *__pyx_v_rdat;
+  void *__pyx_v_idat;
+  g2float *__pyx_v_rdata;
+  g2int *__pyx_v_idata;
+  Py_ssize_t __pyx_v_bufleni;
+  Py_ssize_t __pyx_v_buflenr;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("rtoi_ieee", 0);
+
+  /* "g2clib.pyx":63
+ *     cdef g2int *idata, i1
+ *     cdef Py_ssize_t bufleni, buflenr
+ *     if PyObject_AsReadBuffer(rarr, &rdat, &buflenr) <> 0:             # <<<<<<<<<<<<<<
+ *         raise RuntimeError, 'error getting buffer for input real array'
+ *     if PyObject_AsWriteBuffer(iarr, &idat, &bufleni)  <> 0 :
+ */
+  __pyx_t_1 = (PyObject_AsReadBuffer(__pyx_v_rarr, (&__pyx_v_rdat), (&__pyx_v_buflenr)) != 0);
+  if (__pyx_t_1) {
+
+    /* "g2clib.pyx":64
+ *     cdef Py_ssize_t bufleni, buflenr
+ *     if PyObject_AsReadBuffer(rarr, &rdat, &buflenr) <> 0:
+ *         raise RuntimeError, 'error getting buffer for input real array'             # <<<<<<<<<<<<<<
+ *     if PyObject_AsWriteBuffer(iarr, &idat, &bufleni)  <> 0 :
+ *         raise RuntimeError, 'error getting buffer for output integer array'
+ */
+    __Pyx_Raise(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_kp_s_1), 0, 0);
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
+
+  /* "g2clib.pyx":65
+ *     if PyObject_AsReadBuffer(rarr, &rdat, &buflenr) <> 0:
+ *         raise RuntimeError, 'error getting buffer for input real array'
+ *     if PyObject_AsWriteBuffer(iarr, &idat, &bufleni)  <> 0 :             # <<<<<<<<<<<<<<
+ *         raise RuntimeError, 'error getting buffer for output integer array'
+ *     if bufleni < buflenr:
+ */
+  __pyx_t_1 = (PyObject_AsWriteBuffer(__pyx_v_iarr, (&__pyx_v_idat), (&__pyx_v_bufleni)) != 0);
+  if (__pyx_t_1) {
+
+    /* "g2clib.pyx":66
+ *         raise RuntimeError, 'error getting buffer for input real array'
+ *     if PyObject_AsWriteBuffer(iarr, &idat, &bufleni)  <> 0 :
+ *         raise RuntimeError, 'error getting buffer for output integer array'             # <<<<<<<<<<<<<<
+ *     if bufleni < buflenr:
+ *         raise RuntimeError, 'integer output array must be as least as long a real input array'
+ */
+    __Pyx_Raise(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_kp_s_2), 0, 0);
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L4;
+  }
+  __pyx_L4:;
+
+  /* "g2clib.pyx":67
+ *     if PyObject_AsWriteBuffer(iarr, &idat, &bufleni)  <> 0 :
+ *         raise RuntimeError, 'error getting buffer for output integer array'
+ *     if bufleni < buflenr:             # <<<<<<<<<<<<<<
+ *         raise RuntimeError, 'integer output array must be as least as long a real input array'
+ *     rdata = <g2float *>rdat
+ */
+  __pyx_t_1 = (__pyx_v_bufleni < __pyx_v_buflenr);
+  if (__pyx_t_1) {
+
+    /* "g2clib.pyx":68
+ *         raise RuntimeError, 'error getting buffer for output integer array'
+ *     if bufleni < buflenr:
+ *         raise RuntimeError, 'integer output array must be as least as long a real input array'             # <<<<<<<<<<<<<<
+ *     rdata = <g2float *>rdat
+ *     idata = <g2int *>idat
+ */
+    __Pyx_Raise(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_kp_s_3), 0, 0);
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L5;
+  }
+  __pyx_L5:;
+
+  /* "g2clib.pyx":69
+ *     if bufleni < buflenr:
+ *         raise RuntimeError, 'integer output array must be as least as long a real input array'
+ *     rdata = <g2float *>rdat             # <<<<<<<<<<<<<<
+ *     idata = <g2int *>idat
+ *     mkieee(rdata, idata, buflenr/4)
+ */
+  __pyx_v_rdata = ((g2float *)__pyx_v_rdat);
+
+  /* "g2clib.pyx":70
+ *         raise RuntimeError, 'integer output array must be as least as long a real input array'
+ *     rdata = <g2float *>rdat
+ *     idata = <g2int *>idat             # <<<<<<<<<<<<<<
+ *     mkieee(rdata, idata, buflenr/4)
+ * 
+ */
+  __pyx_v_idata = ((g2int *)__pyx_v_idat);
+
+  /* "g2clib.pyx":71
+ *     rdata = <g2float *>rdat
+ *     idata = <g2int *>idat
+ *     mkieee(rdata, idata, buflenr/4)             # <<<<<<<<<<<<<<
+ * 
+ * def itor_ieee(object iarr, object rarr):
+ */
+  mkieee(__pyx_v_rdata, __pyx_v_idata, __Pyx_div_Py_ssize_t(__pyx_v_buflenr, 4));
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_AddTraceback("g2clib.rtoi_ieee", __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_6g2clib_3itor_ieee(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6g2clib_2itor_ieee[] = "\n Converts an int32 array of IEEE values into a float32 array.\n    ";
+static PyMethodDef __pyx_mdef_6g2clib_3itor_ieee = {__Pyx_NAMESTR("itor_ieee"), (PyCFunction)__pyx_pw_6g2clib_3itor_ieee, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6g2clib_2itor_ieee)};
+static PyObject *__pyx_pw_6g2clib_3itor_ieee(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_iarr = 0;
+  PyObject *__pyx_v_rarr = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("itor_ieee (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__iarr,&__pyx_n_s__rarr,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__iarr)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rarr)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("itor_ieee", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "itor_ieee") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __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_iarr = values[0];
+    __pyx_v_rarr = values[1];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("itor_ieee", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("g2clib.itor_ieee", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6g2clib_2itor_ieee(__pyx_self, __pyx_v_iarr, __pyx_v_rarr);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "g2clib.pyx":73
+ *     mkieee(rdata, idata, buflenr/4)
+ * 
+ * def itor_ieee(object iarr, object rarr):             # <<<<<<<<<<<<<<
+ *     """
+ *  Converts an int32 array of IEEE values into a float32 array.
+ */
+
+static PyObject *__pyx_pf_6g2clib_2itor_ieee(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_iarr, PyObject *__pyx_v_rarr) {
+  void *__pyx_v_rdat;
+  void *__pyx_v_idat;
+  g2float *__pyx_v_rdata;
+  g2int *__pyx_v_idata;
+  Py_ssize_t __pyx_v_bufleni;
+  Py_ssize_t __pyx_v_buflenr;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("itor_ieee", 0);
+
+  /* "g2clib.pyx":81
+ *     cdef g2int *idata
+ *     cdef Py_ssize_t bufleni, buflenr
+ *     if PyObject_AsReadBuffer(rarr, &rdat, &buflenr) <> 0:             # <<<<<<<<<<<<<<
+ *         raise RuntimeError, 'error getting buffer for output real array'
+ *     if PyObject_AsWriteBuffer(iarr, &idat, &bufleni)  <> 0 :
+ */
+  __pyx_t_1 = (PyObject_AsReadBuffer(__pyx_v_rarr, (&__pyx_v_rdat), (&__pyx_v_buflenr)) != 0);
+  if (__pyx_t_1) {
+
+    /* "g2clib.pyx":82
+ *     cdef Py_ssize_t bufleni, buflenr
+ *     if PyObject_AsReadBuffer(rarr, &rdat, &buflenr) <> 0:
+ *         raise RuntimeError, 'error getting buffer for output real array'             # <<<<<<<<<<<<<<
+ *     if PyObject_AsWriteBuffer(iarr, &idat, &bufleni)  <> 0 :
+ *         raise RuntimeError, 'error getting buffer for input integer array'
+ */
+    __Pyx_Raise(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_kp_s_4), 0, 0);
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
+
+  /* "g2clib.pyx":83
+ *     if PyObject_AsReadBuffer(rarr, &rdat, &buflenr) <> 0:
+ *         raise RuntimeError, 'error getting buffer for output real array'
+ *     if PyObject_AsWriteBuffer(iarr, &idat, &bufleni)  <> 0 :             # <<<<<<<<<<<<<<
+ *         raise RuntimeError, 'error getting buffer for input integer array'
+ *     if buflenr < bufleni:
+ */
+  __pyx_t_1 = (PyObject_AsWriteBuffer(__pyx_v_iarr, (&__pyx_v_idat), (&__pyx_v_bufleni)) != 0);
+  if (__pyx_t_1) {
+
+    /* "g2clib.pyx":84
+ *         raise RuntimeError, 'error getting buffer for output real array'
+ *     if PyObject_AsWriteBuffer(iarr, &idat, &bufleni)  <> 0 :
+ *         raise RuntimeError, 'error getting buffer for input integer array'             # <<<<<<<<<<<<<<
+ *     if buflenr < bufleni:
+ *         raise RuntimeError, 'real output array must be as least as long a integerinput array'
+ */
+    __Pyx_Raise(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_kp_s_5), 0, 0);
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L4;
+  }
+  __pyx_L4:;
+
+  /* "g2clib.pyx":85
+ *     if PyObject_AsWriteBuffer(iarr, &idat, &bufleni)  <> 0 :
+ *         raise RuntimeError, 'error getting buffer for input integer array'
+ *     if buflenr < bufleni:             # <<<<<<<<<<<<<<
+ *         raise RuntimeError, 'real output array must be as least as long a integerinput array'
+ *     rdata = <g2float *>rdat
+ */
+  __pyx_t_1 = (__pyx_v_buflenr < __pyx_v_bufleni);
+  if (__pyx_t_1) {
+
+    /* "g2clib.pyx":86
+ *         raise RuntimeError, 'error getting buffer for input integer array'
+ *     if buflenr < bufleni:
+ *         raise RuntimeError, 'real output array must be as least as long a integerinput array'             # <<<<<<<<<<<<<<
+ *     rdata = <g2float *>rdat
+ *     idata = <g2int *>idat
+ */
+    __Pyx_Raise(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_kp_s_6), 0, 0);
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L5;
+  }
+  __pyx_L5:;
+
+  /* "g2clib.pyx":87
+ *     if buflenr < bufleni:
+ *         raise RuntimeError, 'real output array must be as least as long a integerinput array'
+ *     rdata = <g2float *>rdat             # <<<<<<<<<<<<<<
+ *     idata = <g2int *>idat
+ *     rdieee(idata, rdata, bufleni/4)
+ */
+  __pyx_v_rdata = ((g2float *)__pyx_v_rdat);
+
+  /* "g2clib.pyx":88
+ *         raise RuntimeError, 'real output array must be as least as long a integerinput array'
+ *     rdata = <g2float *>rdat
+ *     idata = <g2int *>idat             # <<<<<<<<<<<<<<
+ *     rdieee(idata, rdata, bufleni/4)
+ * 
+ */
+  __pyx_v_idata = ((g2int *)__pyx_v_idat);
+
+  /* "g2clib.pyx":89
+ *     rdata = <g2float *>rdat
+ *     idata = <g2int *>idat
+ *     rdieee(idata, rdata, bufleni/4)             # <<<<<<<<<<<<<<
+ * 
+ * cdef _toarray(void *items, object a):
+ */
+  rdieee(__pyx_v_idata, __pyx_v_rdata, __Pyx_div_Py_ssize_t(__pyx_v_bufleni, 4));
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_AddTraceback("g2clib.itor_ieee", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "g2clib.pyx":91
+ *     rdieee(idata, rdata, bufleni/4)
+ * 
+ * cdef _toarray(void *items, object a):             # <<<<<<<<<<<<<<
+ *     """
+ *  Fill a numpy array from the grib2 file.  Note that this free()s the items argument!
+ */
+
+static PyObject *__pyx_f_6g2clib__toarray(void *__pyx_v_items, PyObject *__pyx_v_a) {
+  void *__pyx_v_abuf;
+  Py_ssize_t __pyx_v_buflen;
+  g2int *__pyx_v_idata;
+  g2float *__pyx_v_fdata;
+  long __pyx_v_i;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_t_3;
+  Py_ssize_t __pyx_t_4;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("_toarray", 0);
+
+  /* "g2clib.pyx":101
+ * 
+ *     # get pointer to data buffer.
+ *     PyObject_AsWriteBuffer(a, &abuf, &buflen)             # <<<<<<<<<<<<<<
+ * 
+ *     if str(a.dtype) == 'int32':
+ */
+  PyObject_AsWriteBuffer(__pyx_v_a, (&__pyx_v_abuf), (&__pyx_v_buflen));
+
+  /* "g2clib.pyx":103
+ *     PyObject_AsWriteBuffer(a, &abuf, &buflen)
+ * 
+ *     if str(a.dtype) == 'int32':             # <<<<<<<<<<<<<<
+ *       idata = <g2int *>abuf
+ *       # fill buffer.
+ */
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __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 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__int32), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  if (__pyx_t_3) {
+
+    /* "g2clib.pyx":104
+ * 
+ *     if str(a.dtype) == 'int32':
+ *       idata = <g2int *>abuf             # <<<<<<<<<<<<<<
+ *       # fill buffer.
+ *       for i from 0 <= i < len(a):
+ */
+    __pyx_v_idata = ((g2int *)__pyx_v_abuf);
+
+    /* "g2clib.pyx":106
+ *       idata = <g2int *>abuf
+ *       # fill buffer.
+ *       for i from 0 <= i < len(a):             # <<<<<<<<<<<<<<
+ *         idata[i] = (<g2int *>items)[i]
+ *     elif str(a.dtype) == 'float32':
+ */
+    __pyx_t_4 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {
+
+      /* "g2clib.pyx":107
+ *       # fill buffer.
+ *       for i from 0 <= i < len(a):
+ *         idata[i] = (<g2int *>items)[i]             # <<<<<<<<<<<<<<
+ *     elif str(a.dtype) == 'float32':
+ *       fdata = <g2float *>abuf
+ */
+      (__pyx_v_idata[__pyx_v_i]) = (((g2int *)__pyx_v_items)[__pyx_v_i]);
+    }
+    goto __pyx_L3;
+  }
+
+  /* "g2clib.pyx":108
+ *       for i from 0 <= i < len(a):
+ *         idata[i] = (<g2int *>items)[i]
+ *     elif str(a.dtype) == 'float32':             # <<<<<<<<<<<<<<
+ *       fdata = <g2float *>abuf
+ *       # fill buffer.
+ */
+  __pyx_t_2 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __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 = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __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 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__float32), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __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 = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  if (__pyx_t_3) {
+
+    /* "g2clib.pyx":109
+ *         idata[i] = (<g2int *>items)[i]
+ *     elif str(a.dtype) == 'float32':
+ *       fdata = <g2float *>abuf             # <<<<<<<<<<<<<<
+ *       # fill buffer.
+ *       for i from 0 <= i < len(a):
+ */
+    __pyx_v_fdata = ((g2float *)__pyx_v_abuf);
+
+    /* "g2clib.pyx":111
+ *       fdata = <g2float *>abuf
+ *       # fill buffer.
+ *       for i from 0 <= i < len(a):             # <<<<<<<<<<<<<<
+ *         fdata[i] = (<g2float *>items)[i]
+ *     else:
+ */
+    __pyx_t_4 = PyObject_Length(__pyx_v_a); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {
+
+      /* "g2clib.pyx":112
+ *       # fill buffer.
+ *       for i from 0 <= i < len(a):
+ *         fdata[i] = (<g2float *>items)[i]             # <<<<<<<<<<<<<<
+ *     else:
+ *       free(items)
+ */
+      (__pyx_v_fdata[__pyx_v_i]) = (((g2float *)__pyx_v_items)[__pyx_v_i]);
+    }
+    goto __pyx_L3;
+  }
+  /*else*/ {
+
+    /* "g2clib.pyx":114
+ *         fdata[i] = (<g2float *>items)[i]
+ *     else:
+ *       free(items)             # <<<<<<<<<<<<<<
+ *       raise RuntimeError('unknown array type %s' % a.dtype)
+ * 
+ */
+    free(__pyx_v_items);
+
+    /* "g2clib.pyx":115
+ *     else:
+ *       free(items)
+ *       raise RuntimeError('unknown array type %s' % a.dtype)             # <<<<<<<<<<<<<<
+ * 
+ *     free(items)
+ */
+    __pyx_t_1 = PyObject_GetAttr(__pyx_v_a, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
+    __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 = 115; __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 = 115; __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 = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  __pyx_L3:;
+
+  /* "g2clib.pyx":117
+ *       raise RuntimeError('unknown array type %s' % a.dtype)
+ * 
+ *     free(items)             # <<<<<<<<<<<<<<
+ *     return a
+ * 
+ */
+  free(__pyx_v_items);
+
+  /* "g2clib.pyx":118
+ * 
+ *     free(items)
+ *     return a             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __Pyx_INCREF(__pyx_v_a);
+  __pyx_r = __pyx_v_a;
+  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_AddTraceback("g2clib._toarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6g2clib_5unpack1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6g2clib_4unpack1[] = "              .      .    .                                       .\n Unpacks Section 1 (Identification Section) as defined in GRIB Edition 2.\n \n idsect,ipos = unpack1(gribmsg,ipos)\n\n INPUTS:\n  gribmsg - chararcter string containing Section 1 of the GRIB2 message\n  ipos    - Byte offset for the beginning of Section 1 in gribmsg.\n  zeros   - Numeric/numpy array/scip.base zeros function (used to allocate\n            output python arrays). [...]
+static PyMethodDef __pyx_mdef_6g2clib_5unpack1 = {__Pyx_NAMESTR("unpack1"), (PyCFunction)__pyx_pw_6g2clib_5unpack1, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6g2clib_4unpack1)};
+static PyObject *__pyx_pw_6g2clib_5unpack1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_gribmsg = 0;
+  PyObject *__pyx_v_ipos = 0;
+  PyObject *__pyx_v_zeros = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("unpack1 (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__gribmsg,&__pyx_n_s__ipos,&__pyx_n_s__zeros,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__gribmsg)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ipos)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack1", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__zeros)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack1", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unpack1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __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_gribmsg = values[0];
+    __pyx_v_ipos = values[1];
+    __pyx_v_zeros = values[2];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("unpack1", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("g2clib.unpack1", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6g2clib_4unpack1(__pyx_self, __pyx_v_gribmsg, __pyx_v_ipos, __pyx_v_zeros);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "g2clib.pyx":123
+ * # routines for reading grib2 files.
+ * 
+ * def unpack1(gribmsg, ipos, object zeros):             # <<<<<<<<<<<<<<
+ *     """              .      .    .                                       .
+ *  Unpacks Section 1 (Identification Section) as defined in GRIB Edition 2.
+ */
+
+static PyObject *__pyx_pf_6g2clib_4unpack1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_ipos, PyObject *__pyx_v_zeros) {
+  unsigned char *__pyx_v_cgrib;
+  g2int __pyx_v_iofst;
+  g2int __pyx_v_ierr;
+  g2int __pyx_v_idslen;
+  g2int *__pyx_v_ids;
+  PyObject *__pyx_v_msg = NULL;
+  PyObject *__pyx_v_idsect = NULL;
+  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("unpack1", 0);
+
+  /* "g2clib.pyx":165
+ *     cdef g2int i, iofst, ierr, idslen
+ *     cdef g2int *ids
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)             # <<<<<<<<<<<<<<
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ierr = g2_unpack1(cgrib, &iofst, &ids, &idslen)
+ */
+  __pyx_v_cgrib = ((unsigned char *)PyBytes_AsString(__pyx_v_gribmsg));
+
+  /* "g2clib.pyx":166
+ *     cdef g2int *ids
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)             # <<<<<<<<<<<<<<
+ *     ierr = g2_unpack1(cgrib, &iofst, &ids, &idslen)
+ *     if ierr != 0:
+ */
+  __pyx_t_1 = PyNumber_Multiply(__pyx_v_ipos, __pyx_int_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_v_iofst = ((g2int)PyInt_AsLong(__pyx_t_1));
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":167
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ierr = g2_unpack1(cgrib, &iofst, &ids, &idslen)             # <<<<<<<<<<<<<<
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 1 - error code = %i" % ierr
+ */
+  __pyx_v_ierr = g2_unpack1(__pyx_v_cgrib, (&__pyx_v_iofst), (&__pyx_v_ids), (&__pyx_v_idslen));
+
+  /* "g2clib.pyx":168
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ierr = g2_unpack1(cgrib, &iofst, &ids, &idslen)
+ *     if ierr != 0:             # <<<<<<<<<<<<<<
+ *        msg = "Error unpacking section 1 - error code = %i" % ierr
+ *        raise RuntimeError(msg)
+ */
+  __pyx_t_2 = (__pyx_v_ierr != 0);
+  if (__pyx_t_2) {
+
+    /* "g2clib.pyx":169
+ *     ierr = g2_unpack1(cgrib, &iofst, &ids, &idslen)
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 1 - error code = %i" % ierr             # <<<<<<<<<<<<<<
+ *        raise RuntimeError(msg)
+ * 
+ */
+    __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ierr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_msg = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
+
+    /* "g2clib.pyx":170
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 1 - error code = %i" % ierr
+ *        raise RuntimeError(msg)             # <<<<<<<<<<<<<<
+ * 
+ *     idsect = _toarray(ids, zeros(idslen, 'i4'))
+ */
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __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_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(((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 = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
+
+  /* "g2clib.pyx":172
+ *        raise RuntimeError(msg)
+ * 
+ *     idsect = _toarray(ids, zeros(idslen, 'i4'))             # <<<<<<<<<<<<<<
+ *     return idsect,iofst/8
+ * 
+ */
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_idslen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__i4));
+  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__i4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i4));
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_v_zeros, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_3 = __pyx_f_6g2clib__toarray(__pyx_v_ids, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_idsect = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "g2clib.pyx":173
+ * 
+ *     idsect = _toarray(ids, zeros(idslen, 'i4'))
+ *     return idsect,iofst/8             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_3 = PyInt_FromLong(__Pyx_div_long(__pyx_v_iofst, 8)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_INCREF(__pyx_v_idsect);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_idsect);
+  __Pyx_GIVEREF(__pyx_v_idsect);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_3 = 0;
+  __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_3);
+  __Pyx_AddTraceback("g2clib.unpack1", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_msg);
+  __Pyx_XDECREF(__pyx_v_idsect);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6g2clib_7unpack3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6g2clib_6unpack3[] = "\n Unpacks Section 3 (Grid Definition Section) as defined in GRIB Edition 2.\n\n gds,gdtmpl,deflist,ipos = unpack3(gribmsg,ipos)\n \n INPUTS:\n cgrib    - Char array ontaining Section 3 of the GRIB2 message\n iofst    - Byte offset for the beginning of Section 3 in cgrib.\n zeros    - Numeric/numpy array/scip.base zeros function (used to allocate\n            output python arrays).  Python is used to allocate the arrays\n            so no imple [...]
+static PyMethodDef __pyx_mdef_6g2clib_7unpack3 = {__Pyx_NAMESTR("unpack3"), (PyCFunction)__pyx_pw_6g2clib_7unpack3, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6g2clib_6unpack3)};
+static PyObject *__pyx_pw_6g2clib_7unpack3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_gribmsg = 0;
+  PyObject *__pyx_v_ipos = 0;
+  PyObject *__pyx_v_zeros = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("unpack3 (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__gribmsg,&__pyx_n_s__ipos,&__pyx_n_s__zeros,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__gribmsg)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ipos)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack3", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__zeros)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack3", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unpack3") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __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_gribmsg = values[0];
+    __pyx_v_ipos = values[1];
+    __pyx_v_zeros = values[2];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("unpack3", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("g2clib.unpack3", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6g2clib_6unpack3(__pyx_self, __pyx_v_gribmsg, __pyx_v_ipos, __pyx_v_zeros);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "g2clib.pyx":177
+ * 
+ * 
+ * def unpack3(gribmsg, ipos, object zeros):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 3 (Grid Definition Section) as defined in GRIB Edition 2.
+ */
+
+static PyObject *__pyx_pf_6g2clib_6unpack3(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_ipos, PyObject *__pyx_v_zeros) {
+  unsigned char *__pyx_v_cgrib;
+  g2int *__pyx_v_igds;
+  g2int *__pyx_v_igdstmpl;
+  g2int *__pyx_v_ideflist;
+  g2int __pyx_v_mapgridlen;
+  g2int __pyx_v_iofst;
+  g2int __pyx_v_idefnum;
+  g2int __pyx_v_ierr;
+  PyObject *__pyx_v_msg = NULL;
+  PyObject *__pyx_v_gdtmpl = NULL;
+  PyObject *__pyx_v_gds = NULL;
+  PyObject *__pyx_v_deflist = NULL;
+  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("unpack3", 0);
+
+  /* "g2clib.pyx":224
+ *     cdef g2int *igds, *igdstmpl, *ideflist
+ *     cdef g2int mapgridlen, iofst, idefnum, ierr
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)             # <<<<<<<<<<<<<<
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ierr=g2_unpack3(cgrib,&iofst,&igds,&igdstmpl,&mapgridlen,&ideflist,&idefnum)
+ */
+  __pyx_v_cgrib = ((unsigned char *)PyBytes_AsString(__pyx_v_gribmsg));
+
+  /* "g2clib.pyx":225
+ *     cdef g2int mapgridlen, iofst, idefnum, ierr
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)             # <<<<<<<<<<<<<<
+ *     ierr=g2_unpack3(cgrib,&iofst,&igds,&igdstmpl,&mapgridlen,&ideflist,&idefnum)
+ *     if ierr != 0:
+ */
+  __pyx_t_1 = PyNumber_Multiply(__pyx_v_ipos, __pyx_int_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_v_iofst = ((g2int)PyInt_AsLong(__pyx_t_1));
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":226
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ierr=g2_unpack3(cgrib,&iofst,&igds,&igdstmpl,&mapgridlen,&ideflist,&idefnum)             # <<<<<<<<<<<<<<
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 3 - error code = %i" % ierr
+ */
+  __pyx_v_ierr = g2_unpack3(__pyx_v_cgrib, (&__pyx_v_iofst), (&__pyx_v_igds), (&__pyx_v_igdstmpl), (&__pyx_v_mapgridlen), (&__pyx_v_ideflist), (&__pyx_v_idefnum));
+
+  /* "g2clib.pyx":227
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ierr=g2_unpack3(cgrib,&iofst,&igds,&igdstmpl,&mapgridlen,&ideflist,&idefnum)
+ *     if ierr != 0:             # <<<<<<<<<<<<<<
+ *        msg = "Error unpacking section 3 - error code = %i" % ierr
+ *        raise RuntimeError(msg)
+ */
+  __pyx_t_2 = (__pyx_v_ierr != 0);
+  if (__pyx_t_2) {
+
+    /* "g2clib.pyx":228
+ *     ierr=g2_unpack3(cgrib,&iofst,&igds,&igdstmpl,&mapgridlen,&ideflist,&idefnum)
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 3 - error code = %i" % ierr             # <<<<<<<<<<<<<<
+ *        raise RuntimeError(msg)
+ * 
+ */
+    __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ierr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_msg = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
+
+    /* "g2clib.pyx":229
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 3 - error code = %i" % ierr
+ *        raise RuntimeError(msg)             # <<<<<<<<<<<<<<
+ * 
+ *     gdtmpl = _toarray(igdstmpl, zeros(mapgridlen, 'i4'))
+ */
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_INCREF(__pyx_v_msg);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_msg);
+    __Pyx_GIVEREF(__pyx_v_msg);
+    __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 = 229; __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 = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
+
+  /* "g2clib.pyx":231
+ *        raise RuntimeError(msg)
+ * 
+ *     gdtmpl = _toarray(igdstmpl, zeros(mapgridlen, 'i4'))             # <<<<<<<<<<<<<<
+ *     gds = _toarray(igds, zeros(5, 'i4'))
+ *     deflist = _toarray(ideflist, zeros(idefnum, 'i4'))
+ */
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_mapgridlen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __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 = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__i4));
+  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__i4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i4));
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_v_zeros, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_3 = __pyx_f_6g2clib__toarray(__pyx_v_igdstmpl, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_gdtmpl = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "g2clib.pyx":232
+ * 
+ *     gdtmpl = _toarray(igdstmpl, zeros(mapgridlen, 'i4'))
+ *     gds = _toarray(igds, zeros(5, 'i4'))             # <<<<<<<<<<<<<<
+ *     deflist = _toarray(ideflist, zeros(idefnum, 'i4'))
+ * 
+ */
+  __pyx_t_3 = PyObject_Call(__pyx_v_zeros, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = __pyx_f_6g2clib__toarray(__pyx_v_igds, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_v_gds = __pyx_t_1;
+  __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":233
+ *     gdtmpl = _toarray(igdstmpl, zeros(mapgridlen, 'i4'))
+ *     gds = _toarray(igds, zeros(5, 'i4'))
+ *     deflist = _toarray(ideflist, zeros(idefnum, 'i4'))             # <<<<<<<<<<<<<<
+ * 
+ *     return gds,gdtmpl,deflist,iofst/8
+ */
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_idefnum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __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 = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__i4));
+  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__i4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i4));
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_v_zeros, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_3 = __pyx_f_6g2clib__toarray(__pyx_v_ideflist, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_deflist = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "g2clib.pyx":235
+ *     deflist = _toarray(ideflist, zeros(idefnum, 'i4'))
+ * 
+ *     return gds,gdtmpl,deflist,iofst/8             # <<<<<<<<<<<<<<
+ * 
+ * def unpack4(gribmsg,ipos,object zeros):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_3 = PyInt_FromLong(__Pyx_div_long(__pyx_v_iofst, 8)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_INCREF(__pyx_v_gds);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_gds);
+  __Pyx_GIVEREF(__pyx_v_gds);
+  __Pyx_INCREF(__pyx_v_gdtmpl);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_gdtmpl);
+  __Pyx_GIVEREF(__pyx_v_gdtmpl);
+  __Pyx_INCREF(__pyx_v_deflist);
+  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_deflist);
+  __Pyx_GIVEREF(__pyx_v_deflist);
+  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_3 = 0;
+  __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_3);
+  __Pyx_AddTraceback("g2clib.unpack3", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_msg);
+  __Pyx_XDECREF(__pyx_v_gdtmpl);
+  __Pyx_XDECREF(__pyx_v_gds);
+  __Pyx_XDECREF(__pyx_v_deflist);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6g2clib_9unpack4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6g2clib_8unpack4[] = "\n Unpacks Section 4 (Product Definition Section) as defined in GRIB Edition 2.\n\n pdtmpl,pdtnum,coordlist,ipos = unpack4(gribmsg,ipos)\n \n INPUTS:\n   gribmsg  - Character string containing Section 4 of the GRIB2 message\n   ipos     - Byte offset of the beginning of Section 4 in cgrib.\n   zeros    - Numeric/numpy array/scip.base zeros function (used to allocate\n              output python arrays).  Python is used to allocate the arrays\n  [...]
+static PyMethodDef __pyx_mdef_6g2clib_9unpack4 = {__Pyx_NAMESTR("unpack4"), (PyCFunction)__pyx_pw_6g2clib_9unpack4, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6g2clib_8unpack4)};
+static PyObject *__pyx_pw_6g2clib_9unpack4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_gribmsg = 0;
+  PyObject *__pyx_v_ipos = 0;
+  PyObject *__pyx_v_zeros = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("unpack4 (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__gribmsg,&__pyx_n_s__ipos,&__pyx_n_s__zeros,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__gribmsg)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ipos)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack4", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__zeros)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack4", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unpack4") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __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_gribmsg = values[0];
+    __pyx_v_ipos = values[1];
+    __pyx_v_zeros = values[2];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("unpack4", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("g2clib.unpack4", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6g2clib_8unpack4(__pyx_self, __pyx_v_gribmsg, __pyx_v_ipos, __pyx_v_zeros);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "g2clib.pyx":237
+ *     return gds,gdtmpl,deflist,iofst/8
+ * 
+ * def unpack4(gribmsg,ipos,object zeros):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 4 (Product Definition Section) as defined in GRIB Edition 2.
+ */
+
+static PyObject *__pyx_pf_6g2clib_8unpack4(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_ipos, PyObject *__pyx_v_zeros) {
+  unsigned char *__pyx_v_cgrib;
+  g2int *__pyx_v_ipdstmpl;
+  g2float *__pyx_v_icoordlist;
+  g2int __pyx_v_mappdslen;
+  g2int __pyx_v_iofst;
+  g2int __pyx_v_ipdsnum;
+  g2int __pyx_v_ierr;
+  g2int __pyx_v_numcoord;
+  PyObject *__pyx_v_msg = NULL;
+  PyObject *__pyx_v_pdtmpl = NULL;
+  PyObject *__pyx_v_coordlist = 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;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("unpack4", 0);
+
+  /* "g2clib.pyx":275
+ *     cdef g2float *icoordlist
+ *     cdef g2int mappdslen, iofst, ipdsnum, ierr, numcoord
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)             # <<<<<<<<<<<<<<
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ierr=g2_unpack4(cgrib,&iofst,&ipdsnum,&ipdstmpl,&mappdslen,&icoordlist,&numcoord)
+ */
+  __pyx_v_cgrib = ((unsigned char *)PyBytes_AsString(__pyx_v_gribmsg));
+
+  /* "g2clib.pyx":276
+ *     cdef g2int mappdslen, iofst, ipdsnum, ierr, numcoord
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)             # <<<<<<<<<<<<<<
+ *     ierr=g2_unpack4(cgrib,&iofst,&ipdsnum,&ipdstmpl,&mappdslen,&icoordlist,&numcoord)
+ *     if ierr != 0:
+ */
+  __pyx_t_1 = PyNumber_Multiply(__pyx_v_ipos, __pyx_int_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_v_iofst = ((g2int)PyInt_AsLong(__pyx_t_1));
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":277
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ierr=g2_unpack4(cgrib,&iofst,&ipdsnum,&ipdstmpl,&mappdslen,&icoordlist,&numcoord)             # <<<<<<<<<<<<<<
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 4 - error code = %i" % ierr
+ */
+  __pyx_v_ierr = g2_unpack4(__pyx_v_cgrib, (&__pyx_v_iofst), (&__pyx_v_ipdsnum), (&__pyx_v_ipdstmpl), (&__pyx_v_mappdslen), (&__pyx_v_icoordlist), (&__pyx_v_numcoord));
+
+  /* "g2clib.pyx":278
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ierr=g2_unpack4(cgrib,&iofst,&ipdsnum,&ipdstmpl,&mappdslen,&icoordlist,&numcoord)
+ *     if ierr != 0:             # <<<<<<<<<<<<<<
+ *        msg = "Error unpacking section 4 - error code = %i" % ierr
+ *        raise RuntimeError(msg)
+ */
+  __pyx_t_2 = (__pyx_v_ierr != 0);
+  if (__pyx_t_2) {
+
+    /* "g2clib.pyx":279
+ *     ierr=g2_unpack4(cgrib,&iofst,&ipdsnum,&ipdstmpl,&mappdslen,&icoordlist,&numcoord)
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 4 - error code = %i" % ierr             # <<<<<<<<<<<<<<
+ *        raise RuntimeError(msg)
+ * 
+ */
+    __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ierr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_msg = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
+
+    /* "g2clib.pyx":280
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 4 - error code = %i" % ierr
+ *        raise RuntimeError(msg)             # <<<<<<<<<<<<<<
+ * 
+ *     pdtmpl = _toarray(ipdstmpl, zeros(mappdslen, 'i4'))
+ */
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __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_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __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 = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
+
+  /* "g2clib.pyx":282
+ *        raise RuntimeError(msg)
+ * 
+ *     pdtmpl = _toarray(ipdstmpl, zeros(mappdslen, 'i4'))             # <<<<<<<<<<<<<<
+ *     coordlist = _toarray(icoordlist, zeros(numcoord, 'f4'))
+ * 
+ */
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_mappdslen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __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 = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__i4));
+  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__i4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i4));
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_v_zeros, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_3 = __pyx_f_6g2clib__toarray(__pyx_v_ipdstmpl, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_pdtmpl = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "g2clib.pyx":283
+ * 
+ *     pdtmpl = _toarray(ipdstmpl, zeros(mappdslen, 'i4'))
+ *     coordlist = _toarray(icoordlist, zeros(numcoord, 'f4'))             # <<<<<<<<<<<<<<
+ * 
+ *     return pdtmpl,ipdsnum,coordlist,iofst/8
+ */
+  __pyx_t_3 = __Pyx_PyInt_to_py_int32_t(__pyx_v_numcoord); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__f4));
+  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__f4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__f4));
+  __pyx_t_3 = 0;
+  __pyx_t_3 = PyObject_Call(__pyx_v_zeros, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __pyx_t_1 = __pyx_f_6g2clib__toarray(__pyx_v_icoordlist, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_v_coordlist = __pyx_t_1;
+  __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":285
+ *     coordlist = _toarray(icoordlist, zeros(numcoord, 'f4'))
+ * 
+ *     return pdtmpl,ipdsnum,coordlist,iofst/8             # <<<<<<<<<<<<<<
+ * 
+ * def unpack5(gribmsg,ipos,object zeros):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ipdsnum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = PyInt_FromLong(__Pyx_div_long(__pyx_v_iofst, 8)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_INCREF(__pyx_v_pdtmpl);
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_pdtmpl);
+  __Pyx_GIVEREF(__pyx_v_pdtmpl);
+  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __Pyx_INCREF(__pyx_v_coordlist);
+  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_coordlist);
+  __Pyx_GIVEREF(__pyx_v_coordlist);
+  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_1 = 0;
+  __pyx_t_3 = 0;
+  __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_1);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_AddTraceback("g2clib.unpack4", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_msg);
+  __Pyx_XDECREF(__pyx_v_pdtmpl);
+  __Pyx_XDECREF(__pyx_v_coordlist);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6g2clib_11unpack5(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6g2clib_10unpack5[] = "\n Unpacks Section 5 (Data Representation Section) as defined in GRIB Edition 2.\n\n drtmpl,drtnum,ndpts,ipos = unpack5(gribmsg,ipos)\n\n INPUTS:\n   gribmsg  - Character string containing Section 5 of the GRIB2 message\n   ipos     - Byte offset for the beginning of Section 5 in cgrib.\n   zeros   - Numeric/numpy array/scip.base zeros function (used to allocate\n             output python arrays).  Python is used to allocate the arrays\n      [...]
+static PyMethodDef __pyx_mdef_6g2clib_11unpack5 = {__Pyx_NAMESTR("unpack5"), (PyCFunction)__pyx_pw_6g2clib_11unpack5, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6g2clib_10unpack5)};
+static PyObject *__pyx_pw_6g2clib_11unpack5(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_gribmsg = 0;
+  PyObject *__pyx_v_ipos = 0;
+  PyObject *__pyx_v_zeros = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("unpack5 (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__gribmsg,&__pyx_n_s__ipos,&__pyx_n_s__zeros,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__gribmsg)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ipos)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack5", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__zeros)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack5", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unpack5") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __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_gribmsg = values[0];
+    __pyx_v_ipos = values[1];
+    __pyx_v_zeros = values[2];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("unpack5", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("g2clib.unpack5", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6g2clib_10unpack5(__pyx_self, __pyx_v_gribmsg, __pyx_v_ipos, __pyx_v_zeros);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "g2clib.pyx":287
+ *     return pdtmpl,ipdsnum,coordlist,iofst/8
+ * 
+ * def unpack5(gribmsg,ipos,object zeros):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 5 (Data Representation Section) as defined in GRIB Edition 2.
+ */
+
+static PyObject *__pyx_pf_6g2clib_10unpack5(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_ipos, PyObject *__pyx_v_zeros) {
+  unsigned char *__pyx_v_cgrib;
+  g2int *__pyx_v_idrstmpl;
+  g2int __pyx_v_iofst;
+  g2int __pyx_v_ierr;
+  g2int __pyx_v_ndpts;
+  g2int __pyx_v_idrsnum;
+  g2int __pyx_v_mapdrslen;
+  PyObject *__pyx_v_msg = NULL;
+  PyObject *__pyx_v_drtmpl = 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;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("unpack5", 0);
+
+  /* "g2clib.pyx":321
+ *     cdef g2int *idrstmpl
+ *     cdef g2int iofst, ierr, ndpts, idrsnum, mapdrslen
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)             # <<<<<<<<<<<<<<
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ierr=g2_unpack5(cgrib,&iofst,&ndpts,&idrsnum,&idrstmpl,&mapdrslen)
+ */
+  __pyx_v_cgrib = ((unsigned char *)PyBytes_AsString(__pyx_v_gribmsg));
+
+  /* "g2clib.pyx":322
+ *     cdef g2int iofst, ierr, ndpts, idrsnum, mapdrslen
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)             # <<<<<<<<<<<<<<
+ *     ierr=g2_unpack5(cgrib,&iofst,&ndpts,&idrsnum,&idrstmpl,&mapdrslen)
+ *     if ierr != 0:
+ */
+  __pyx_t_1 = PyNumber_Multiply(__pyx_v_ipos, __pyx_int_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_v_iofst = ((g2int)PyInt_AsLong(__pyx_t_1));
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":323
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ierr=g2_unpack5(cgrib,&iofst,&ndpts,&idrsnum,&idrstmpl,&mapdrslen)             # <<<<<<<<<<<<<<
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 5 - error code = %i" % ierr
+ */
+  __pyx_v_ierr = g2_unpack5(__pyx_v_cgrib, (&__pyx_v_iofst), (&__pyx_v_ndpts), (&__pyx_v_idrsnum), (&__pyx_v_idrstmpl), (&__pyx_v_mapdrslen));
+
+  /* "g2clib.pyx":324
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ierr=g2_unpack5(cgrib,&iofst,&ndpts,&idrsnum,&idrstmpl,&mapdrslen)
+ *     if ierr != 0:             # <<<<<<<<<<<<<<
+ *        msg = "Error unpacking section 5 - error code = %i" % ierr
+ *        raise RuntimeError(msg)
+ */
+  __pyx_t_2 = (__pyx_v_ierr != 0);
+  if (__pyx_t_2) {
+
+    /* "g2clib.pyx":325
+ *     ierr=g2_unpack5(cgrib,&iofst,&ndpts,&idrsnum,&idrstmpl,&mapdrslen)
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 5 - error code = %i" % ierr             # <<<<<<<<<<<<<<
+ *        raise RuntimeError(msg)
+ * 
+ */
+    __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ierr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_msg = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
+
+    /* "g2clib.pyx":326
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 5 - error code = %i" % ierr
+ *        raise RuntimeError(msg)             # <<<<<<<<<<<<<<
+ * 
+ *     drtmpl = _toarray(idrstmpl, zeros(mapdrslen, 'i4'))
+ */
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __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_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __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 = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
+
+  /* "g2clib.pyx":328
+ *        raise RuntimeError(msg)
+ * 
+ *     drtmpl = _toarray(idrstmpl, zeros(mapdrslen, 'i4'))             # <<<<<<<<<<<<<<
+ *     return drtmpl,idrsnum,ndpts,iofst/8
+ * 
+ */
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_mapdrslen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __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 = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__i4));
+  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__i4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i4));
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyObject_Call(__pyx_v_zeros, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __pyx_t_3 = __pyx_f_6g2clib__toarray(__pyx_v_idrstmpl, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_v_drtmpl = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "g2clib.pyx":329
+ * 
+ *     drtmpl = _toarray(idrstmpl, zeros(mapdrslen, 'i4'))
+ *     return drtmpl,idrsnum,ndpts,iofst/8             # <<<<<<<<<<<<<<
+ * 
+ * def unpack6(gribmsg,ndpts,ipos,object zeros):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_3 = __Pyx_PyInt_to_py_int32_t(__pyx_v_idrsnum); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ndpts); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_4 = PyInt_FromLong(__Pyx_div_long(__pyx_v_iofst, 8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_INCREF(__pyx_v_drtmpl);
+  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_drtmpl);
+  __Pyx_GIVEREF(__pyx_v_drtmpl);
+  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
+  __Pyx_GIVEREF(__pyx_t_4);
+  __pyx_t_3 = 0;
+  __pyx_t_1 = 0;
+  __pyx_t_4 = 0;
+  __pyx_r = ((PyObject *)__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_1);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_AddTraceback("g2clib.unpack5", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_msg);
+  __Pyx_XDECREF(__pyx_v_drtmpl);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6g2clib_13unpack6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6g2clib_12unpack6[] = "\n Unpacks Section 6 (Bit-Map Section) as defined in GRIB Edition 2.\n\n bitmap = unpack6(gribmsg,ndpts,ipos)         \n\n INPUTS:\n   gribmsg  - String containing Section 6 of the GRIB2 message\n   ndpts    - Number of grid points specified in the bit-map (from\n              gds[1] returned by unpack3).\n   ipos     - Byte offset of the beginning of Section 6 in cgrib.\n   zeros   - Numeric/numpy array/scip.base zeros function (used to alloc [...]
+static PyMethodDef __pyx_mdef_6g2clib_13unpack6 = {__Pyx_NAMESTR("unpack6"), (PyCFunction)__pyx_pw_6g2clib_13unpack6, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6g2clib_12unpack6)};
+static PyObject *__pyx_pw_6g2clib_13unpack6(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_gribmsg = 0;
+  PyObject *__pyx_v_ndpts = 0;
+  PyObject *__pyx_v_ipos = 0;
+  PyObject *__pyx_v_zeros = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("unpack6 (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__gribmsg,&__pyx_n_s__ndpts,&__pyx_n_s__ipos,&__pyx_n_s__zeros,0};
+    PyObject* values[4] = {0,0,0,0};
+    if (unlikely(__pyx_kwds)) {
+      Py_ssize_t kw_args;
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
+        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        case  0: break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+      kw_args = PyDict_Size(__pyx_kwds);
+      switch (pos_args) {
+        case  0:
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gribmsg)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ndpts)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack6", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ipos)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack6", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  3:
+        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__zeros)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack6", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unpack6") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
+      goto __pyx_L5_argtuple_error;
+    } else {
+      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+    }
+    __pyx_v_gribmsg = values[0];
+    __pyx_v_ndpts = values[1];
+    __pyx_v_ipos = values[2];
+    __pyx_v_zeros = values[3];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("unpack6", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("g2clib.unpack6", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6g2clib_12unpack6(__pyx_self, __pyx_v_gribmsg, __pyx_v_ndpts, __pyx_v_ipos, __pyx_v_zeros);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "g2clib.pyx":331
+ *     return drtmpl,idrsnum,ndpts,iofst/8
+ * 
+ * def unpack6(gribmsg,ndpts,ipos,object zeros):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 6 (Bit-Map Section) as defined in GRIB Edition 2.
+ */
+
+static PyObject *__pyx_pf_6g2clib_12unpack6(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_ndpts, PyObject *__pyx_v_ipos, PyObject *__pyx_v_zeros) {
+  PyObject *__pyx_v_bitmap = 0;
+  unsigned char *__pyx_v_cgrib;
+  g2int __pyx_v_iofst;
+  g2int __pyx_v_ierr;
+  g2int __pyx_v_ngpts;
+  g2int __pyx_v_ibmap;
+  g2int *__pyx_v_bmap;
+  PyObject *__pyx_v_msg = NULL;
+  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("unpack6", 0);
+
+  /* "g2clib.pyx":363
+ *     cdef g2int iofst, ierr, ngpts, ibmap
+ *     cdef g2int *bmap
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)             # <<<<<<<<<<<<<<
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ngpts = <g2int>PyInt_AsLong(ndpts)
+ */
+  __pyx_v_cgrib = ((unsigned char *)PyBytes_AsString(__pyx_v_gribmsg));
+
+  /* "g2clib.pyx":364
+ *     cdef g2int *bmap
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)             # <<<<<<<<<<<<<<
+ *     ngpts = <g2int>PyInt_AsLong(ndpts)
+ *     ierr=g2_unpack6(cgrib,&iofst,ngpts,&ibmap,&bmap)
+ */
+  __pyx_t_1 = PyNumber_Multiply(__pyx_v_ipos, __pyx_int_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_v_iofst = ((g2int)PyInt_AsLong(__pyx_t_1));
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":365
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ngpts = <g2int>PyInt_AsLong(ndpts)             # <<<<<<<<<<<<<<
+ *     ierr=g2_unpack6(cgrib,&iofst,ngpts,&ibmap,&bmap)
+ *     if ierr != 0:
+ */
+  __pyx_v_ngpts = ((g2int)PyInt_AsLong(__pyx_v_ndpts));
+
+  /* "g2clib.pyx":366
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ngpts = <g2int>PyInt_AsLong(ndpts)
+ *     ierr=g2_unpack6(cgrib,&iofst,ngpts,&ibmap,&bmap)             # <<<<<<<<<<<<<<
+ *     if ierr != 0:
+ *         msg = "Error unpacking section 6 - error code = %i" % ierr
+ */
+  __pyx_v_ierr = g2_unpack6(__pyx_v_cgrib, (&__pyx_v_iofst), __pyx_v_ngpts, (&__pyx_v_ibmap), (&__pyx_v_bmap));
+
+  /* "g2clib.pyx":367
+ *     ngpts = <g2int>PyInt_AsLong(ndpts)
+ *     ierr=g2_unpack6(cgrib,&iofst,ngpts,&ibmap,&bmap)
+ *     if ierr != 0:             # <<<<<<<<<<<<<<
+ *         msg = "Error unpacking section 6 - error code = %i" % ierr
+ *         raise RuntimeError(msg)
+ */
+  __pyx_t_2 = (__pyx_v_ierr != 0);
+  if (__pyx_t_2) {
+
+    /* "g2clib.pyx":368
+ *     ierr=g2_unpack6(cgrib,&iofst,ngpts,&ibmap,&bmap)
+ *     if ierr != 0:
+ *         msg = "Error unpacking section 6 - error code = %i" % ierr             # <<<<<<<<<<<<<<
+ *         raise RuntimeError(msg)
+ *     if ibmap == 0:
+ */
+    __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ierr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_msg = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
+
+    /* "g2clib.pyx":369
+ *     if ierr != 0:
+ *         msg = "Error unpacking section 6 - error code = %i" % ierr
+ *         raise RuntimeError(msg)             # <<<<<<<<<<<<<<
+ *     if ibmap == 0:
+ *         bitmap = _toarray(bmap, zeros(ngpts, 'i4'))
+ */
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __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_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __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 = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
+
+  /* "g2clib.pyx":370
+ *         msg = "Error unpacking section 6 - error code = %i" % ierr
+ *         raise RuntimeError(msg)
+ *     if ibmap == 0:             # <<<<<<<<<<<<<<
+ *         bitmap = _toarray(bmap, zeros(ngpts, 'i4'))
+ *     else:
+ */
+  __pyx_t_2 = (__pyx_v_ibmap == 0);
+  if (__pyx_t_2) {
+
+    /* "g2clib.pyx":371
+ *         raise RuntimeError(msg)
+ *     if ibmap == 0:
+ *         bitmap = _toarray(bmap, zeros(ngpts, 'i4'))             # <<<<<<<<<<<<<<
+ *     else:
+ *         bitmap = None
+ */
+    __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ngpts); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __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 = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
+    __Pyx_GIVEREF(__pyx_t_1);
+    __Pyx_INCREF(((PyObject *)__pyx_n_s__i4));
+    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__i4));
+    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i4));
+    __pyx_t_1 = 0;
+    __pyx_t_1 = PyObject_Call(__pyx_v_zeros, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+    __pyx_t_3 = __pyx_f_6g2clib__toarray(__pyx_v_bmap, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_bitmap = __pyx_t_3;
+    __pyx_t_3 = 0;
+    goto __pyx_L4;
+  }
+  /*else*/ {
+
+    /* "g2clib.pyx":373
+ *         bitmap = _toarray(bmap, zeros(ngpts, 'i4'))
+ *     else:
+ *         bitmap = None             # <<<<<<<<<<<<<<
+ *         free(bmap)
+ *     return bitmap,ibmap
+ */
+    __Pyx_INCREF(Py_None);
+    __pyx_v_bitmap = Py_None;
+
+    /* "g2clib.pyx":374
+ *     else:
+ *         bitmap = None
+ *         free(bmap)             # <<<<<<<<<<<<<<
+ *     return bitmap,ibmap
+ * 
+ */
+    free(__pyx_v_bmap);
+  }
+  __pyx_L4:;
+
+  /* "g2clib.pyx":375
+ *         bitmap = None
+ *         free(bmap)
+ *     return bitmap,ibmap             # <<<<<<<<<<<<<<
+ * 
+ * def unpack7(gribmsg,gdtnum,object gdtmpl,drtnum,object drtmpl,ndpts,ipos,object zeros,printminmax=False,storageorder='C'):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_3 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ibmap); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_INCREF(__pyx_v_bitmap);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bitmap);
+  __Pyx_GIVEREF(__pyx_v_bitmap);
+  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_3 = 0;
+  __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_3);
+  __Pyx_AddTraceback("g2clib.unpack6", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_bitmap);
+  __Pyx_XDECREF(__pyx_v_msg);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6g2clib_15unpack7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6g2clib_14unpack7[] = "\n Unpacks Section 7 (Data Section) as defined in GRIB Edition 2.\n\n fld,fldmin,fldmax = unpack7(gribmsg,gdtnum,gdtmpl,drtnum,drtmpl,ndpts,ipos)\n INPUTS:\n   gribmsg  - String containing Section 7 of the GRIB2 message\n   gdtnum   - Grid Definition Template Number ( see Code Table 3.0)\n              ( Only used for DRS Template 5.51 )\n   gdtmpl   - numpy array containing the data values for\n              the specified Grid Definition\n    [...]
+static PyMethodDef __pyx_mdef_6g2clib_15unpack7 = {__Pyx_NAMESTR("unpack7"), (PyCFunction)__pyx_pw_6g2clib_15unpack7, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6g2clib_14unpack7)};
+static PyObject *__pyx_pw_6g2clib_15unpack7(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_gribmsg = 0;
+  PyObject *__pyx_v_gdtnum = 0;
+  PyObject *__pyx_v_gdtmpl = 0;
+  PyObject *__pyx_v_drtnum = 0;
+  PyObject *__pyx_v_drtmpl = 0;
+  PyObject *__pyx_v_ndpts = 0;
+  PyObject *__pyx_v_ipos = 0;
+  PyObject *__pyx_v_zeros = 0;
+  PyObject *__pyx_v_printminmax = 0;
+  PyObject *__pyx_v_storageorder = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("unpack7 (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__gribmsg,&__pyx_n_s__gdtnum,&__pyx_n_s__gdtmpl,&__pyx_n_s__drtnum,&__pyx_n_s__drtmpl,&__pyx_n_s__ndpts,&__pyx_n_s__ipos,&__pyx_n_s__zeros,&__pyx_n_s__printminmax,&__pyx_n_s__storageorder,0};
+    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
+    values[8] = __pyx_k_14;
+    values[9] = ((PyObject *)__pyx_n_s__C);
+    if (unlikely(__pyx_kwds)) {
+      Py_ssize_t kw_args;
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
+        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
+        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
+        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
+        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
+        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        case  0: break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+      kw_args = PyDict_Size(__pyx_kwds);
+      switch (pos_args) {
+        case  0:
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gribmsg)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gdtnum)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack7", 0, 8, 10, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gdtmpl)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack7", 0, 8, 10, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  3:
+        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__drtnum)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack7", 0, 8, 10, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  4:
+        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__drtmpl)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack7", 0, 8, 10, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  5:
+        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ndpts)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack7", 0, 8, 10, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  6:
+        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ipos)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack7", 0, 8, 10, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  7:
+        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__zeros)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("unpack7", 0, 8, 10, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  8:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__printminmax);
+          if (value) { values[8] = value; kw_args--; }
+        }
+        case  9:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__storageorder);
+          if (value) { values[9] = value; kw_args--; }
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "unpack7") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    } else {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
+        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
+        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
+        values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
+        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
+        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+    }
+    __pyx_v_gribmsg = values[0];
+    __pyx_v_gdtnum = values[1];
+    __pyx_v_gdtmpl = values[2];
+    __pyx_v_drtnum = values[3];
+    __pyx_v_drtmpl = values[4];
+    __pyx_v_ndpts = values[5];
+    __pyx_v_ipos = values[6];
+    __pyx_v_zeros = values[7];
+    __pyx_v_printminmax = values[8];
+    __pyx_v_storageorder = values[9];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("unpack7", 0, 8, 10, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("g2clib.unpack7", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6g2clib_14unpack7(__pyx_self, __pyx_v_gribmsg, __pyx_v_gdtnum, __pyx_v_gdtmpl, __pyx_v_drtnum, __pyx_v_drtmpl, __pyx_v_ndpts, __pyx_v_ipos, __pyx_v_zeros, __pyx_v_printminmax, __pyx_v_storageorder);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "g2clib.pyx":377
+ *     return bitmap,ibmap
+ * 
+ * def unpack7(gribmsg,gdtnum,object gdtmpl,drtnum,object drtmpl,ndpts,ipos,object zeros,printminmax=False,storageorder='C'):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 7 (Data Section) as defined in GRIB Edition 2.
+ */
+
+static PyObject *__pyx_pf_6g2clib_14unpack7(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_gdtnum, PyObject *__pyx_v_gdtmpl, PyObject *__pyx_v_drtnum, PyObject *__pyx_v_drtmpl, PyObject *__pyx_v_ndpts, PyObject *__pyx_v_ipos, PyObject *__pyx_v_zeros, PyObject *__pyx_v_printminmax, PyObject *__pyx_v_storageorder) {
+  unsigned char *__pyx_v_cgrib;
+  g2int __pyx_v_iofst;
+  g2int __pyx_v_ierr;
+  g2int __pyx_v_ngpts;
+  g2int __pyx_v_idrsnum;
+  g2int __pyx_v_igdsnum;
+  g2int *__pyx_v_igdstmpl;
+  g2int *__pyx_v_idrstmpl;
+  g2float *__pyx_v_fld;
+  void *__pyx_v_drtmpldat;
+  void *__pyx_v_gdtmpldat;
+  float __pyx_v_rmin;
+  float __pyx_v_rmax;
+  int __pyx_v_n;
+  Py_ssize_t __pyx_v_buflen;
+  PyObject *__pyx_v_msg = NULL;
+  PyObject *__pyx_v_fldmax = NULL;
+  PyObject *__pyx_v_fldmin = NULL;
+  PyObject *__pyx_v_bitsofprecision = NULL;
+  PyObject *__pyx_v_digitsofprecision = NULL;
+  PyObject *__pyx_v_format = NULL;
+  PyObject *__pyx_v_minmaxstring = NULL;
+  PyObject *__pyx_v_data = NULL;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_4;
+  PyObject *__pyx_t_5 = NULL;
+  PyObject *__pyx_t_6 = NULL;
+  PyObject *__pyx_t_7 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("unpack7", 0);
+
+  /* "g2clib.pyx":425
+ *     cdef int n
+ *     cdef Py_ssize_t buflen
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)             # <<<<<<<<<<<<<<
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ngpts = <g2int>PyInt_AsLong(ndpts)
+ */
+  __pyx_v_cgrib = ((unsigned char *)PyBytes_AsString(__pyx_v_gribmsg));
+
+  /* "g2clib.pyx":426
+ *     cdef Py_ssize_t buflen
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)             # <<<<<<<<<<<<<<
+ *     ngpts = <g2int>PyInt_AsLong(ndpts)
+ *     idrsnum = <g2int>PyInt_AsLong(drtnum)
+ */
+  __pyx_t_1 = PyNumber_Multiply(__pyx_v_ipos, __pyx_int_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_v_iofst = ((g2int)PyInt_AsLong(__pyx_t_1));
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":427
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ngpts = <g2int>PyInt_AsLong(ndpts)             # <<<<<<<<<<<<<<
+ *     idrsnum = <g2int>PyInt_AsLong(drtnum)
+ *     igdsnum = <g2int>PyInt_AsLong(gdtnum)
+ */
+  __pyx_v_ngpts = ((g2int)PyInt_AsLong(__pyx_v_ndpts));
+
+  /* "g2clib.pyx":428
+ *     iofst = <g2int>PyInt_AsLong(ipos*8)
+ *     ngpts = <g2int>PyInt_AsLong(ndpts)
+ *     idrsnum = <g2int>PyInt_AsLong(drtnum)             # <<<<<<<<<<<<<<
+ *     igdsnum = <g2int>PyInt_AsLong(gdtnum)
+ *     PyObject_AsReadBuffer(drtmpl, &drtmpldat, &buflen)
+ */
+  __pyx_v_idrsnum = ((g2int)PyInt_AsLong(__pyx_v_drtnum));
+
+  /* "g2clib.pyx":429
+ *     ngpts = <g2int>PyInt_AsLong(ndpts)
+ *     idrsnum = <g2int>PyInt_AsLong(drtnum)
+ *     igdsnum = <g2int>PyInt_AsLong(gdtnum)             # <<<<<<<<<<<<<<
+ *     PyObject_AsReadBuffer(drtmpl, &drtmpldat, &buflen)
+ *     PyObject_AsReadBuffer(gdtmpl, &gdtmpldat, &buflen)
+ */
+  __pyx_v_igdsnum = ((g2int)PyInt_AsLong(__pyx_v_gdtnum));
+
+  /* "g2clib.pyx":430
+ *     idrsnum = <g2int>PyInt_AsLong(drtnum)
+ *     igdsnum = <g2int>PyInt_AsLong(gdtnum)
+ *     PyObject_AsReadBuffer(drtmpl, &drtmpldat, &buflen)             # <<<<<<<<<<<<<<
+ *     PyObject_AsReadBuffer(gdtmpl, &gdtmpldat, &buflen)
+ *     idrstmpl = <g2int *>drtmpldat
+ */
+  PyObject_AsReadBuffer(__pyx_v_drtmpl, (&__pyx_v_drtmpldat), (&__pyx_v_buflen));
+
+  /* "g2clib.pyx":431
+ *     igdsnum = <g2int>PyInt_AsLong(gdtnum)
+ *     PyObject_AsReadBuffer(drtmpl, &drtmpldat, &buflen)
+ *     PyObject_AsReadBuffer(gdtmpl, &gdtmpldat, &buflen)             # <<<<<<<<<<<<<<
+ *     idrstmpl = <g2int *>drtmpldat
+ *     igdstmpl = <g2int *>gdtmpldat
+ */
+  PyObject_AsReadBuffer(__pyx_v_gdtmpl, (&__pyx_v_gdtmpldat), (&__pyx_v_buflen));
+
+  /* "g2clib.pyx":432
+ *     PyObject_AsReadBuffer(drtmpl, &drtmpldat, &buflen)
+ *     PyObject_AsReadBuffer(gdtmpl, &gdtmpldat, &buflen)
+ *     idrstmpl = <g2int *>drtmpldat             # <<<<<<<<<<<<<<
+ *     igdstmpl = <g2int *>gdtmpldat
+ *     ierr=g2_unpack7(cgrib,&iofst,igdsnum,igdstmpl,idrsnum,idrstmpl,ngpts,&fld)
+ */
+  __pyx_v_idrstmpl = ((g2int *)__pyx_v_drtmpldat);
+
+  /* "g2clib.pyx":433
+ *     PyObject_AsReadBuffer(gdtmpl, &gdtmpldat, &buflen)
+ *     idrstmpl = <g2int *>drtmpldat
+ *     igdstmpl = <g2int *>gdtmpldat             # <<<<<<<<<<<<<<
+ *     ierr=g2_unpack7(cgrib,&iofst,igdsnum,igdstmpl,idrsnum,idrstmpl,ngpts,&fld)
+ *     if ierr != 0:
+ */
+  __pyx_v_igdstmpl = ((g2int *)__pyx_v_gdtmpldat);
+
+  /* "g2clib.pyx":434
+ *     idrstmpl = <g2int *>drtmpldat
+ *     igdstmpl = <g2int *>gdtmpldat
+ *     ierr=g2_unpack7(cgrib,&iofst,igdsnum,igdstmpl,idrsnum,idrstmpl,ngpts,&fld)             # <<<<<<<<<<<<<<
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 7 - error code = %i" % ierr
+ */
+  __pyx_v_ierr = g2_unpack7(__pyx_v_cgrib, (&__pyx_v_iofst), __pyx_v_igdsnum, __pyx_v_igdstmpl, __pyx_v_idrsnum, __pyx_v_idrstmpl, __pyx_v_ngpts, (&__pyx_v_fld));
+
+  /* "g2clib.pyx":435
+ *     igdstmpl = <g2int *>gdtmpldat
+ *     ierr=g2_unpack7(cgrib,&iofst,igdsnum,igdstmpl,idrsnum,idrstmpl,ngpts,&fld)
+ *     if ierr != 0:             # <<<<<<<<<<<<<<
+ *        msg = "Error unpacking section 7 - error code = %i" % ierr
+ *        raise RuntimeError(msg)
+ */
+  __pyx_t_2 = (__pyx_v_ierr != 0);
+  if (__pyx_t_2) {
+
+    /* "g2clib.pyx":436
+ *     ierr=g2_unpack7(cgrib,&iofst,igdsnum,igdstmpl,idrsnum,idrstmpl,ngpts,&fld)
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 7 - error code = %i" % ierr             # <<<<<<<<<<<<<<
+ *        raise RuntimeError(msg)
+ * 
+ */
+    __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ierr); 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_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_msg = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
+
+    /* "g2clib.pyx":437
+ *     if ierr != 0:
+ *        msg = "Error unpacking section 7 - error code = %i" % ierr
+ *        raise RuntimeError(msg)             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __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_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __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 = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
+
+  /* "g2clib.pyx":440
+ * 
+ * 
+ *     if printminmax:             # <<<<<<<<<<<<<<
+ *         rmax=-<float>9.9e31
+ *         rmin=<float>9.9e31
+ */
+  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_printminmax); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_t_2) {
+
+    /* "g2clib.pyx":441
+ * 
+ *     if printminmax:
+ *         rmax=-<float>9.9e31             # <<<<<<<<<<<<<<
+ *         rmin=<float>9.9e31
+ *         for n from 0 <= n < ndpts:
+ */
+    __pyx_v_rmax = (-((float)9.9e31));
+
+    /* "g2clib.pyx":442
+ *     if printminmax:
+ *         rmax=-<float>9.9e31
+ *         rmin=<float>9.9e31             # <<<<<<<<<<<<<<
+ *         for n from 0 <= n < ndpts:
+ *             if fld[n] > rmax: rmax=fld[n]
+ */
+    __pyx_v_rmin = ((float)9.9e31);
+
+    /* "g2clib.pyx":443
+ *         rmax=-<float>9.9e31
+ *         rmin=<float>9.9e31
+ *         for n from 0 <= n < ndpts:             # <<<<<<<<<<<<<<
+ *             if fld[n] > rmax: rmax=fld[n]
+ *             if fld[n] < rmin: rmin=fld[n]
+ */
+    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_ndpts); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    for (__pyx_v_n = 0; __pyx_v_n < __pyx_t_4; __pyx_v_n++) {
+
+      /* "g2clib.pyx":444
+ *         rmin=<float>9.9e31
+ *         for n from 0 <= n < ndpts:
+ *             if fld[n] > rmax: rmax=fld[n]             # <<<<<<<<<<<<<<
+ *             if fld[n] < rmin: rmin=fld[n]
+ *         fldmax = PyFloat_FromDouble(rmax)
+ */
+      __pyx_t_2 = ((__pyx_v_fld[__pyx_v_n]) > __pyx_v_rmax);
+      if (__pyx_t_2) {
+        __pyx_v_rmax = (__pyx_v_fld[__pyx_v_n]);
+        goto __pyx_L7;
+      }
+      __pyx_L7:;
+
+      /* "g2clib.pyx":445
+ *         for n from 0 <= n < ndpts:
+ *             if fld[n] > rmax: rmax=fld[n]
+ *             if fld[n] < rmin: rmin=fld[n]             # <<<<<<<<<<<<<<
+ *         fldmax = PyFloat_FromDouble(rmax)
+ *         fldmin = PyFloat_FromDouble(rmin)
+ */
+      __pyx_t_2 = ((__pyx_v_fld[__pyx_v_n]) < __pyx_v_rmin);
+      if (__pyx_t_2) {
+        __pyx_v_rmin = (__pyx_v_fld[__pyx_v_n]);
+        goto __pyx_L8;
+      }
+      __pyx_L8:;
+    }
+
+    /* "g2clib.pyx":446
+ *             if fld[n] > rmax: rmax=fld[n]
+ *             if fld[n] < rmin: rmin=fld[n]
+ *         fldmax = PyFloat_FromDouble(rmax)             # <<<<<<<<<<<<<<
+ *         fldmin = PyFloat_FromDouble(rmin)
+ *         bitsofprecision = drtmpl[3]
+ */
+    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_rmax); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_v_fldmax = __pyx_t_1;
+    __pyx_t_1 = 0;
+
+    /* "g2clib.pyx":447
+ *             if fld[n] < rmin: rmin=fld[n]
+ *         fldmax = PyFloat_FromDouble(rmax)
+ *         fldmin = PyFloat_FromDouble(rmin)             # <<<<<<<<<<<<<<
+ *         bitsofprecision = drtmpl[3]
+ *         digitsofprecision = int(math.ceil(math.log10(math.pow(2,bitsofprecision))))
+ */
+    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_rmin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_v_fldmin = __pyx_t_1;
+    __pyx_t_1 = 0;
+
+    /* "g2clib.pyx":448
+ *         fldmax = PyFloat_FromDouble(rmax)
+ *         fldmin = PyFloat_FromDouble(rmin)
+ *         bitsofprecision = drtmpl[3]             # <<<<<<<<<<<<<<
+ *         digitsofprecision = int(math.ceil(math.log10(math.pow(2,bitsofprecision))))
+ *         format = "%."+repr(digitsofprecision+1)+"g"
+ */
+    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_drtmpl, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_v_bitsofprecision = __pyx_t_1;
+    __pyx_t_1 = 0;
+
+    /* "g2clib.pyx":449
+ *         fldmin = PyFloat_FromDouble(rmin)
+ *         bitsofprecision = drtmpl[3]
+ *         digitsofprecision = int(math.ceil(math.log10(math.pow(2,bitsofprecision))))             # <<<<<<<<<<<<<<
+ *         format = "%."+repr(digitsofprecision+1)+"g"
+ *         minmaxstring = 'min/max='+format+'/'+format
+ */
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__math); 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 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ceil); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__math); 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 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log10); 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);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__math); 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_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__pow); 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_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyTuple_New(2); 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_INCREF(__pyx_int_2);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_2);
+    __Pyx_GIVEREF(__pyx_int_2);
+    __Pyx_INCREF(__pyx_v_bitsofprecision);
+    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_bitsofprecision);
+    __Pyx_GIVEREF(__pyx_v_bitsofprecision);
+    __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(((PyObject *)__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 = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
+    __Pyx_GIVEREF(__pyx_t_7);
+    __pyx_t_7 = 0;
+    __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(((PyObject *)__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 = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
+    __Pyx_GIVEREF(__pyx_t_7);
+    __pyx_t_7 = 0;
+    __pyx_t_7 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __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_1)); __pyx_t_1 = 0;
+    __pyx_t_1 = PyTuple_New(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);
+    PyTuple_SET_ITEM(__pyx_t_1, 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_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __pyx_v_digitsofprecision = __pyx_t_7;
+    __pyx_t_7 = 0;
+
+    /* "g2clib.pyx":450
+ *         bitsofprecision = drtmpl[3]
+ *         digitsofprecision = int(math.ceil(math.log10(math.pow(2,bitsofprecision))))
+ *         format = "%."+repr(digitsofprecision+1)+"g"             # <<<<<<<<<<<<<<
+ *         minmaxstring = 'min/max='+format+'/'+format
+ *         minmaxstring = minmaxstring % (fldmin,fldmax)
+ */
+    __pyx_t_7 = PyNumber_Add(__pyx_v_digitsofprecision, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __pyx_t_1 = PyObject_Repr(__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_kp_s_16), __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyNumber_Add(__pyx_t_7, ((PyObject *)__pyx_n_s__g)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_v_format = __pyx_t_1;
+    __pyx_t_1 = 0;
+
+    /* "g2clib.pyx":451
+ *         digitsofprecision = int(math.ceil(math.log10(math.pow(2,bitsofprecision))))
+ *         format = "%."+repr(digitsofprecision+1)+"g"
+ *         minmaxstring = 'min/max='+format+'/'+format             # <<<<<<<<<<<<<<
+ *         minmaxstring = minmaxstring % (fldmin,fldmax)
+ *         print minmaxstring
+ */
+    __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_kp_s_17), __pyx_v_format); 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_7 = PyNumber_Add(__pyx_t_1, ((PyObject *)__pyx_kp_s_18)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_t_1 = PyNumber_Add(__pyx_t_7, __pyx_v_format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+    __pyx_v_minmaxstring = __pyx_t_1;
+    __pyx_t_1 = 0;
+
+    /* "g2clib.pyx":452
+ *         format = "%."+repr(digitsofprecision+1)+"g"
+ *         minmaxstring = 'min/max='+format+'/'+format
+ *         minmaxstring = minmaxstring % (fldmin,fldmax)             # <<<<<<<<<<<<<<
+ *         print minmaxstring
+ * 
+ */
+    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_INCREF(__pyx_v_fldmin);
+    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fldmin);
+    __Pyx_GIVEREF(__pyx_v_fldmin);
+    __Pyx_INCREF(__pyx_v_fldmax);
+    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_fldmax);
+    __Pyx_GIVEREF(__pyx_v_fldmax);
+    __pyx_t_7 = PyNumber_Remainder(__pyx_v_minmaxstring, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_7);
+    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+    __Pyx_DECREF(__pyx_v_minmaxstring);
+    __pyx_v_minmaxstring = __pyx_t_7;
+    __pyx_t_7 = 0;
+
+    /* "g2clib.pyx":453
+ *         minmaxstring = 'min/max='+format+'/'+format
+ *         minmaxstring = minmaxstring % (fldmin,fldmax)
+ *         print minmaxstring             # <<<<<<<<<<<<<<
+ * 
+ *     data = _toarray(fld, zeros(ngpts, 'f4', order=storageorder))
+ */
+    if (__Pyx_PrintOne(0, __pyx_v_minmaxstring) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L4;
+  }
+  __pyx_L4:;
+
+  /* "g2clib.pyx":455
+ *         print minmaxstring
+ * 
+ *     data = _toarray(fld, zeros(ngpts, 'f4', order=storageorder))             # <<<<<<<<<<<<<<
+ *     return data
+ * 
+ */
+  __pyx_t_7 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ngpts); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
+  __Pyx_GIVEREF(__pyx_t_7);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__f4));
+  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__f4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__f4));
+  __pyx_t_7 = 0;
+  __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
+  if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__order), __pyx_v_storageorder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyObject_Call(__pyx_v_zeros, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
+  __pyx_t_7 = __pyx_f_6g2clib__toarray(__pyx_v_fld, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_7);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_v_data = __pyx_t_7;
+  __pyx_t_7 = 0;
+
+  /* "g2clib.pyx":456
+ * 
+ *     data = _toarray(fld, zeros(ngpts, 'f4', order=storageorder))
+ *     return data             # <<<<<<<<<<<<<<
+ * 
+ * # routines for writing grib2 files.
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __Pyx_INCREF(__pyx_v_data);
+  __pyx_r = __pyx_v_data;
+  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_5);
+  __Pyx_XDECREF(__pyx_t_6);
+  __Pyx_XDECREF(__pyx_t_7);
+  __Pyx_AddTraceback("g2clib.unpack7", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_msg);
+  __Pyx_XDECREF(__pyx_v_fldmax);
+  __Pyx_XDECREF(__pyx_v_fldmin);
+  __Pyx_XDECREF(__pyx_v_bitsofprecision);
+  __Pyx_XDECREF(__pyx_v_digitsofprecision);
+  __Pyx_XDECREF(__pyx_v_format);
+  __Pyx_XDECREF(__pyx_v_minmaxstring);
+  __Pyx_XDECREF(__pyx_v_data);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6g2clib_17grib2_create(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6g2clib_16grib2_create[] = "\n Initializes a new GRIB2 message and packs\n GRIB2 sections 0 (Indicator Section) and 1 (Identification Section).\n This routine is used with routines \"g2_addgrid\", \n \"grib2_addfield\", and \"grib2_gribend\" to create a complete GRIB2 message.  \n grib2_create must be called first to initialize a new GRIB2 message.\n Also, a call to grib2_gribend is required to complete GRIB2 message\n after all fields have been added.\n\n gribmsg,  [...]
+static PyMethodDef __pyx_mdef_6g2clib_17grib2_create = {__Pyx_NAMESTR("grib2_create"), (PyCFunction)__pyx_pw_6g2clib_17grib2_create, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6g2clib_16grib2_create)};
+static PyObject *__pyx_pw_6g2clib_17grib2_create(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_listsec0 = 0;
+  PyObject *__pyx_v_listsec1 = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("grib2_create (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__listsec0,&__pyx_n_s__listsec1,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__listsec0)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__listsec1)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("grib2_create", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "grib2_create") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __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_listsec0 = values[0];
+    __pyx_v_listsec1 = values[1];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("grib2_create", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("g2clib.grib2_create", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6g2clib_16grib2_create(__pyx_self, __pyx_v_listsec0, __pyx_v_listsec1);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "g2clib.pyx":460
+ * # routines for writing grib2 files.
+ * 
+ * def grib2_create(object listsec0, object listsec1):             # <<<<<<<<<<<<<<
+ *     """
+ *  Initializes a new GRIB2 message and packs
+ */
+
+static PyObject *__pyx_pf_6g2clib_16grib2_create(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_listsec0, PyObject *__pyx_v_listsec1) {
+  g2int *__pyx_v_isec0;
+  g2int *__pyx_v_isec1;
+  g2int __pyx_v_ierr;
+  void *__pyx_v_listsec0dat;
+  void *__pyx_v_listsec1dat;
+  Py_ssize_t __pyx_v_buflen;
+  unsigned char *__pyx_v_cgrib;
+  PyObject *__pyx_v_lgrib = NULL;
+  PyObject *__pyx_v_gribmsg = NULL;
+  PyObject *__pyx_v_msg = NULL;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  Py_ssize_t __pyx_t_1;
+  Py_ssize_t __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  int __pyx_t_4;
+  PyObject *__pyx_t_5 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("grib2_create", 0);
+
+  /* "g2clib.pyx":506
+ *     cdef unsigned char *cgrib
+ *     # cgrib needs to be big enough to hold sec0 and sec1.
+ *     lgrib = 4*(len(listsec0)+len(listsec1))             # <<<<<<<<<<<<<<
+ *     gribmsg = lgrib*b" "
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ */
+  __pyx_t_1 = PyObject_Length(__pyx_v_listsec0); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyObject_Length(__pyx_v_listsec1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyInt_FromSsize_t((4 * (__pyx_t_1 + __pyx_t_2))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_lgrib = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "g2clib.pyx":507
+ *     # cgrib needs to be big enough to hold sec0 and sec1.
+ *     lgrib = 4*(len(listsec0)+len(listsec1))
+ *     gribmsg = lgrib*b" "             # <<<<<<<<<<<<<<
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     PyObject_AsReadBuffer(listsec0, &listsec0dat, &buflen)
+ */
+  __pyx_t_3 = PyNumber_Multiply(__pyx_v_lgrib, ((PyObject *)__pyx_kp_b_19)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_v_gribmsg = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "g2clib.pyx":508
+ *     lgrib = 4*(len(listsec0)+len(listsec1))
+ *     gribmsg = lgrib*b" "
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)             # <<<<<<<<<<<<<<
+ *     PyObject_AsReadBuffer(listsec0, &listsec0dat, &buflen)
+ *     PyObject_AsReadBuffer(listsec1, &listsec1dat, &buflen)
+ */
+  __pyx_v_cgrib = ((unsigned char *)PyBytes_AsString(__pyx_v_gribmsg));
+
+  /* "g2clib.pyx":509
+ *     gribmsg = lgrib*b" "
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     PyObject_AsReadBuffer(listsec0, &listsec0dat, &buflen)             # <<<<<<<<<<<<<<
+ *     PyObject_AsReadBuffer(listsec1, &listsec1dat, &buflen)
+ *     isec0 = <g2int *>listsec0dat
+ */
+  PyObject_AsReadBuffer(__pyx_v_listsec0, (&__pyx_v_listsec0dat), (&__pyx_v_buflen));
+
+  /* "g2clib.pyx":510
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     PyObject_AsReadBuffer(listsec0, &listsec0dat, &buflen)
+ *     PyObject_AsReadBuffer(listsec1, &listsec1dat, &buflen)             # <<<<<<<<<<<<<<
+ *     isec0 = <g2int *>listsec0dat
+ *     isec1 = <g2int *>listsec1dat
+ */
+  PyObject_AsReadBuffer(__pyx_v_listsec1, (&__pyx_v_listsec1dat), (&__pyx_v_buflen));
+
+  /* "g2clib.pyx":511
+ *     PyObject_AsReadBuffer(listsec0, &listsec0dat, &buflen)
+ *     PyObject_AsReadBuffer(listsec1, &listsec1dat, &buflen)
+ *     isec0 = <g2int *>listsec0dat             # <<<<<<<<<<<<<<
+ *     isec1 = <g2int *>listsec1dat
+ *     ierr = g2_create(cgrib,isec0,isec1)
+ */
+  __pyx_v_isec0 = ((g2int *)__pyx_v_listsec0dat);
+
+  /* "g2clib.pyx":512
+ *     PyObject_AsReadBuffer(listsec1, &listsec1dat, &buflen)
+ *     isec0 = <g2int *>listsec0dat
+ *     isec1 = <g2int *>listsec1dat             # <<<<<<<<<<<<<<
+ *     ierr = g2_create(cgrib,isec0,isec1)
+ *     if ierr < 0:
+ */
+  __pyx_v_isec1 = ((g2int *)__pyx_v_listsec1dat);
+
+  /* "g2clib.pyx":513
+ *     isec0 = <g2int *>listsec0dat
+ *     isec1 = <g2int *>listsec1dat
+ *     ierr = g2_create(cgrib,isec0,isec1)             # <<<<<<<<<<<<<<
+ *     if ierr < 0:
+ *        msg = "Error in grib2_create, error code = %i" % ierr
+ */
+  __pyx_v_ierr = g2_create(__pyx_v_cgrib, __pyx_v_isec0, __pyx_v_isec1);
+
+  /* "g2clib.pyx":514
+ *     isec1 = <g2int *>listsec1dat
+ *     ierr = g2_create(cgrib,isec0,isec1)
+ *     if ierr < 0:             # <<<<<<<<<<<<<<
+ *        msg = "Error in grib2_create, error code = %i" % ierr
+ *        raise RuntimeError(msg)
+ */
+  __pyx_t_4 = (__pyx_v_ierr < 0);
+  if (__pyx_t_4) {
+
+    /* "g2clib.pyx":515
+ *     ierr = g2_create(cgrib,isec0,isec1)
+ *     if ierr < 0:
+ *        msg = "Error in grib2_create, error code = %i" % ierr             # <<<<<<<<<<<<<<
+ *        raise RuntimeError(msg)
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+ */
+    __pyx_t_3 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ierr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_20), __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_v_msg = ((PyObject *)__pyx_t_5);
+    __pyx_t_5 = 0;
+
+    /* "g2clib.pyx":516
+ *     if ierr < 0:
+ *        msg = "Error in grib2_create, error code = %i" % ierr
+ *        raise RuntimeError(msg)             # <<<<<<<<<<<<<<
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+ *     return gribmsg, ierr
+ */
+    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __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_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
+
+  /* "g2clib.pyx":517
+ *        msg = "Error in grib2_create, error code = %i" % ierr
+ *        raise RuntimeError(msg)
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)             # <<<<<<<<<<<<<<
+ *     return gribmsg, ierr
+ * 
+ */
+  __pyx_t_3 = PyBytes_FromStringAndSize(((char *)__pyx_v_cgrib), __pyx_v_ierr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_v_gribmsg);
+  __pyx_v_gribmsg = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "g2clib.pyx":518
+ *        raise RuntimeError(msg)
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+ *     return gribmsg, ierr             # <<<<<<<<<<<<<<
+ * 
+ * def grib2_end(gribmsg):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_3 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ierr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_INCREF(__pyx_v_gribmsg);
+  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_gribmsg);
+  __Pyx_GIVEREF(__pyx_v_gribmsg);
+  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_3 = 0;
+  __pyx_r = ((PyObject *)__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_5);
+  __Pyx_AddTraceback("g2clib.grib2_create", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_lgrib);
+  __Pyx_XDECREF(__pyx_v_gribmsg);
+  __Pyx_XDECREF(__pyx_v_msg);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6g2clib_19grib2_end(PyObject *__pyx_self, PyObject *__pyx_v_gribmsg); /*proto*/
+static char __pyx_doc_6g2clib_18grib2_end[] = "\n\n    Finalizes a GRIB2 message after all grids\n    and fields have been added.  It adds the End Section ( \"7777\" )\n    to the end of the GRIB message and calculates the length and stores\n    it in the appropriate place in Section 0.\n    This routine is used with routines \"g2_create\",  \n    \"g2_addgrid\", and \"g2_addfield\" to create a complete GRIB2 message.\n    g2_create must be called first to initialize a new GRIB2 message. [...]
+static PyMethodDef __pyx_mdef_6g2clib_19grib2_end = {__Pyx_NAMESTR("grib2_end"), (PyCFunction)__pyx_pw_6g2clib_19grib2_end, METH_O, __Pyx_DOCSTR(__pyx_doc_6g2clib_18grib2_end)};
+static PyObject *__pyx_pw_6g2clib_19grib2_end(PyObject *__pyx_self, PyObject *__pyx_v_gribmsg) {
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("grib2_end (wrapper)", 0);
+  __pyx_r = __pyx_pf_6g2clib_18grib2_end(__pyx_self, ((PyObject *)__pyx_v_gribmsg));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "g2clib.pyx":520
+ *     return gribmsg, ierr
+ * 
+ * def grib2_end(gribmsg):             # <<<<<<<<<<<<<<
+ *     """
+ * 
+ */
+
+static PyObject *__pyx_pf_6g2clib_18grib2_end(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg) {
+  g2int __pyx_v_ierr;
+  unsigned char *__pyx_v_cgrib;
+  PyObject *__pyx_v_msg = NULL;
+  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("grib2_end", 0);
+  __Pyx_INCREF(__pyx_v_gribmsg);
+
+  /* "g2clib.pyx":553
+ *     cdef unsigned char *cgrib
+ *     # add some extra space to grib message (enough to hold section 8).
+ *     gribmsg = gribmsg + b'        '             # <<<<<<<<<<<<<<
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     ierr = g2_gribend(cgrib)
+ */
+  __pyx_t_1 = PyNumber_Add(__pyx_v_gribmsg, ((PyObject *)__pyx_kp_b_21)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_v_gribmsg);
+  __pyx_v_gribmsg = __pyx_t_1;
+  __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":554
+ *     # add some extra space to grib message (enough to hold section 8).
+ *     gribmsg = gribmsg + b'        '
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)             # <<<<<<<<<<<<<<
+ *     ierr = g2_gribend(cgrib)
+ *     if ierr < 0:
+ */
+  __pyx_v_cgrib = ((unsigned char *)PyBytes_AsString(__pyx_v_gribmsg));
+
+  /* "g2clib.pyx":555
+ *     gribmsg = gribmsg + b'        '
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     ierr = g2_gribend(cgrib)             # <<<<<<<<<<<<<<
+ *     if ierr < 0:
+ *        msg = "error in grib2_end, error code = %i" % ierr
+ */
+  __pyx_v_ierr = g2_gribend(__pyx_v_cgrib);
+
+  /* "g2clib.pyx":556
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     ierr = g2_gribend(cgrib)
+ *     if ierr < 0:             # <<<<<<<<<<<<<<
+ *        msg = "error in grib2_end, error code = %i" % ierr
+ *        raise RuntimeError(msg)
+ */
+  __pyx_t_2 = (__pyx_v_ierr < 0);
+  if (__pyx_t_2) {
+
+    /* "g2clib.pyx":557
+ *     ierr = g2_gribend(cgrib)
+ *     if ierr < 0:
+ *        msg = "error in grib2_end, error code = %i" % ierr             # <<<<<<<<<<<<<<
+ *        raise RuntimeError(msg)
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+ */
+    __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ierr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __pyx_v_msg = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
+
+    /* "g2clib.pyx":558
+ *     if ierr < 0:
+ *        msg = "error in grib2_end, error code = %i" % ierr
+ *        raise RuntimeError(msg)             # <<<<<<<<<<<<<<
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+ *     return gribmsg, ierr
+ */
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __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_1 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_1);
+    __Pyx_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 = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
+
+  /* "g2clib.pyx":559
+ *        msg = "error in grib2_end, error code = %i" % ierr
+ *        raise RuntimeError(msg)
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)             # <<<<<<<<<<<<<<
+ *     return gribmsg, ierr
+ * 
+ */
+  __pyx_t_1 = PyBytes_FromStringAndSize(((char *)__pyx_v_cgrib), __pyx_v_ierr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __Pyx_DECREF(__pyx_v_gribmsg);
+  __pyx_v_gribmsg = __pyx_t_1;
+  __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":560
+ *        raise RuntimeError(msg)
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+ *     return gribmsg, ierr             # <<<<<<<<<<<<<<
+ * 
+ * def grib2_addgrid(gribmsg,object gds,object gdstmpl,object deflist=None, defnum = 0):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ierr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __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 = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_INCREF(__pyx_v_gribmsg);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_gribmsg);
+  __Pyx_GIVEREF(__pyx_v_gribmsg);
+  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 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_3);
+  __Pyx_AddTraceback("g2clib.grib2_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_msg);
+  __Pyx_XDECREF(__pyx_v_gribmsg);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6g2clib_21grib2_addgrid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6g2clib_20grib2_addgrid[] = "\n   Packs up a Grid Definition Section (Section 3) \n   and adds it to a GRIB2 message.  It is used with routines \"g2_create\",\n   \"g2_addfield\" and \"g2_gribend\" to create a complete GRIB2 message.\n   g2_create must be called first to initialize a new GRIB2 message.\n\n   gribmsg, ierr = grib2_addgrid(gribmsg,gds,gdstmpl,ideflist)\n \n   INPUT ARGUMENTS:\n     cgrib    - Char array that contains the GRIB2 message to which\n       [...]
+static PyMethodDef __pyx_mdef_6g2clib_21grib2_addgrid = {__Pyx_NAMESTR("grib2_addgrid"), (PyCFunction)__pyx_pw_6g2clib_21grib2_addgrid, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6g2clib_20grib2_addgrid)};
+static PyObject *__pyx_pw_6g2clib_21grib2_addgrid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_gribmsg = 0;
+  PyObject *__pyx_v_gds = 0;
+  PyObject *__pyx_v_gdstmpl = 0;
+  PyObject *__pyx_v_deflist = 0;
+  CYTHON_UNUSED PyObject *__pyx_v_defnum = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("grib2_addgrid (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__gribmsg,&__pyx_n_s__gds,&__pyx_n_s__gdstmpl,&__pyx_n_s__deflist,&__pyx_n_s__defnum,0};
+    PyObject* values[5] = {0,0,0,0,0};
+
+    /* "g2clib.pyx":562
+ *     return gribmsg, ierr
+ * 
+ * def grib2_addgrid(gribmsg,object gds,object gdstmpl,object deflist=None, defnum = 0):             # <<<<<<<<<<<<<<
+ *     """
+ *    Packs up a Grid Definition Section (Section 3)
+ */
+    values[3] = ((PyObject *)Py_None);
+    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        case  0: break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+      kw_args = PyDict_Size(__pyx_kwds);
+      switch (pos_args) {
+        case  0:
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gribmsg)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gds)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("grib2_addgrid", 0, 3, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gdstmpl)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("grib2_addgrid", 0, 3, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  3:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__deflist);
+          if (value) { values[3] = value; kw_args--; }
+        }
+        case  4:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__defnum);
+          if (value) { values[4] = value; kw_args--; }
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "grib2_addgrid") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    } else {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
+        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+    }
+    __pyx_v_gribmsg = values[0];
+    __pyx_v_gds = values[1];
+    __pyx_v_gdstmpl = values[2];
+    __pyx_v_deflist = values[3];
+    __pyx_v_defnum = values[4];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("grib2_addgrid", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("g2clib.grib2_addgrid", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6g2clib_20grib2_addgrid(__pyx_self, __pyx_v_gribmsg, __pyx_v_gds, __pyx_v_gdstmpl, __pyx_v_deflist, __pyx_v_defnum);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyObject *__pyx_pf_6g2clib_20grib2_addgrid(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_gds, PyObject *__pyx_v_gdstmpl, PyObject *__pyx_v_deflist, CYTHON_UNUSED PyObject *__pyx_v_defnum) {
+  g2int __pyx_v_ierr;
+  g2int __pyx_v_idefnum;
+  g2int *__pyx_v_igds;
+  g2int *__pyx_v_igdstmpl;
+  g2int *__pyx_v_ideflist;
+  unsigned char *__pyx_v_cgrib;
+  void *__pyx_v_gdsdat;
+  void *__pyx_v_deflistdat;
+  void *__pyx_v_gdstmpldat;
+  Py_ssize_t __pyx_v_buflen;
+  PyObject *__pyx_v_msg = NULL;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  Py_ssize_t __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("grib2_addgrid", 0);
+  __Pyx_INCREF(__pyx_v_gribmsg);
+
+  /* "g2clib.pyx":613
+ *     cdef void *gdsdat, *deflistdat, *gdstmpldat
+ *     cdef Py_ssize_t buflen
+ *     PyObject_AsReadBuffer(gds, &gdsdat, &buflen)             # <<<<<<<<<<<<<<
+ *     PyObject_AsReadBuffer(gdstmpl, &gdstmpldat, &buflen)
+ *     igds = <g2int *>gdsdat
+ */
+  PyObject_AsReadBuffer(__pyx_v_gds, (&__pyx_v_gdsdat), (&__pyx_v_buflen));
+
+  /* "g2clib.pyx":614
+ *     cdef Py_ssize_t buflen
+ *     PyObject_AsReadBuffer(gds, &gdsdat, &buflen)
+ *     PyObject_AsReadBuffer(gdstmpl, &gdstmpldat, &buflen)             # <<<<<<<<<<<<<<
+ *     igds = <g2int *>gdsdat
+ *     igdstmpl = <g2int *>gdstmpldat
+ */
+  PyObject_AsReadBuffer(__pyx_v_gdstmpl, (&__pyx_v_gdstmpldat), (&__pyx_v_buflen));
+
+  /* "g2clib.pyx":615
+ *     PyObject_AsReadBuffer(gds, &gdsdat, &buflen)
+ *     PyObject_AsReadBuffer(gdstmpl, &gdstmpldat, &buflen)
+ *     igds = <g2int *>gdsdat             # <<<<<<<<<<<<<<
+ *     igdstmpl = <g2int *>gdstmpldat
+ *     if igds[2] != 0:
+ */
+  __pyx_v_igds = ((g2int *)__pyx_v_gdsdat);
+
+  /* "g2clib.pyx":616
+ *     PyObject_AsReadBuffer(gdstmpl, &gdstmpldat, &buflen)
+ *     igds = <g2int *>gdsdat
+ *     igdstmpl = <g2int *>gdstmpldat             # <<<<<<<<<<<<<<
+ *     if igds[2] != 0:
+ *        PyObject_AsReadBuffer(deflist, &deflistdat, &buflen)
+ */
+  __pyx_v_igdstmpl = ((g2int *)__pyx_v_gdstmpldat);
+
+  /* "g2clib.pyx":617
+ *     igds = <g2int *>gdsdat
+ *     igdstmpl = <g2int *>gdstmpldat
+ *     if igds[2] != 0:             # <<<<<<<<<<<<<<
+ *        PyObject_AsReadBuffer(deflist, &deflistdat, &buflen)
+ *        ideflist = <g2int *>deflistdat
+ */
+  __pyx_t_1 = ((__pyx_v_igds[2]) != 0);
+  if (__pyx_t_1) {
+
+    /* "g2clib.pyx":618
+ *     igdstmpl = <g2int *>gdstmpldat
+ *     if igds[2] != 0:
+ *        PyObject_AsReadBuffer(deflist, &deflistdat, &buflen)             # <<<<<<<<<<<<<<
+ *        ideflist = <g2int *>deflistdat
+ *        idefnum = <g2int>PyInt_AsLong(len(deflist))
+ */
+    PyObject_AsReadBuffer(__pyx_v_deflist, (&__pyx_v_deflistdat), (&__pyx_v_buflen));
+
+    /* "g2clib.pyx":619
+ *     if igds[2] != 0:
+ *        PyObject_AsReadBuffer(deflist, &deflistdat, &buflen)
+ *        ideflist = <g2int *>deflistdat             # <<<<<<<<<<<<<<
+ *        idefnum = <g2int>PyInt_AsLong(len(deflist))
+ *     else:
+ */
+    __pyx_v_ideflist = ((g2int *)__pyx_v_deflistdat);
+
+    /* "g2clib.pyx":620
+ *        PyObject_AsReadBuffer(deflist, &deflistdat, &buflen)
+ *        ideflist = <g2int *>deflistdat
+ *        idefnum = <g2int>PyInt_AsLong(len(deflist))             # <<<<<<<<<<<<<<
+ *     else:
+ *        ideflist = NULL
+ */
+    __pyx_t_2 = PyObject_Length(__pyx_v_deflist); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_v_idefnum = ((g2int)PyInt_AsLong(__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    goto __pyx_L3;
+  }
+  /*else*/ {
+
+    /* "g2clib.pyx":622
+ *        idefnum = <g2int>PyInt_AsLong(len(deflist))
+ *     else:
+ *        ideflist = NULL             # <<<<<<<<<<<<<<
+ *        idefnum = 0
+ *     gribmsg = gribmsg + 4*(256+4+gds[2]+1)*b" "
+ */
+    __pyx_v_ideflist = NULL;
+
+    /* "g2clib.pyx":623
+ *     else:
+ *        ideflist = NULL
+ *        idefnum = 0             # <<<<<<<<<<<<<<
+ *     gribmsg = gribmsg + 4*(256+4+gds[2]+1)*b" "
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ */
+    __pyx_v_idefnum = 0;
+  }
+  __pyx_L3:;
+
+  /* "g2clib.pyx":624
+ *        ideflist = NULL
+ *        idefnum = 0
+ *     gribmsg = gribmsg + 4*(256+4+gds[2]+1)*b" "             # <<<<<<<<<<<<<<
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     ierr = g2_addgrid(cgrib, igds, igdstmpl, ideflist, idefnum)
+ */
+  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_gds, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_4 = PyNumber_Add(__pyx_int_260, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __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_t_4, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_4 = PyNumber_Multiply(__pyx_int_4, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __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_Multiply(__pyx_t_4, ((PyObject *)__pyx_kp_b_19)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  __pyx_t_4 = PyNumber_Add(__pyx_v_gribmsg, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_v_gribmsg);
+  __pyx_v_gribmsg = __pyx_t_4;
+  __pyx_t_4 = 0;
+
+  /* "g2clib.pyx":625
+ *        idefnum = 0
+ *     gribmsg = gribmsg + 4*(256+4+gds[2]+1)*b" "
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)             # <<<<<<<<<<<<<<
+ *     ierr = g2_addgrid(cgrib, igds, igdstmpl, ideflist, idefnum)
+ *     if ierr < 0:
+ */
+  __pyx_v_cgrib = ((unsigned char *)PyBytes_AsString(__pyx_v_gribmsg));
+
+  /* "g2clib.pyx":626
+ *     gribmsg = gribmsg + 4*(256+4+gds[2]+1)*b" "
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     ierr = g2_addgrid(cgrib, igds, igdstmpl, ideflist, idefnum)             # <<<<<<<<<<<<<<
+ *     if ierr < 0:
+ *        msg = "error in grib2_addgrid, error code = %i" % ierr
+ */
+  __pyx_v_ierr = g2_addgrid(__pyx_v_cgrib, __pyx_v_igds, __pyx_v_igdstmpl, __pyx_v_ideflist, __pyx_v_idefnum);
+
+  /* "g2clib.pyx":627
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     ierr = g2_addgrid(cgrib, igds, igdstmpl, ideflist, idefnum)
+ *     if ierr < 0:             # <<<<<<<<<<<<<<
+ *        msg = "error in grib2_addgrid, error code = %i" % ierr
+ *        raise RuntimeError(msg)
+ */
+  __pyx_t_1 = (__pyx_v_ierr < 0);
+  if (__pyx_t_1) {
+
+    /* "g2clib.pyx":628
+ *     ierr = g2_addgrid(cgrib, igds, igdstmpl, ideflist, idefnum)
+ *     if ierr < 0:
+ *        msg = "error in grib2_addgrid, error code = %i" % ierr             # <<<<<<<<<<<<<<
+ *        raise RuntimeError(msg)
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+ */
+    __pyx_t_4 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ierr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_v_msg = ((PyObject *)__pyx_t_3);
+    __pyx_t_3 = 0;
+
+    /* "g2clib.pyx":629
+ *     if ierr < 0:
+ *        msg = "error in grib2_addgrid, error code = %i" % ierr
+ *        raise RuntimeError(msg)             # <<<<<<<<<<<<<<
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+ *     return gribmsg, ierr
+ */
+    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __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_builtin_RuntimeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __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 = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L4;
+  }
+  __pyx_L4:;
+
+  /* "g2clib.pyx":630
+ *        msg = "error in grib2_addgrid, error code = %i" % ierr
+ *        raise RuntimeError(msg)
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)             # <<<<<<<<<<<<<<
+ *     return gribmsg, ierr
+ * 
+ */
+  __pyx_t_4 = PyBytes_FromStringAndSize(((char *)__pyx_v_cgrib), __pyx_v_ierr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_v_gribmsg);
+  __pyx_v_gribmsg = __pyx_t_4;
+  __pyx_t_4 = 0;
+
+  /* "g2clib.pyx":631
+ *        raise RuntimeError(msg)
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+ *     return gribmsg, ierr             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_4 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ierr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_INCREF(__pyx_v_gribmsg);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_gribmsg);
+  __Pyx_GIVEREF(__pyx_v_gribmsg);
+  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
+  __Pyx_GIVEREF(__pyx_t_4);
+  __pyx_t_4 = 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_3);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_AddTraceback("g2clib.grib2_addgrid", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_msg);
+  __Pyx_XDECREF(__pyx_v_gribmsg);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static PyObject *__pyx_pw_6g2clib_23grib2_addfield(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_6g2clib_22grib2_addfield[] = "\n   Packs up Sections 4 through 7 for a given field\n   and adds them to a GRIB2 message.  They are Product Definition Section,\n   Data Representation Section, Bit-Map Section and Data Section, respectively.\n   This routine is used with routines \"g2_create\",  \n   \"g2_addgrid\", and \"g2_gribend\" to create a complete GRIB2 message.  \n   g2_create must be called first to initialize a new GRIB2 message.\n   g2_addgrid must be call [...]
+static PyMethodDef __pyx_mdef_6g2clib_23grib2_addfield = {__Pyx_NAMESTR("grib2_addfield"), (PyCFunction)__pyx_pw_6g2clib_23grib2_addfield, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6g2clib_22grib2_addfield)};
+static PyObject *__pyx_pw_6g2clib_23grib2_addfield(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_gribmsg = 0;
+  PyObject *__pyx_v_pdsnum = 0;
+  PyObject *__pyx_v_pdstmpl = 0;
+  PyObject *__pyx_v_coordlist = 0;
+  PyObject *__pyx_v_drsnum = 0;
+  PyObject *__pyx_v_drstmpl = 0;
+  PyObject *__pyx_v_field = 0;
+  PyObject *__pyx_v_ibitmap = 0;
+  PyObject *__pyx_v_bitmap = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("grib2_addfield (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__gribmsg,&__pyx_n_s__pdsnum,&__pyx_n_s__pdstmpl,&__pyx_n_s__coordlist,&__pyx_n_s__drsnum,&__pyx_n_s__drstmpl,&__pyx_n_s__field,&__pyx_n_s__ibitmap,&__pyx_n_s__bitmap,0};
+    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
+    if (unlikely(__pyx_kwds)) {
+      Py_ssize_t kw_args;
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
+        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
+        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
+        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
+        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        case  0: break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+      kw_args = PyDict_Size(__pyx_kwds);
+      switch (pos_args) {
+        case  0:
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__gribmsg)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pdsnum)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("grib2_addfield", 1, 9, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pdstmpl)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("grib2_addfield", 1, 9, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  3:
+        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coordlist)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("grib2_addfield", 1, 9, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  4:
+        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__drsnum)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("grib2_addfield", 1, 9, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  5:
+        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__drstmpl)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("grib2_addfield", 1, 9, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  6:
+        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__field)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("grib2_addfield", 1, 9, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  7:
+        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ibitmap)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("grib2_addfield", 1, 9, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  8:
+        if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bitmap)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("grib2_addfield", 1, 9, 9, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "grib2_addfield") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
+      goto __pyx_L5_argtuple_error;
+    } else {
+      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
+      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
+      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
+      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
+      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
+    }
+    __pyx_v_gribmsg = values[0];
+    __pyx_v_pdsnum = values[1];
+    __pyx_v_pdstmpl = values[2];
+    __pyx_v_coordlist = values[3];
+    __pyx_v_drsnum = values[4];
+    __pyx_v_drstmpl = values[5];
+    __pyx_v_field = values[6];
+    __pyx_v_ibitmap = values[7];
+    __pyx_v_bitmap = values[8];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("grib2_addfield", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("g2clib.grib2_addfield", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_pf_6g2clib_22grib2_addfield(__pyx_self, __pyx_v_gribmsg, __pyx_v_pdsnum, __pyx_v_pdstmpl, __pyx_v_coordlist, __pyx_v_drsnum, __pyx_v_drstmpl, __pyx_v_field, __pyx_v_ibitmap, __pyx_v_bitmap);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "g2clib.pyx":634
+ * 
+ * 
+ * def grib2_addfield(gribmsg,pdsnum,object pdstmpl,object coordlist,             # <<<<<<<<<<<<<<
+ *                    drsnum,object drstmpl,object field,
+ *                    ibitmap,object bitmap):
+ */
+
+static PyObject *__pyx_pf_6g2clib_22grib2_addfield(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_gribmsg, PyObject *__pyx_v_pdsnum, PyObject *__pyx_v_pdstmpl, PyObject *__pyx_v_coordlist, PyObject *__pyx_v_drsnum, PyObject *__pyx_v_drstmpl, PyObject *__pyx_v_field, PyObject *__pyx_v_ibitmap, PyObject *__pyx_v_bitmap) {
+  g2int __pyx_v_ierr;
+  g2int __pyx_v_ipdsnum;
+  g2int __pyx_v_numcoord;
+  g2int *__pyx_v_ipdstmpl;
+  g2int __pyx_v_idrsnum;
+  g2int *__pyx_v_idrstmpl;
+  g2float *__pyx_v_fld;
+  g2float *__pyx_v_fcoordlist;
+  g2int *__pyx_v_bmap;
+  g2int __pyx_v_ngrdpts;
+  g2int __pyx_v_ibmap;
+  void *__pyx_v_pdtmpldat;
+  void *__pyx_v_drtmpldat;
+  void *__pyx_v_coordlistdat;
+  void *__pyx_v_fielddat;
+  void *__pyx_v_bitmapdat;
+  Py_ssize_t __pyx_v_buflen;
+  unsigned char *__pyx_v_cgrib;
+  PyObject *__pyx_v_msg = NULL;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  Py_ssize_t __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  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("grib2_addfield", 0);
+  __Pyx_INCREF(__pyx_v_gribmsg);
+
+  /* "g2clib.pyx":712
+ *     cdef Py_ssize_t buflen
+ *     cdef unsigned char *cgrib
+ *     ipdsnum = <g2int>PyInt_AsLong(pdsnum)             # <<<<<<<<<<<<<<
+ *     PyObject_AsReadBuffer(pdstmpl, &pdtmpldat, &buflen)
+ *     ipdstmpl = <g2int *>pdtmpldat
+ */
+  __pyx_v_ipdsnum = ((g2int)PyInt_AsLong(__pyx_v_pdsnum));
+
+  /* "g2clib.pyx":713
+ *     cdef unsigned char *cgrib
+ *     ipdsnum = <g2int>PyInt_AsLong(pdsnum)
+ *     PyObject_AsReadBuffer(pdstmpl, &pdtmpldat, &buflen)             # <<<<<<<<<<<<<<
+ *     ipdstmpl = <g2int *>pdtmpldat
+ *     idrsnum = <g2int>PyInt_AsLong(drsnum)
+ */
+  PyObject_AsReadBuffer(__pyx_v_pdstmpl, (&__pyx_v_pdtmpldat), (&__pyx_v_buflen));
+
+  /* "g2clib.pyx":714
+ *     ipdsnum = <g2int>PyInt_AsLong(pdsnum)
+ *     PyObject_AsReadBuffer(pdstmpl, &pdtmpldat, &buflen)
+ *     ipdstmpl = <g2int *>pdtmpldat             # <<<<<<<<<<<<<<
+ *     idrsnum = <g2int>PyInt_AsLong(drsnum)
+ *     PyObject_AsReadBuffer(drstmpl, &drtmpldat, &buflen)
+ */
+  __pyx_v_ipdstmpl = ((g2int *)__pyx_v_pdtmpldat);
+
+  /* "g2clib.pyx":715
+ *     PyObject_AsReadBuffer(pdstmpl, &pdtmpldat, &buflen)
+ *     ipdstmpl = <g2int *>pdtmpldat
+ *     idrsnum = <g2int>PyInt_AsLong(drsnum)             # <<<<<<<<<<<<<<
+ *     PyObject_AsReadBuffer(drstmpl, &drtmpldat, &buflen)
+ *     idrstmpl = <g2int *>drtmpldat
+ */
+  __pyx_v_idrsnum = ((g2int)PyInt_AsLong(__pyx_v_drsnum));
+
+  /* "g2clib.pyx":716
+ *     ipdstmpl = <g2int *>pdtmpldat
+ *     idrsnum = <g2int>PyInt_AsLong(drsnum)
+ *     PyObject_AsReadBuffer(drstmpl, &drtmpldat, &buflen)             # <<<<<<<<<<<<<<
+ *     idrstmpl = <g2int *>drtmpldat
+ *     if coordlist is not None:
+ */
+  PyObject_AsReadBuffer(__pyx_v_drstmpl, (&__pyx_v_drtmpldat), (&__pyx_v_buflen));
+
+  /* "g2clib.pyx":717
+ *     idrsnum = <g2int>PyInt_AsLong(drsnum)
+ *     PyObject_AsReadBuffer(drstmpl, &drtmpldat, &buflen)
+ *     idrstmpl = <g2int *>drtmpldat             # <<<<<<<<<<<<<<
+ *     if coordlist is not None:
+ *         PyObject_AsReadBuffer(coordlist, &coordlistdat, &buflen)
+ */
+  __pyx_v_idrstmpl = ((g2int *)__pyx_v_drtmpldat);
+
+  /* "g2clib.pyx":718
+ *     PyObject_AsReadBuffer(drstmpl, &drtmpldat, &buflen)
+ *     idrstmpl = <g2int *>drtmpldat
+ *     if coordlist is not None:             # <<<<<<<<<<<<<<
+ *         PyObject_AsReadBuffer(coordlist, &coordlistdat, &buflen)
+ *         fcoordlist = <g2float *>coordlistdat
+ */
+  __pyx_t_1 = (__pyx_v_coordlist != Py_None);
+  if (__pyx_t_1) {
+
+    /* "g2clib.pyx":719
+ *     idrstmpl = <g2int *>drtmpldat
+ *     if coordlist is not None:
+ *         PyObject_AsReadBuffer(coordlist, &coordlistdat, &buflen)             # <<<<<<<<<<<<<<
+ *         fcoordlist = <g2float *>coordlistdat
+ *         numcoord = len(coordlist)
+ */
+    PyObject_AsReadBuffer(__pyx_v_coordlist, (&__pyx_v_coordlistdat), (&__pyx_v_buflen));
+
+    /* "g2clib.pyx":720
+ *     if coordlist is not None:
+ *         PyObject_AsReadBuffer(coordlist, &coordlistdat, &buflen)
+ *         fcoordlist = <g2float *>coordlistdat             # <<<<<<<<<<<<<<
+ *         numcoord = len(coordlist)
+ *     else:
+ */
+    __pyx_v_fcoordlist = ((g2float *)__pyx_v_coordlistdat);
+
+    /* "g2clib.pyx":721
+ *         PyObject_AsReadBuffer(coordlist, &coordlistdat, &buflen)
+ *         fcoordlist = <g2float *>coordlistdat
+ *         numcoord = len(coordlist)             # <<<<<<<<<<<<<<
+ *     else:
+ *         fcoordlist = NULL
+ */
+    __pyx_t_2 = PyObject_Length(__pyx_v_coordlist); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_numcoord = __pyx_t_2;
+    goto __pyx_L3;
+  }
+  /*else*/ {
+
+    /* "g2clib.pyx":723
+ *         numcoord = len(coordlist)
+ *     else:
+ *         fcoordlist = NULL             # <<<<<<<<<<<<<<
+ *         numcoord = 0
+ *     PyObject_AsReadBuffer(field, &fielddat, &buflen)
+ */
+    __pyx_v_fcoordlist = NULL;
+
+    /* "g2clib.pyx":724
+ *     else:
+ *         fcoordlist = NULL
+ *         numcoord = 0             # <<<<<<<<<<<<<<
+ *     PyObject_AsReadBuffer(field, &fielddat, &buflen)
+ *     fld = <g2float *>fielddat
+ */
+    __pyx_v_numcoord = 0;
+  }
+  __pyx_L3:;
+
+  /* "g2clib.pyx":725
+ *         fcoordlist = NULL
+ *         numcoord = 0
+ *     PyObject_AsReadBuffer(field, &fielddat, &buflen)             # <<<<<<<<<<<<<<
+ *     fld = <g2float *>fielddat
+ *     ibmap = <g2int>PyInt_AsLong(ibitmap)
+ */
+  PyObject_AsReadBuffer(__pyx_v_field, (&__pyx_v_fielddat), (&__pyx_v_buflen));
+
+  /* "g2clib.pyx":726
+ *         numcoord = 0
+ *     PyObject_AsReadBuffer(field, &fielddat, &buflen)
+ *     fld = <g2float *>fielddat             # <<<<<<<<<<<<<<
+ *     ibmap = <g2int>PyInt_AsLong(ibitmap)
+ *     ngrdpts = len(field)
+ */
+  __pyx_v_fld = ((g2float *)__pyx_v_fielddat);
+
+  /* "g2clib.pyx":727
+ *     PyObject_AsReadBuffer(field, &fielddat, &buflen)
+ *     fld = <g2float *>fielddat
+ *     ibmap = <g2int>PyInt_AsLong(ibitmap)             # <<<<<<<<<<<<<<
+ *     ngrdpts = len(field)
+ *     if ibitmap == 0 or ibitmap == 254:
+ */
+  __pyx_v_ibmap = ((g2int)PyInt_AsLong(__pyx_v_ibitmap));
+
+  /* "g2clib.pyx":728
+ *     fld = <g2float *>fielddat
+ *     ibmap = <g2int>PyInt_AsLong(ibitmap)
+ *     ngrdpts = len(field)             # <<<<<<<<<<<<<<
+ *     if ibitmap == 0 or ibitmap == 254:
+ *         PyObject_AsReadBuffer(bitmap, &bitmapdat, &buflen)
+ */
+  __pyx_t_2 = PyObject_Length(__pyx_v_field); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_ngrdpts = __pyx_t_2;
+
+  /* "g2clib.pyx":729
+ *     ibmap = <g2int>PyInt_AsLong(ibitmap)
+ *     ngrdpts = len(field)
+ *     if ibitmap == 0 or ibitmap == 254:             # <<<<<<<<<<<<<<
+ *         PyObject_AsReadBuffer(bitmap, &bitmapdat, &buflen)
+ *         bmap  = <g2int *>bitmapdat
+ */
+  __pyx_t_3 = PyObject_RichCompare(__pyx_v_ibitmap, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  if (!__pyx_t_1) {
+    __pyx_t_3 = PyObject_RichCompare(__pyx_v_ibitmap, __pyx_int_254, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_5 = __pyx_t_4;
+  } else {
+    __pyx_t_5 = __pyx_t_1;
+  }
+  if (__pyx_t_5) {
+
+    /* "g2clib.pyx":730
+ *     ngrdpts = len(field)
+ *     if ibitmap == 0 or ibitmap == 254:
+ *         PyObject_AsReadBuffer(bitmap, &bitmapdat, &buflen)             # <<<<<<<<<<<<<<
+ *         bmap  = <g2int *>bitmapdat
+ *     else:
+ */
+    PyObject_AsReadBuffer(__pyx_v_bitmap, (&__pyx_v_bitmapdat), (&__pyx_v_buflen));
+
+    /* "g2clib.pyx":731
+ *     if ibitmap == 0 or ibitmap == 254:
+ *         PyObject_AsReadBuffer(bitmap, &bitmapdat, &buflen)
+ *         bmap  = <g2int *>bitmapdat             # <<<<<<<<<<<<<<
+ *     else:
+ *         bmap = NULL
+ */
+    __pyx_v_bmap = ((g2int *)__pyx_v_bitmapdat);
+    goto __pyx_L4;
+  }
+  /*else*/ {
+
+    /* "g2clib.pyx":733
+ *         bmap  = <g2int *>bitmapdat
+ *     else:
+ *         bmap = NULL             # <<<<<<<<<<<<<<
+ *     gribmsg = gribmsg + 4*(len(drstmpl)+ngrdpts+4)*b" "
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ */
+    __pyx_v_bmap = NULL;
+  }
+  __pyx_L4:;
+
+  /* "g2clib.pyx":734
+ *     else:
+ *         bmap = NULL
+ *     gribmsg = gribmsg + 4*(len(drstmpl)+ngrdpts+4)*b" "             # <<<<<<<<<<<<<<
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     ierr = g2_addfield(cgrib,ipdsnum,ipdstmpl,fcoordlist,numcoord,idrsnum,idrstmpl,fld,ngrdpts,ibmap,bmap)
+ */
+  __pyx_t_2 = PyObject_Length(__pyx_v_drstmpl); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = PyInt_FromSsize_t((4 * ((__pyx_t_2 + __pyx_v_ngrdpts) + 4))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_kp_b_19)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __pyx_t_3 = PyNumber_Add(__pyx_v_gribmsg, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  __Pyx_DECREF(__pyx_v_gribmsg);
+  __pyx_v_gribmsg = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "g2clib.pyx":735
+ *         bmap = NULL
+ *     gribmsg = gribmsg + 4*(len(drstmpl)+ngrdpts+4)*b" "
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)             # <<<<<<<<<<<<<<
+ *     ierr = g2_addfield(cgrib,ipdsnum,ipdstmpl,fcoordlist,numcoord,idrsnum,idrstmpl,fld,ngrdpts,ibmap,bmap)
+ *     if ierr < 0:
+ */
+  __pyx_v_cgrib = ((unsigned char *)PyBytes_AsString(__pyx_v_gribmsg));
+
+  /* "g2clib.pyx":736
+ *     gribmsg = gribmsg + 4*(len(drstmpl)+ngrdpts+4)*b" "
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     ierr = g2_addfield(cgrib,ipdsnum,ipdstmpl,fcoordlist,numcoord,idrsnum,idrstmpl,fld,ngrdpts,ibmap,bmap)             # <<<<<<<<<<<<<<
+ *     if ierr < 0:
+ *        msg = "error in grib2_addfield, error code = %i" % ierr
+ */
+  __pyx_v_ierr = g2_addfield(__pyx_v_cgrib, __pyx_v_ipdsnum, __pyx_v_ipdstmpl, __pyx_v_fcoordlist, __pyx_v_numcoord, __pyx_v_idrsnum, __pyx_v_idrstmpl, __pyx_v_fld, __pyx_v_ngrdpts, __pyx_v_ibmap, __pyx_v_bmap);
+
+  /* "g2clib.pyx":737
+ *     cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+ *     ierr = g2_addfield(cgrib,ipdsnum,ipdstmpl,fcoordlist,numcoord,idrsnum,idrstmpl,fld,ngrdpts,ibmap,bmap)
+ *     if ierr < 0:             # <<<<<<<<<<<<<<
+ *        msg = "error in grib2_addfield, error code = %i" % ierr
+ *        raise RuntimeError(msg)
+ */
+  __pyx_t_5 = (__pyx_v_ierr < 0);
+  if (__pyx_t_5) {
+
+    /* "g2clib.pyx":738
+ *     ierr = g2_addfield(cgrib,ipdsnum,ipdstmpl,fcoordlist,numcoord,idrsnum,idrstmpl,fld,ngrdpts,ibmap,bmap)
+ *     if ierr < 0:
+ *        msg = "error in grib2_addfield, error code = %i" % ierr             # <<<<<<<<<<<<<<
+ *        raise RuntimeError(msg)
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+ */
+    __pyx_t_3 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ierr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_24), __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_v_msg = ((PyObject *)__pyx_t_6);
+    __pyx_t_6 = 0;
+
+    /* "g2clib.pyx":739
+ *     if ierr < 0:
+ *        msg = "error in grib2_addfield, error code = %i" % ierr
+ *        raise RuntimeError(msg)             # <<<<<<<<<<<<<<
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+ *     return gribmsg, ierr
+ */
+    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_INCREF(__pyx_v_msg);
+    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_msg);
+    __Pyx_GIVEREF(__pyx_v_msg);
+    __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L5;
+  }
+  __pyx_L5:;
+
+  /* "g2clib.pyx":740
+ *        msg = "error in grib2_addfield, error code = %i" % ierr
+ *        raise RuntimeError(msg)
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)             # <<<<<<<<<<<<<<
+ *     return gribmsg, ierr
+ */
+  __pyx_t_3 = PyBytes_FromStringAndSize(((char *)__pyx_v_cgrib), __pyx_v_ierr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_v_gribmsg);
+  __pyx_v_gribmsg = __pyx_t_3;
+  __pyx_t_3 = 0;
+
+  /* "g2clib.pyx":741
+ *        raise RuntimeError(msg)
+ *     gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+ *     return gribmsg, ierr             # <<<<<<<<<<<<<<
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_3 = __Pyx_PyInt_to_py_int32_t(__pyx_v_ierr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_INCREF(__pyx_v_gribmsg);
+  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_gribmsg);
+  __Pyx_GIVEREF(__pyx_v_gribmsg);
+  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
+  __Pyx_GIVEREF(__pyx_t_3);
+  __pyx_t_3 = 0;
+  __pyx_r = ((PyObject *)__pyx_t_6);
+  __pyx_t_6 = 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_6);
+  __Pyx_AddTraceback("g2clib.grib2_addfield", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_msg);
+  __Pyx_XDECREF(__pyx_v_gribmsg);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyMethodDef __pyx_methods[] = {
+  {0, 0, 0, 0}
+};
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+    PyModuleDef_HEAD_INIT,
+    __Pyx_NAMESTR("g2clib"),
+    __Pyx_DOCSTR(__pyx_k_25), /* m_doc */
+    -1, /* m_size */
+    __pyx_methods /* m_methods */,
+    NULL, /* m_reload */
+    NULL, /* m_traverse */
+    NULL, /* m_clear */
+    NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
+  {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
+  {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
+  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
+  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
+  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
+  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
+  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
+  {&__pyx_kp_b_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 0, 0},
+  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
+  {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
+  {&__pyx_kp_b_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 0, 0},
+  {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
+  {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
+  {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
+  {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
+  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
+  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
+  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
+  {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
+  {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
+  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
+  {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
+  {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1},
+  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 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__bitmap, __pyx_k__bitmap, sizeof(__pyx_k__bitmap), 0, 0, 1, 1},
+  {&__pyx_n_s__bitmapdat, __pyx_k__bitmapdat, sizeof(__pyx_k__bitmapdat), 0, 0, 1, 1},
+  {&__pyx_n_s__bitsofprecision, __pyx_k__bitsofprecision, sizeof(__pyx_k__bitsofprecision), 0, 0, 1, 1},
+  {&__pyx_n_s__bmap, __pyx_k__bmap, sizeof(__pyx_k__bmap), 0, 0, 1, 1},
+  {&__pyx_n_s__buflen, __pyx_k__buflen, sizeof(__pyx_k__buflen), 0, 0, 1, 1},
+  {&__pyx_n_s__bufleni, __pyx_k__bufleni, sizeof(__pyx_k__bufleni), 0, 0, 1, 1},
+  {&__pyx_n_s__buflenr, __pyx_k__buflenr, sizeof(__pyx_k__buflenr), 0, 0, 1, 1},
+  {&__pyx_n_s__ceil, __pyx_k__ceil, sizeof(__pyx_k__ceil), 0, 0, 1, 1},
+  {&__pyx_n_s__cgrib, __pyx_k__cgrib, sizeof(__pyx_k__cgrib), 0, 0, 1, 1},
+  {&__pyx_n_s__coordlist, __pyx_k__coordlist, sizeof(__pyx_k__coordlist), 0, 0, 1, 1},
+  {&__pyx_n_s__coordlistdat, __pyx_k__coordlistdat, sizeof(__pyx_k__coordlistdat), 0, 0, 1, 1},
+  {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
+  {&__pyx_n_s__deflist, __pyx_k__deflist, sizeof(__pyx_k__deflist), 0, 0, 1, 1},
+  {&__pyx_n_s__deflistdat, __pyx_k__deflistdat, sizeof(__pyx_k__deflistdat), 0, 0, 1, 1},
+  {&__pyx_n_s__defnum, __pyx_k__defnum, sizeof(__pyx_k__defnum), 0, 0, 1, 1},
+  {&__pyx_n_s__digitsofprecision, __pyx_k__digitsofprecision, sizeof(__pyx_k__digitsofprecision), 0, 0, 1, 1},
+  {&__pyx_n_s__drsnum, __pyx_k__drsnum, sizeof(__pyx_k__drsnum), 0, 0, 1, 1},
+  {&__pyx_n_s__drstmpl, __pyx_k__drstmpl, sizeof(__pyx_k__drstmpl), 0, 0, 1, 1},
+  {&__pyx_n_s__drtmpl, __pyx_k__drtmpl, sizeof(__pyx_k__drtmpl), 0, 0, 1, 1},
+  {&__pyx_n_s__drtmpldat, __pyx_k__drtmpldat, sizeof(__pyx_k__drtmpldat), 0, 0, 1, 1},
+  {&__pyx_n_s__drtnum, __pyx_k__drtnum, sizeof(__pyx_k__drtnum), 0, 0, 1, 1},
+  {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1},
+  {&__pyx_n_s__f4, __pyx_k__f4, sizeof(__pyx_k__f4), 0, 0, 1, 1},
+  {&__pyx_n_s__fcoordlist, __pyx_k__fcoordlist, sizeof(__pyx_k__fcoordlist), 0, 0, 1, 1},
+  {&__pyx_n_s__field, __pyx_k__field, sizeof(__pyx_k__field), 0, 0, 1, 1},
+  {&__pyx_n_s__fielddat, __pyx_k__fielddat, sizeof(__pyx_k__fielddat), 0, 0, 1, 1},
+  {&__pyx_n_s__fld, __pyx_k__fld, sizeof(__pyx_k__fld), 0, 0, 1, 1},
+  {&__pyx_n_s__fldmax, __pyx_k__fldmax, sizeof(__pyx_k__fldmax), 0, 0, 1, 1},
+  {&__pyx_n_s__fldmin, __pyx_k__fldmin, sizeof(__pyx_k__fldmin), 0, 0, 1, 1},
+  {&__pyx_n_s__float32, __pyx_k__float32, sizeof(__pyx_k__float32), 0, 0, 1, 1},
+  {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
+  {&__pyx_n_s__g, __pyx_k__g, sizeof(__pyx_k__g), 0, 0, 1, 1},
+  {&__pyx_n_s__g2clib, __pyx_k__g2clib, sizeof(__pyx_k__g2clib), 0, 0, 1, 1},
+  {&__pyx_n_s__gds, __pyx_k__gds, sizeof(__pyx_k__gds), 0, 0, 1, 1},
+  {&__pyx_n_s__gdsdat, __pyx_k__gdsdat, sizeof(__pyx_k__gdsdat), 0, 0, 1, 1},
+  {&__pyx_n_s__gdstmpl, __pyx_k__gdstmpl, sizeof(__pyx_k__gdstmpl), 0, 0, 1, 1},
+  {&__pyx_n_s__gdstmpldat, __pyx_k__gdstmpldat, sizeof(__pyx_k__gdstmpldat), 0, 0, 1, 1},
+  {&__pyx_n_s__gdtmpl, __pyx_k__gdtmpl, sizeof(__pyx_k__gdtmpl), 0, 0, 1, 1},
+  {&__pyx_n_s__gdtmpldat, __pyx_k__gdtmpldat, sizeof(__pyx_k__gdtmpldat), 0, 0, 1, 1},
+  {&__pyx_n_s__gdtnum, __pyx_k__gdtnum, sizeof(__pyx_k__gdtnum), 0, 0, 1, 1},
+  {&__pyx_n_s__grib2_addfield, __pyx_k__grib2_addfield, sizeof(__pyx_k__grib2_addfield), 0, 0, 1, 1},
+  {&__pyx_n_s__grib2_addgrid, __pyx_k__grib2_addgrid, sizeof(__pyx_k__grib2_addgrid), 0, 0, 1, 1},
+  {&__pyx_n_s__grib2_create, __pyx_k__grib2_create, sizeof(__pyx_k__grib2_create), 0, 0, 1, 1},
+  {&__pyx_n_s__grib2_end, __pyx_k__grib2_end, sizeof(__pyx_k__grib2_end), 0, 0, 1, 1},
+  {&__pyx_n_s__gribmsg, __pyx_k__gribmsg, sizeof(__pyx_k__gribmsg), 0, 0, 1, 1},
+  {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
+  {&__pyx_n_s__i1, __pyx_k__i1, sizeof(__pyx_k__i1), 0, 0, 1, 1},
+  {&__pyx_n_s__i4, __pyx_k__i4, sizeof(__pyx_k__i4), 0, 0, 1, 1},
+  {&__pyx_n_s__iarr, __pyx_k__iarr, sizeof(__pyx_k__iarr), 0, 0, 1, 1},
+  {&__pyx_n_s__ibitmap, __pyx_k__ibitmap, sizeof(__pyx_k__ibitmap), 0, 0, 1, 1},
+  {&__pyx_n_s__ibmap, __pyx_k__ibmap, sizeof(__pyx_k__ibmap), 0, 0, 1, 1},
+  {&__pyx_n_s__icoordlist, __pyx_k__icoordlist, sizeof(__pyx_k__icoordlist), 0, 0, 1, 1},
+  {&__pyx_n_s__idat, __pyx_k__idat, sizeof(__pyx_k__idat), 0, 0, 1, 1},
+  {&__pyx_n_s__idata, __pyx_k__idata, sizeof(__pyx_k__idata), 0, 0, 1, 1},
+  {&__pyx_n_s__ideflist, __pyx_k__ideflist, sizeof(__pyx_k__ideflist), 0, 0, 1, 1},
+  {&__pyx_n_s__idefnum, __pyx_k__idefnum, sizeof(__pyx_k__idefnum), 0, 0, 1, 1},
+  {&__pyx_n_s__idrsnum, __pyx_k__idrsnum, sizeof(__pyx_k__idrsnum), 0, 0, 1, 1},
+  {&__pyx_n_s__idrstmpl, __pyx_k__idrstmpl, sizeof(__pyx_k__idrstmpl), 0, 0, 1, 1},
+  {&__pyx_n_s__ids, __pyx_k__ids, sizeof(__pyx_k__ids), 0, 0, 1, 1},
+  {&__pyx_n_s__idsect, __pyx_k__idsect, sizeof(__pyx_k__idsect), 0, 0, 1, 1},
+  {&__pyx_n_s__idslen, __pyx_k__idslen, sizeof(__pyx_k__idslen), 0, 0, 1, 1},
+  {&__pyx_n_s__ierr, __pyx_k__ierr, sizeof(__pyx_k__ierr), 0, 0, 1, 1},
+  {&__pyx_n_s__igds, __pyx_k__igds, sizeof(__pyx_k__igds), 0, 0, 1, 1},
+  {&__pyx_n_s__igdsnum, __pyx_k__igdsnum, sizeof(__pyx_k__igdsnum), 0, 0, 1, 1},
+  {&__pyx_n_s__igdstmpl, __pyx_k__igdstmpl, sizeof(__pyx_k__igdstmpl), 0, 0, 1, 1},
+  {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1},
+  {&__pyx_n_s__iofst, __pyx_k__iofst, sizeof(__pyx_k__iofst), 0, 0, 1, 1},
+  {&__pyx_n_s__ipdsnum, __pyx_k__ipdsnum, sizeof(__pyx_k__ipdsnum), 0, 0, 1, 1},
+  {&__pyx_n_s__ipdstmpl, __pyx_k__ipdstmpl, sizeof(__pyx_k__ipdstmpl), 0, 0, 1, 1},
+  {&__pyx_n_s__ipos, __pyx_k__ipos, sizeof(__pyx_k__ipos), 0, 0, 1, 1},
+  {&__pyx_n_s__isec0, __pyx_k__isec0, sizeof(__pyx_k__isec0), 0, 0, 1, 1},
+  {&__pyx_n_s__isec1, __pyx_k__isec1, sizeof(__pyx_k__isec1), 0, 0, 1, 1},
+  {&__pyx_n_s__itor_ieee, __pyx_k__itor_ieee, sizeof(__pyx_k__itor_ieee), 0, 0, 1, 1},
+  {&__pyx_n_s__lgrib, __pyx_k__lgrib, sizeof(__pyx_k__lgrib), 0, 0, 1, 1},
+  {&__pyx_n_s__listsec0, __pyx_k__listsec0, sizeof(__pyx_k__listsec0), 0, 0, 1, 1},
+  {&__pyx_n_s__listsec0dat, __pyx_k__listsec0dat, sizeof(__pyx_k__listsec0dat), 0, 0, 1, 1},
+  {&__pyx_n_s__listsec1, __pyx_k__listsec1, sizeof(__pyx_k__listsec1), 0, 0, 1, 1},
+  {&__pyx_n_s__listsec1dat, __pyx_k__listsec1dat, sizeof(__pyx_k__listsec1dat), 0, 0, 1, 1},
+  {&__pyx_n_s__log10, __pyx_k__log10, sizeof(__pyx_k__log10), 0, 0, 1, 1},
+  {&__pyx_n_s__mapdrslen, __pyx_k__mapdrslen, sizeof(__pyx_k__mapdrslen), 0, 0, 1, 1},
+  {&__pyx_n_s__mapgridlen, __pyx_k__mapgridlen, sizeof(__pyx_k__mapgridlen), 0, 0, 1, 1},
+  {&__pyx_n_s__mappdslen, __pyx_k__mappdslen, sizeof(__pyx_k__mappdslen), 0, 0, 1, 1},
+  {&__pyx_n_s__math, __pyx_k__math, sizeof(__pyx_k__math), 0, 0, 1, 1},
+  {&__pyx_n_s__minmaxstring, __pyx_k__minmaxstring, sizeof(__pyx_k__minmaxstring), 0, 0, 1, 1},
+  {&__pyx_n_s__msg, __pyx_k__msg, sizeof(__pyx_k__msg), 0, 0, 1, 1},
+  {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1},
+  {&__pyx_n_s__ndpts, __pyx_k__ndpts, sizeof(__pyx_k__ndpts), 0, 0, 1, 1},
+  {&__pyx_n_s__ngpts, __pyx_k__ngpts, sizeof(__pyx_k__ngpts), 0, 0, 1, 1},
+  {&__pyx_n_s__ngrdpts, __pyx_k__ngrdpts, sizeof(__pyx_k__ngrdpts), 0, 0, 1, 1},
+  {&__pyx_n_s__numcoord, __pyx_k__numcoord, sizeof(__pyx_k__numcoord), 0, 0, 1, 1},
+  {&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1},
+  {&__pyx_n_s__pdsnum, __pyx_k__pdsnum, sizeof(__pyx_k__pdsnum), 0, 0, 1, 1},
+  {&__pyx_n_s__pdstmpl, __pyx_k__pdstmpl, sizeof(__pyx_k__pdstmpl), 0, 0, 1, 1},
+  {&__pyx_n_s__pdtmpl, __pyx_k__pdtmpl, sizeof(__pyx_k__pdtmpl), 0, 0, 1, 1},
+  {&__pyx_n_s__pdtmpldat, __pyx_k__pdtmpldat, sizeof(__pyx_k__pdtmpldat), 0, 0, 1, 1},
+  {&__pyx_n_s__pow, __pyx_k__pow, sizeof(__pyx_k__pow), 0, 0, 1, 1},
+  {&__pyx_n_s__printminmax, __pyx_k__printminmax, sizeof(__pyx_k__printminmax), 0, 0, 1, 1},
+  {&__pyx_n_s__r1, __pyx_k__r1, sizeof(__pyx_k__r1), 0, 0, 1, 1},
+  {&__pyx_n_s__rarr, __pyx_k__rarr, sizeof(__pyx_k__rarr), 0, 0, 1, 1},
+  {&__pyx_n_s__rdat, __pyx_k__rdat, sizeof(__pyx_k__rdat), 0, 0, 1, 1},
+  {&__pyx_n_s__rdata, __pyx_k__rdata, sizeof(__pyx_k__rdata), 0, 0, 1, 1},
+  {&__pyx_n_s__rmax, __pyx_k__rmax, sizeof(__pyx_k__rmax), 0, 0, 1, 1},
+  {&__pyx_n_s__rmin, __pyx_k__rmin, sizeof(__pyx_k__rmin), 0, 0, 1, 1},
+  {&__pyx_n_s__rtoi_ieee, __pyx_k__rtoi_ieee, sizeof(__pyx_k__rtoi_ieee), 0, 0, 1, 1},
+  {&__pyx_n_s__storageorder, __pyx_k__storageorder, sizeof(__pyx_k__storageorder), 0, 0, 1, 1},
+  {&__pyx_n_s__unpack1, __pyx_k__unpack1, sizeof(__pyx_k__unpack1), 0, 0, 1, 1},
+  {&__pyx_n_s__unpack3, __pyx_k__unpack3, sizeof(__pyx_k__unpack3), 0, 0, 1, 1},
+  {&__pyx_n_s__unpack4, __pyx_k__unpack4, sizeof(__pyx_k__unpack4), 0, 0, 1, 1},
+  {&__pyx_n_s__unpack5, __pyx_k__unpack5, sizeof(__pyx_k__unpack5), 0, 0, 1, 1},
+  {&__pyx_n_s__unpack6, __pyx_k__unpack6, sizeof(__pyx_k__unpack6), 0, 0, 1, 1},
+  {&__pyx_n_s__unpack7, __pyx_k__unpack7, sizeof(__pyx_k__unpack7), 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_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __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);
+
+  /* "g2clib.pyx":232
+ * 
+ *     gdtmpl = _toarray(igdstmpl, zeros(mapgridlen, 'i4'))
+ *     gds = _toarray(igds, zeros(5, 'i4'))             # <<<<<<<<<<<<<<
+ *     deflist = _toarray(ideflist, zeros(idefnum, 'i4'))
+ * 
+ */
+  __pyx_k_tuple_10 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_10);
+  __Pyx_INCREF(__pyx_int_5);
+  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, __pyx_int_5);
+  __Pyx_GIVEREF(__pyx_int_5);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__i4));
+  PyTuple_SET_ITEM(__pyx_k_tuple_10, 1, ((PyObject *)__pyx_n_s__i4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i4));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
+
+  /* "g2clib.pyx":55
+ * # routines for convert to/from IEEE integers.
+ * 
+ * def rtoi_ieee(object rarr, object iarr):             # <<<<<<<<<<<<<<
+ *     """
+ *  Converts a float32 array into an int32 array of IEEE formatted values
+ */
+  __pyx_k_tuple_26 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_26);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__rarr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_n_s__rarr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rarr));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__iarr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_26, 1, ((PyObject *)__pyx_n_s__iarr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__iarr));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__rdat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_26, 2, ((PyObject *)__pyx_n_s__rdat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rdat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_26, 3, ((PyObject *)__pyx_n_s__idat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__rdata));
+  PyTuple_SET_ITEM(__pyx_k_tuple_26, 4, ((PyObject *)__pyx_n_s__rdata));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rdata));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__r1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_26, 5, ((PyObject *)__pyx_n_s__r1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r1));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idata));
+  PyTuple_SET_ITEM(__pyx_k_tuple_26, 6, ((PyObject *)__pyx_n_s__idata));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idata));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__i1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_26, 7, ((PyObject *)__pyx_n_s__i1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i1));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__bufleni));
+  PyTuple_SET_ITEM(__pyx_k_tuple_26, 8, ((PyObject *)__pyx_n_s__bufleni));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bufleni));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__buflenr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_26, 9, ((PyObject *)__pyx_n_s__buflenr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buflenr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
+  __pyx_k_codeobj_27 = (PyObject*)__Pyx_PyCode_New(2, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__rtoi_ieee, 55, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "g2clib.pyx":73
+ *     mkieee(rdata, idata, buflenr/4)
+ * 
+ * def itor_ieee(object iarr, object rarr):             # <<<<<<<<<<<<<<
+ *     """
+ *  Converts an int32 array of IEEE values into a float32 array.
+ */
+  __pyx_k_tuple_29 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_29);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__iarr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_n_s__iarr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__iarr));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__rarr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_29, 1, ((PyObject *)__pyx_n_s__rarr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rarr));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__rdat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_29, 2, ((PyObject *)__pyx_n_s__rdat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rdat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_29, 3, ((PyObject *)__pyx_n_s__idat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__rdata));
+  PyTuple_SET_ITEM(__pyx_k_tuple_29, 4, ((PyObject *)__pyx_n_s__rdata));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rdata));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idata));
+  PyTuple_SET_ITEM(__pyx_k_tuple_29, 5, ((PyObject *)__pyx_n_s__idata));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idata));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__bufleni));
+  PyTuple_SET_ITEM(__pyx_k_tuple_29, 6, ((PyObject *)__pyx_n_s__bufleni));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bufleni));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__buflenr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_29, 7, ((PyObject *)__pyx_n_s__buflenr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buflenr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
+  __pyx_k_codeobj_30 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__itor_ieee, 73, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "g2clib.pyx":123
+ * # routines for reading grib2 files.
+ * 
+ * def unpack1(gribmsg, ipos, object zeros):             # <<<<<<<<<<<<<<
+ *     """              .      .    .                                       .
+ *  Unpacks Section 1 (Identification Section) as defined in GRIB Edition 2.
+ */
+  __pyx_k_tuple_31 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_31);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gribmsg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipos));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 1, ((PyObject *)__pyx_n_s__ipos));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipos));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__zeros));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 2, ((PyObject *)__pyx_n_s__zeros));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zeros));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__cgrib));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 3, ((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 4, ((PyObject *)__pyx_n_s__i));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__iofst));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 5, ((PyObject *)__pyx_n_s__iofst));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__iofst));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ierr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 6, ((PyObject *)__pyx_n_s__ierr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ierr));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idslen));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 7, ((PyObject *)__pyx_n_s__idslen));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idslen));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ids));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 8, ((PyObject *)__pyx_n_s__ids));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ids));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__msg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 9, ((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__msg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idsect));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 10, ((PyObject *)__pyx_n_s__idsect));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idsect));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));
+  __pyx_k_codeobj_32 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__unpack1, 123, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "g2clib.pyx":177
+ * 
+ * 
+ * def unpack3(gribmsg, ipos, object zeros):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 3 (Grid Definition Section) as defined in GRIB Edition 2.
+ */
+  __pyx_k_tuple_33 = PyTuple_New(15); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_33);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gribmsg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipos));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 1, ((PyObject *)__pyx_n_s__ipos));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipos));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__zeros));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 2, ((PyObject *)__pyx_n_s__zeros));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zeros));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__cgrib));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 3, ((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__igds));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 4, ((PyObject *)__pyx_n_s__igds));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__igds));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__igdstmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 5, ((PyObject *)__pyx_n_s__igdstmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__igdstmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ideflist));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 6, ((PyObject *)__pyx_n_s__ideflist));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ideflist));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__mapgridlen));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 7, ((PyObject *)__pyx_n_s__mapgridlen));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mapgridlen));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__iofst));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 8, ((PyObject *)__pyx_n_s__iofst));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__iofst));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idefnum));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 9, ((PyObject *)__pyx_n_s__idefnum));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idefnum));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ierr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 10, ((PyObject *)__pyx_n_s__ierr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ierr));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__msg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 11, ((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__msg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gdtmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 12, ((PyObject *)__pyx_n_s__gdtmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gdtmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gds));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 13, ((PyObject *)__pyx_n_s__gds));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gds));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__deflist));
+  PyTuple_SET_ITEM(__pyx_k_tuple_33, 14, ((PyObject *)__pyx_n_s__deflist));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deflist));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
+  __pyx_k_codeobj_34 = (PyObject*)__Pyx_PyCode_New(3, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__unpack3, 177, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "g2clib.pyx":237
+ *     return gds,gdtmpl,deflist,iofst/8
+ * 
+ * def unpack4(gribmsg,ipos,object zeros):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 4 (Product Definition Section) as defined in GRIB Edition 2.
+ */
+  __pyx_k_tuple_35 = PyTuple_New(14); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_35);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gribmsg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipos));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 1, ((PyObject *)__pyx_n_s__ipos));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipos));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__zeros));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 2, ((PyObject *)__pyx_n_s__zeros));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zeros));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__cgrib));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 3, ((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipdstmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 4, ((PyObject *)__pyx_n_s__ipdstmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipdstmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__icoordlist));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 5, ((PyObject *)__pyx_n_s__icoordlist));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__icoordlist));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__mappdslen));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 6, ((PyObject *)__pyx_n_s__mappdslen));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mappdslen));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__iofst));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 7, ((PyObject *)__pyx_n_s__iofst));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__iofst));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipdsnum));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 8, ((PyObject *)__pyx_n_s__ipdsnum));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipdsnum));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ierr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 9, ((PyObject *)__pyx_n_s__ierr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ierr));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__numcoord));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 10, ((PyObject *)__pyx_n_s__numcoord));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__numcoord));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__msg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 11, ((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__msg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__pdtmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 12, ((PyObject *)__pyx_n_s__pdtmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pdtmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__coordlist));
+  PyTuple_SET_ITEM(__pyx_k_tuple_35, 13, ((PyObject *)__pyx_n_s__coordlist));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__coordlist));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
+  __pyx_k_codeobj_36 = (PyObject*)__Pyx_PyCode_New(3, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__unpack4, 237, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "g2clib.pyx":287
+ *     return pdtmpl,ipdsnum,coordlist,iofst/8
+ * 
+ * def unpack5(gribmsg,ipos,object zeros):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 5 (Data Representation Section) as defined in GRIB Edition 2.
+ */
+  __pyx_k_tuple_37 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_37);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gribmsg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipos));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 1, ((PyObject *)__pyx_n_s__ipos));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipos));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__zeros));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 2, ((PyObject *)__pyx_n_s__zeros));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zeros));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__cgrib));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 3, ((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idrstmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 4, ((PyObject *)__pyx_n_s__idrstmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idrstmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__iofst));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 5, ((PyObject *)__pyx_n_s__iofst));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__iofst));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ierr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 6, ((PyObject *)__pyx_n_s__ierr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ierr));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ndpts));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 7, ((PyObject *)__pyx_n_s__ndpts));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ndpts));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idrsnum));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 8, ((PyObject *)__pyx_n_s__idrsnum));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idrsnum));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__mapdrslen));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 9, ((PyObject *)__pyx_n_s__mapdrslen));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mapdrslen));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__msg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 10, ((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__msg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__drtmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_37, 11, ((PyObject *)__pyx_n_s__drtmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__drtmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
+  __pyx_k_codeobj_38 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__unpack5, 287, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "g2clib.pyx":331
+ *     return drtmpl,idrsnum,ndpts,iofst/8
+ * 
+ * def unpack6(gribmsg,ndpts,ipos,object zeros):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 6 (Bit-Map Section) as defined in GRIB Edition 2.
+ */
+  __pyx_k_tuple_39 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_39);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gribmsg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ndpts));
+  PyTuple_SET_ITEM(__pyx_k_tuple_39, 1, ((PyObject *)__pyx_n_s__ndpts));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ndpts));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipos));
+  PyTuple_SET_ITEM(__pyx_k_tuple_39, 2, ((PyObject *)__pyx_n_s__ipos));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipos));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__zeros));
+  PyTuple_SET_ITEM(__pyx_k_tuple_39, 3, ((PyObject *)__pyx_n_s__zeros));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zeros));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__bitmap));
+  PyTuple_SET_ITEM(__pyx_k_tuple_39, 4, ((PyObject *)__pyx_n_s__bitmap));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bitmap));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__cgrib));
+  PyTuple_SET_ITEM(__pyx_k_tuple_39, 5, ((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__iofst));
+  PyTuple_SET_ITEM(__pyx_k_tuple_39, 6, ((PyObject *)__pyx_n_s__iofst));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__iofst));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ierr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_39, 7, ((PyObject *)__pyx_n_s__ierr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ierr));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngpts));
+  PyTuple_SET_ITEM(__pyx_k_tuple_39, 8, ((PyObject *)__pyx_n_s__ngpts));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngpts));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ibmap));
+  PyTuple_SET_ITEM(__pyx_k_tuple_39, 9, ((PyObject *)__pyx_n_s__ibmap));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ibmap));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__bmap));
+  PyTuple_SET_ITEM(__pyx_k_tuple_39, 10, ((PyObject *)__pyx_n_s__bmap));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bmap));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__msg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_39, 11, ((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
+  __pyx_k_codeobj_40 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__unpack6, 331, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "g2clib.pyx":377
+ *     return bitmap,ibmap
+ * 
+ * def unpack7(gribmsg,gdtnum,object gdtmpl,drtnum,object drtmpl,ndpts,ipos,object zeros,printminmax=False,storageorder='C'):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 7 (Data Section) as defined in GRIB Edition 2.
+ */
+  __pyx_k_tuple_41 = PyTuple_New(33); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_41);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gribmsg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gdtnum));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 1, ((PyObject *)__pyx_n_s__gdtnum));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gdtnum));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gdtmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 2, ((PyObject *)__pyx_n_s__gdtmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gdtmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__drtnum));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 3, ((PyObject *)__pyx_n_s__drtnum));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__drtnum));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__drtmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 4, ((PyObject *)__pyx_n_s__drtmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__drtmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ndpts));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 5, ((PyObject *)__pyx_n_s__ndpts));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ndpts));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipos));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 6, ((PyObject *)__pyx_n_s__ipos));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipos));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__zeros));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 7, ((PyObject *)__pyx_n_s__zeros));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zeros));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__printminmax));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 8, ((PyObject *)__pyx_n_s__printminmax));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__printminmax));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__storageorder));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 9, ((PyObject *)__pyx_n_s__storageorder));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__storageorder));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__cgrib));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 10, ((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__iofst));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 11, ((PyObject *)__pyx_n_s__iofst));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__iofst));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ierr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 12, ((PyObject *)__pyx_n_s__ierr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ierr));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngpts));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 13, ((PyObject *)__pyx_n_s__ngpts));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngpts));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idrsnum));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 14, ((PyObject *)__pyx_n_s__idrsnum));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idrsnum));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__igdsnum));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 15, ((PyObject *)__pyx_n_s__igdsnum));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__igdsnum));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__igdstmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 16, ((PyObject *)__pyx_n_s__igdstmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__igdstmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idrstmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 17, ((PyObject *)__pyx_n_s__idrstmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idrstmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__fld));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 18, ((PyObject *)__pyx_n_s__fld));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fld));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__drtmpldat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 19, ((PyObject *)__pyx_n_s__drtmpldat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__drtmpldat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gdtmpldat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 20, ((PyObject *)__pyx_n_s__gdtmpldat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gdtmpldat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__rmin));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 21, ((PyObject *)__pyx_n_s__rmin));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rmin));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__rmax));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 22, ((PyObject *)__pyx_n_s__rmax));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rmax));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__n));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 23, ((PyObject *)__pyx_n_s__n));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__buflen));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 24, ((PyObject *)__pyx_n_s__buflen));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buflen));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__msg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 25, ((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__msg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__fldmax));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 26, ((PyObject *)__pyx_n_s__fldmax));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fldmax));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__fldmin));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 27, ((PyObject *)__pyx_n_s__fldmin));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fldmin));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__bitsofprecision));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 28, ((PyObject *)__pyx_n_s__bitsofprecision));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bitsofprecision));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__digitsofprecision));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 29, ((PyObject *)__pyx_n_s__digitsofprecision));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__digitsofprecision));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__format));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 30, ((PyObject *)__pyx_n_s__format));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__format));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__minmaxstring));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 31, ((PyObject *)__pyx_n_s__minmaxstring));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__minmaxstring));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__data));
+  PyTuple_SET_ITEM(__pyx_k_tuple_41, 32, ((PyObject *)__pyx_n_s__data));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));
+  __pyx_k_codeobj_42 = (PyObject*)__Pyx_PyCode_New(10, 0, 33, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__unpack7, 377, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "g2clib.pyx":460
+ * # routines for writing grib2 files.
+ * 
+ * def grib2_create(object listsec0, object listsec1):             # <<<<<<<<<<<<<<
+ *     """
+ *  Initializes a new GRIB2 message and packs
+ */
+  __pyx_k_tuple_43 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_43);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__listsec0));
+  PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_n_s__listsec0));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__listsec0));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__listsec1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_43, 1, ((PyObject *)__pyx_n_s__listsec1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__listsec1));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__isec0));
+  PyTuple_SET_ITEM(__pyx_k_tuple_43, 2, ((PyObject *)__pyx_n_s__isec0));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__isec0));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__isec1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_43, 3, ((PyObject *)__pyx_n_s__isec1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__isec1));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ierr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_43, 4, ((PyObject *)__pyx_n_s__ierr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ierr));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__listsec0dat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_43, 5, ((PyObject *)__pyx_n_s__listsec0dat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__listsec0dat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__listsec1dat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_43, 6, ((PyObject *)__pyx_n_s__listsec1dat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__listsec1dat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__buflen));
+  PyTuple_SET_ITEM(__pyx_k_tuple_43, 7, ((PyObject *)__pyx_n_s__buflen));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buflen));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__cgrib));
+  PyTuple_SET_ITEM(__pyx_k_tuple_43, 8, ((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__lgrib));
+  PyTuple_SET_ITEM(__pyx_k_tuple_43, 9, ((PyObject *)__pyx_n_s__lgrib));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lgrib));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gribmsg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_43, 10, ((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__msg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_43, 11, ((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));
+  __pyx_k_codeobj_44 = (PyObject*)__Pyx_PyCode_New(2, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__grib2_create, 460, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "g2clib.pyx":520
+ *     return gribmsg, ierr
+ * 
+ * def grib2_end(gribmsg):             # <<<<<<<<<<<<<<
+ *     """
+ * 
+ */
+  __pyx_k_tuple_45 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_45);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gribmsg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, ((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ierr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_45, 1, ((PyObject *)__pyx_n_s__ierr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ierr));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__cgrib));
+  PyTuple_SET_ITEM(__pyx_k_tuple_45, 2, ((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__msg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_45, 3, ((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));
+  __pyx_k_codeobj_46 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__grib2_end, 520, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "g2clib.pyx":562
+ *     return gribmsg, ierr
+ * 
+ * def grib2_addgrid(gribmsg,object gds,object gdstmpl,object deflist=None, defnum = 0):             # <<<<<<<<<<<<<<
+ *     """
+ *    Packs up a Grid Definition Section (Section 3)
+ */
+  __pyx_k_tuple_47 = PyTuple_New(16); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_47);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gribmsg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gds));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 1, ((PyObject *)__pyx_n_s__gds));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gds));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gdstmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 2, ((PyObject *)__pyx_n_s__gdstmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gdstmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__deflist));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 3, ((PyObject *)__pyx_n_s__deflist));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deflist));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__defnum));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 4, ((PyObject *)__pyx_n_s__defnum));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__defnum));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ierr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 5, ((PyObject *)__pyx_n_s__ierr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ierr));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idefnum));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 6, ((PyObject *)__pyx_n_s__idefnum));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idefnum));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__igds));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 7, ((PyObject *)__pyx_n_s__igds));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__igds));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__igdstmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 8, ((PyObject *)__pyx_n_s__igdstmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__igdstmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ideflist));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 9, ((PyObject *)__pyx_n_s__ideflist));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ideflist));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__cgrib));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 10, ((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gdsdat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 11, ((PyObject *)__pyx_n_s__gdsdat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gdsdat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__deflistdat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 12, ((PyObject *)__pyx_n_s__deflistdat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__deflistdat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gdstmpldat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 13, ((PyObject *)__pyx_n_s__gdstmpldat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gdstmpldat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__buflen));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 14, ((PyObject *)__pyx_n_s__buflen));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buflen));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__msg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_47, 15, ((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));
+  __pyx_k_codeobj_48 = (PyObject*)__Pyx_PyCode_New(5, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__grib2_addgrid, 562, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "g2clib.pyx":634
+ * 
+ * 
+ * def grib2_addfield(gribmsg,pdsnum,object pdstmpl,object coordlist,             # <<<<<<<<<<<<<<
+ *                    drsnum,object drstmpl,object field,
+ *                    ibitmap,object bitmap):
+ */
+  __pyx_k_tuple_49 = PyTuple_New(28); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_49);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__gribmsg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gribmsg));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__pdsnum));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 1, ((PyObject *)__pyx_n_s__pdsnum));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pdsnum));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__pdstmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 2, ((PyObject *)__pyx_n_s__pdstmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pdstmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__coordlist));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 3, ((PyObject *)__pyx_n_s__coordlist));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__coordlist));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__drsnum));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 4, ((PyObject *)__pyx_n_s__drsnum));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__drsnum));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__drstmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 5, ((PyObject *)__pyx_n_s__drstmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__drstmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__field));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 6, ((PyObject *)__pyx_n_s__field));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__field));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ibitmap));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 7, ((PyObject *)__pyx_n_s__ibitmap));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ibitmap));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__bitmap));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 8, ((PyObject *)__pyx_n_s__bitmap));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bitmap));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ierr));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 9, ((PyObject *)__pyx_n_s__ierr));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ierr));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipdsnum));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 10, ((PyObject *)__pyx_n_s__ipdsnum));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipdsnum));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__numcoord));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 11, ((PyObject *)__pyx_n_s__numcoord));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__numcoord));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ipdstmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 12, ((PyObject *)__pyx_n_s__ipdstmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ipdstmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idrsnum));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 13, ((PyObject *)__pyx_n_s__idrsnum));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idrsnum));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__idrstmpl));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 14, ((PyObject *)__pyx_n_s__idrstmpl));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idrstmpl));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__fld));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 15, ((PyObject *)__pyx_n_s__fld));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fld));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__fcoordlist));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 16, ((PyObject *)__pyx_n_s__fcoordlist));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fcoordlist));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__bmap));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 17, ((PyObject *)__pyx_n_s__bmap));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bmap));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ngrdpts));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 18, ((PyObject *)__pyx_n_s__ngrdpts));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ngrdpts));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__ibmap));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 19, ((PyObject *)__pyx_n_s__ibmap));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ibmap));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__pdtmpldat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 20, ((PyObject *)__pyx_n_s__pdtmpldat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pdtmpldat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__drtmpldat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 21, ((PyObject *)__pyx_n_s__drtmpldat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__drtmpldat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__coordlistdat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 22, ((PyObject *)__pyx_n_s__coordlistdat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__coordlistdat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__fielddat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 23, ((PyObject *)__pyx_n_s__fielddat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fielddat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__bitmapdat));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 24, ((PyObject *)__pyx_n_s__bitmapdat));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bitmapdat));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__buflen));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 25, ((PyObject *)__pyx_n_s__buflen));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__buflen));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__cgrib));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 26, ((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cgrib));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__msg));
+  PyTuple_SET_ITEM(__pyx_k_tuple_49, 27, ((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__msg));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
+  __pyx_k_codeobj_50 = (PyObject*)__Pyx_PyCode_New(9, 0, 28, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_28, __pyx_n_s__grib2_addfield, 634, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __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_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_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_254 = PyInt_FromLong(254); if (unlikely(!__pyx_int_254)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_260 = PyInt_FromLong(260); if (unlikely(!__pyx_int_260)) {__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 initg2clib(void); /*proto*/
+PyMODINIT_FUNC initg2clib(void)
+#else
+PyMODINIT_FUNC PyInit_g2clib(void); /*proto*/
+PyMODINIT_FUNC PyInit_g2clib(void)
+#endif
+{
+  PyObject *__pyx_t_1 = NULL;
+  __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_g2clib(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("g2clib"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_25), 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;}
+  #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, "g2clib")) {
+      if (unlikely(PyDict_SetItemString(modules, "g2clib", __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 (__pyx_module_is_main_g2clib) {
+    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 ---*/
+  /*--- Type import code ---*/
+  /*--- Variable import code ---*/
+  /*--- Function import code ---*/
+  /*--- Execution code ---*/
+
+  /* "g2clib.pyx":5
+ * c-wrappers that Pyrex generates."""
+ * 
+ * import math             # <<<<<<<<<<<<<<
+ * 
+ * # Some helper routines from the Python API
+ */
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__math), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__math, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":55
+ * # routines for convert to/from IEEE integers.
+ * 
+ * def rtoi_ieee(object rarr, object iarr):             # <<<<<<<<<<<<<<
+ *     """
+ *  Converts a float32 array into an int32 array of IEEE formatted values
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6g2clib_1rtoi_ieee, NULL, __pyx_n_s__g2clib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__rtoi_ieee, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":73
+ *     mkieee(rdata, idata, buflenr/4)
+ * 
+ * def itor_ieee(object iarr, object rarr):             # <<<<<<<<<<<<<<
+ *     """
+ *  Converts an int32 array of IEEE values into a float32 array.
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6g2clib_3itor_ieee, NULL, __pyx_n_s__g2clib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__itor_ieee, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":123
+ * # routines for reading grib2 files.
+ * 
+ * def unpack1(gribmsg, ipos, object zeros):             # <<<<<<<<<<<<<<
+ *     """              .      .    .                                       .
+ *  Unpacks Section 1 (Identification Section) as defined in GRIB Edition 2.
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6g2clib_5unpack1, NULL, __pyx_n_s__g2clib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__unpack1, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":177
+ * 
+ * 
+ * def unpack3(gribmsg, ipos, object zeros):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 3 (Grid Definition Section) as defined in GRIB Edition 2.
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6g2clib_7unpack3, NULL, __pyx_n_s__g2clib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__unpack3, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":237
+ *     return gds,gdtmpl,deflist,iofst/8
+ * 
+ * def unpack4(gribmsg,ipos,object zeros):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 4 (Product Definition Section) as defined in GRIB Edition 2.
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6g2clib_9unpack4, NULL, __pyx_n_s__g2clib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__unpack4, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":287
+ *     return pdtmpl,ipdsnum,coordlist,iofst/8
+ * 
+ * def unpack5(gribmsg,ipos,object zeros):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 5 (Data Representation Section) as defined in GRIB Edition 2.
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6g2clib_11unpack5, NULL, __pyx_n_s__g2clib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__unpack5, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":331
+ *     return drtmpl,idrsnum,ndpts,iofst/8
+ * 
+ * def unpack6(gribmsg,ndpts,ipos,object zeros):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 6 (Bit-Map Section) as defined in GRIB Edition 2.
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6g2clib_13unpack6, NULL, __pyx_n_s__g2clib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__unpack6, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":377
+ *     return bitmap,ibmap
+ * 
+ * def unpack7(gribmsg,gdtnum,object gdtmpl,drtnum,object drtmpl,ndpts,ipos,object zeros,printminmax=False,storageorder='C'):             # <<<<<<<<<<<<<<
+ *     """
+ *  Unpacks Section 7 (Data Section) as defined in GRIB Edition 2.
+ */
+  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_k_14 = __pyx_t_1;
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6g2clib_15unpack7, NULL, __pyx_n_s__g2clib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__unpack7, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":460
+ * # routines for writing grib2 files.
+ * 
+ * def grib2_create(object listsec0, object listsec1):             # <<<<<<<<<<<<<<
+ *     """
+ *  Initializes a new GRIB2 message and packs
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6g2clib_17grib2_create, NULL, __pyx_n_s__g2clib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__grib2_create, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":520
+ *     return gribmsg, ierr
+ * 
+ * def grib2_end(gribmsg):             # <<<<<<<<<<<<<<
+ *     """
+ * 
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6g2clib_19grib2_end, NULL, __pyx_n_s__g2clib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__grib2_end, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":562
+ *     return gribmsg, ierr
+ * 
+ * def grib2_addgrid(gribmsg,object gds,object gdstmpl,object deflist=None, defnum = 0):             # <<<<<<<<<<<<<<
+ *     """
+ *    Packs up a Grid Definition Section (Section 3)
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6g2clib_21grib2_addgrid, NULL, __pyx_n_s__g2clib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__grib2_addgrid, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":634
+ * 
+ * 
+ * def grib2_addfield(gribmsg,pdsnum,object pdstmpl,object coordlist,             # <<<<<<<<<<<<<<
+ *                    drsnum,object drstmpl,object field,
+ *                    ibitmap,object bitmap):
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6g2clib_23grib2_addfield, NULL, __pyx_n_s__g2clib); 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);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__grib2_addfield, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "g2clib.pyx":1
+ * """Pyrex code to provide python interfaces to functions             # <<<<<<<<<<<<<<
+ * in the NCEP grib2c library. Make changes to this file, not the
+ * c-wrappers that Pyrex generates."""
+ */
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  if (__pyx_m) {
+    __Pyx_AddTraceback("init g2clib", __pyx_clineno, __pyx_lineno, __pyx_filename);
+    Py_DECREF(__pyx_m); __pyx_m = 0;
+  } else if (!PyErr_Occurred()) {
+    PyErr_SetString(PyExc_ImportError, "init g2clib");
+  }
+  __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_GetName(PyObject *dict, PyObject *name) {
+    PyObject *result;
+    result = PyObject_GetAttr(dict, name);
+    if (!result) {
+        if (dict != __pyx_b) {
+            PyErr_Clear();
+            result = PyObject_GetAttr(__pyx_b, name);
+        }
+        if (!result) {
+            PyErr_SetObject(PyExc_NameError, name);
+        }
+    }
+    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 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 (cause && cause != Py_None) {
+        PyObject *fixed_cause;
+        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 Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
+    Py_ssize_t q = a / b;
+    Py_ssize_t r = a - q*b;
+    q -= ((r != 0) & ((r ^ b) < 0));
+    return q;
+}
+
+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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
+    PyObject *py_import = 0;
+    PyObject *empty_list = 0;
+    PyObject *module = 0;
+    PyObject *global_dict = 0;
+    PyObject *empty_dict = 0;
+    PyObject *list;
+    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
+    if (!py_import)
+        goto bad;
+    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, '.')) {
+                /* try package relative import first */
+                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);
+                if (!module) {
+                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
+                        goto bad;
+                    PyErr_Clear();
+                }
+            }
+            level = 0; /* try absolute import on failure */
+        }
+        #endif
+        if (!module) {
+            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
+    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:
+    Py_XDECREF(empty_list);
+    Py_XDECREF(py_import);
+    Py_XDECREF(empty_dict);
+    return module;
+}
+
+static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t val) {
+    const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0;
+    const int is_unsigned = const_zero < neg_one;
+    if ((sizeof(int32_t) == sizeof(char))  ||
+        (sizeof(int32_t) == sizeof(short))) {
+        return PyInt_FromLong((long)val);
+    } else if ((sizeof(int32_t) == sizeof(int)) ||
+               (sizeof(int32_t) == sizeof(long))) {
+        if (is_unsigned)
+            return PyLong_FromUnsignedLong((unsigned long)val);
+        else
+            return PyInt_FromLong((long)val);
+    } else if (sizeof(int32_t) == sizeof(PY_LONG_LONG)) {
+        if (is_unsigned)
+            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
+        else
+            return PyLong_FromLongLong((PY_LONG_LONG)val);
+    } else {
+        int one = 1; int little = (int)*(unsigned char *)&one;
+        unsigned char *bytes = (unsigned char *)&val;
+        return _PyLong_FromByteArray(bytes, sizeof(int32_t),
+                                     little, !is_unsigned);
+    }
+}
+
+#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
+static PyObject *__Pyx_GetStdout(void) {
+    PyObject *f = PySys_GetObject((char *)"stdout");
+    if (!f) {
+        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
+    }
+    return f;
+}
+static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
+    int i;
+    if (!f) {
+        if (!(f = __Pyx_GetStdout()))
+            return -1;
+    }
+    Py_INCREF(f);
+    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
+        PyObject* v;
+        if (PyFile_SoftSpace(f, 1)) {
+            if (PyFile_WriteString(" ", f) < 0)
+                goto error;
+        }
+        v = PyTuple_GET_ITEM(arg_tuple, i);
+        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
+            goto error;
+        if (PyString_Check(v)) {
+            char *s = PyString_AsString(v);
+            Py_ssize_t len = PyString_Size(v);
+            if (len > 0 &&
+                isspace(Py_CHARMASK(s[len-1])) &&
+                s[len-1] != ' ')
+                    PyFile_SoftSpace(f, 0);
+        }
+    }
+    if (newline) {
+        if (PyFile_WriteString("\n", f) < 0)
+            goto error;
+        PyFile_SoftSpace(f, 0);
+    }
+    Py_DECREF(f);
+    return 0;
+error:
+    Py_DECREF(f);
+    return -1;
+}
+#else /* Python 3 has a print function */
+static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
+    PyObject* kwargs = 0;
+    PyObject* result = 0;
+    PyObject* end_string;
+    if (unlikely(!__pyx_print)) {
+        __pyx_print = __Pyx_GetAttrString(__pyx_b, "print");
+        if (!__pyx_print)
+            return -1;
+    }
+    if (stream) {
+        kwargs = PyDict_New();
+        if (unlikely(!kwargs))
+            return -1;
+        if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0))
+            goto bad;
+        if (!newline) {
+            end_string = PyUnicode_FromStringAndSize(" ", 1);
+            if (unlikely(!end_string))
+                goto bad;
+            if (PyDict_SetItemString(kwargs, "end", end_string) < 0) {
+                Py_DECREF(end_string);
+                goto bad;
+            }
+            Py_DECREF(end_string);
+        }
+    } else if (!newline) {
+        if (unlikely(!__pyx_print_kwargs)) {
+            __pyx_print_kwargs = PyDict_New();
+            if (unlikely(!__pyx_print_kwargs))
+                return -1;
+            end_string = PyUnicode_FromStringAndSize(" ", 1);
+            if (unlikely(!end_string))
+                return -1;
+            if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) {
+                Py_DECREF(end_string);
+                return -1;
+            }
+            Py_DECREF(end_string);
+        }
+        kwargs = __pyx_print_kwargs;
+    }
+    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
+    if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
+        Py_DECREF(kwargs);
+    if (!result)
+        return -1;
+    Py_DECREF(result);
+    return 0;
+bad:
+    if (kwargs != __pyx_print_kwargs)
+        Py_XDECREF(kwargs);
+    return -1;
+}
+#endif
+
+#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
+static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
+    if (!f) {
+        if (!(f = __Pyx_GetStdout()))
+            return -1;
+    }
+    Py_INCREF(f);
+    if (PyFile_SoftSpace(f, 0)) {
+        if (PyFile_WriteString(" ", f) < 0)
+            goto error;
+    }
+    if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
+        goto error;
+    if (PyFile_WriteString("\n", f) < 0)
+        goto error;
+    Py_DECREF(f);
+    return 0;
+error:
+    Py_DECREF(f);
+    return -1;
+    /* the line below is just to avoid C compiler
+     * warnings about unused functions */
+    return __Pyx_Print(f, NULL, 0);
+}
+#else /* Python 3 has a print function */
+static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
+    int res;
+    PyObject* arg_tuple = PyTuple_Pack(1, o);
+    if (unlikely(!arg_tuple))
+        return -1;
+    res = __Pyx_Print(stream, arg_tuple, 1);
+    Py_DECREF(arg_tuple);
+    return res;
+}
+#endif
+
+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);
+}
+
+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_VERSION_HEX < 0x03000000
+    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 (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 {
+            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;
+    }
+}
+
+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_VERSION_HEX < 0x03000000
+    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 (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 {
+            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;
+    }
+}
+
+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_VERSION_HEX < 0x03000000
+    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 (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 {
+            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;
+    }
+}
+
+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_VERSION_HEX < 0x03000000
+    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 (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 {
+            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;
+    }
+}
+
+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_VERSION_HEX < 0x03000000
+    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 (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 {
+            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;
+    }
+}
+
+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_VERSION_HEX < 0x03000000
+    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 (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 {
+            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;
+}
+
+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;
+}
+
+
+/* Type Conversion Functions */
+
+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_VERSION_HEX < 0x03000000
+  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_VERSION_HEX < 0x03000000
+  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_VERSION_HEX < 0x03000000
+    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)-1 && PyErr_Occurred())) {
+       return (size_t)-1;
+   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
+       PyErr_SetString(PyExc_OverflowError,
+                       "value too large to convert to size_t");
+       return (size_t)-1;
+   }
+   return (size_t)val;
+}
+
+
+#endif /* Py_PYTHON_H */
diff --git a/g2clib.pyx b/g2clib.pyx
new file mode 100755
index 0000000..44a4f57
--- /dev/null
+++ b/g2clib.pyx
@@ -0,0 +1,741 @@
+"""Pyrex code to provide python interfaces to functions
+in the NCEP grib2c library. Make changes to this file, not the
+c-wrappers that Pyrex generates."""
+
+import math
+
+# Some helper routines from the Python API
+cdef extern from "Python.h":
+    # To access integers
+    object PyInt_FromLong(long)
+    long PyInt_AsLong(object)
+    # To access doubles
+    object PyFloat_FromDouble(double)
+    # To access strings
+    char * PyBytes_AsString(object string)
+    object PyBytes_FromString(char *s)
+    object PyBytes_FromStringAndSize(char *s, size_t size)
+    int PyObject_AsWriteBuffer(object, void **rbuf, Py_ssize_t *len)
+    int PyObject_AsReadBuffer(object, void **rbuf, Py_ssize_t *len)
+    int PyObject_CheckReadBuffer(object)
+
+cdef extern from "stdlib.h":
+    void free(void *ptr)
+
+# get 32 bit integer type
+cdef extern from "inttypes.h":
+    ctypedef long int32_t
+
+# Functions from grib2c lib.
+cdef extern from "grib2.h":
+    ctypedef int32_t g2int # for 64 bit machines, this should be int
+    ctypedef float g2float
+    g2int g2_unpack1(unsigned char *,g2int *,g2int **,g2int *)
+    g2int g2_unpack3(unsigned char *,g2int *,g2int **,g2int **, 
+                         g2int *,g2int **,g2int *)
+    g2int g2_unpack4(unsigned char *,g2int *,g2int *,g2int **,
+                         g2int *,g2float **,g2int *)
+    g2int g2_unpack5(unsigned char *,g2int *,g2int *,g2int *, g2int **,g2int *)
+    g2int g2_unpack6(unsigned char *,g2int *,g2int ,g2int *, g2int **)
+    g2int g2_unpack7(unsigned char *,g2int *,g2int ,g2int *,
+                         g2int ,g2int *,g2int ,g2float **)
+    g2int g2_create(unsigned char *,g2int *,g2int *)
+    g2int g2_addgrid(unsigned char *,g2int *,g2int *,g2int *,g2int ) 
+    g2int g2_addfield(unsigned char *,g2int ,g2int *,
+                     g2float *,g2int ,g2int ,g2int *,
+                     g2float *,g2int ,g2int ,g2int *)
+    g2int g2_gribend(unsigned char *)
+    void mkieee(g2float *,g2int *,g2int)
+    void rdieee(g2int *,g2float *,g2int)
+
+# Python wrappers for grib2c functions.
+
+# routines for convert to/from IEEE integers.
+
+def rtoi_ieee(object rarr, object iarr):
+    """
+ Converts a float32 array into an int32 array of IEEE formatted values
+    """
+    cdef void *rdat, *idat
+    cdef g2float *rdata, r1
+    cdef g2int *idata, i1
+    cdef Py_ssize_t bufleni, buflenr
+    if PyObject_AsReadBuffer(rarr, &rdat, &buflenr) <> 0:
+        raise RuntimeError, 'error getting buffer for input real array'
+    if PyObject_AsWriteBuffer(iarr, &idat, &bufleni)  <> 0 :
+        raise RuntimeError, 'error getting buffer for output integer array'
+    if bufleni < buflenr:
+        raise RuntimeError, 'integer output array must be as least as long a real input array'
+    rdata = <g2float *>rdat
+    idata = <g2int *>idat
+    mkieee(rdata, idata, buflenr/4)
+
+def itor_ieee(object iarr, object rarr):
+    """
+ Converts an int32 array of IEEE values into a float32 array.
+    """
+    cdef void *rdat, *idat
+    cdef g2float *rdata
+    cdef g2int *idata
+    cdef Py_ssize_t bufleni, buflenr
+    if PyObject_AsReadBuffer(rarr, &rdat, &buflenr) <> 0:
+        raise RuntimeError, 'error getting buffer for output real array'
+    if PyObject_AsWriteBuffer(iarr, &idat, &bufleni)  <> 0 :
+        raise RuntimeError, 'error getting buffer for input integer array'
+    if buflenr < bufleni:
+        raise RuntimeError, 'real output array must be as least as long a integerinput array'
+    rdata = <g2float *>rdat
+    idata = <g2int *>idat
+    rdieee(idata, rdata, bufleni/4)
+
+cdef _toarray(void *items, object a):
+    """
+ Fill a numpy array from the grib2 file.  Note that this free()s the items argument!
+    """
+    cdef void *abuf
+    cdef Py_ssize_t buflen
+    cdef g2int *idata
+    cdef g2float *fdata
+
+    # get pointer to data buffer.
+    PyObject_AsWriteBuffer(a, &abuf, &buflen)
+
+    if str(a.dtype) == 'int32':
+      idata = <g2int *>abuf
+      # fill buffer.
+      for i from 0 <= i < len(a):
+        idata[i] = (<g2int *>items)[i]
+    elif str(a.dtype) == 'float32':
+      fdata = <g2float *>abuf
+      # fill buffer.
+      for i from 0 <= i < len(a):
+        fdata[i] = (<g2float *>items)[i]
+    else:
+      free(items)
+      raise RuntimeError('unknown array type %s' % a.dtype)
+
+    free(items)
+    return a
+
+
+# routines for reading grib2 files.
+
+def unpack1(gribmsg, ipos, object zeros):
+    """              .      .    .                                       .
+ Unpacks Section 1 (Identification Section) as defined in GRIB Edition 2.
+ 
+ idsect,ipos = unpack1(gribmsg,ipos)
+
+ INPUTS:
+  gribmsg - chararcter string containing Section 1 of the GRIB2 message
+  ipos    - Byte offset for the beginning of Section 1 in gribmsg.
+  zeros   - Numeric/numpy array/scip.base zeros function (used to allocate
+            output python arrays).  Python is used to allocate the arrays
+            so no implementation-specific (Numeric, numpy array, scipy_core)
+            C API functions need to be used.  This means that any of these
+            array modules can be used simply by changing the import statement
+            in your python code.
+ RETURNS:
+  ipos    - Byte offset at the end of Section 1.
+  idsect  - numpy array containing information 
+            read from Section 1, the Identification section.
+            idsect[0]   = Identification of originating Centre
+                                 ( see Common Code Table C-1 )
+            idsect[1]   = Identification of originating Sub-centre
+            idsect[2]   = GRIB Master Tables Version Number
+                                 ( see Code Table 1.0 )
+            idsect[3]   = GRIB Local Tables Version Number
+                                 ( see Code Table 1.1 )
+            idsect[4]   = Significance of Reference Time (Code Table 1.2)
+            idsect[5]   = Year ( 4 digits )
+            idsect[6]   = Month
+            idsect[7]   = Day
+            idsect[8]   = Hour
+            idsect[9]   = Minute
+            idsect[10]  = Second
+            idsect[11]  = Production status of processed data
+                                 ( see Code Table 1.3 )
+            idsect[12]  = Type of processed data ( see Code Table 1.4 )
+ ERROR CODES:   2 = Array passed is not section 1
+                6 = memory allocation error
+    """
+    cdef unsigned char *cgrib
+    cdef g2int i, iofst, ierr, idslen
+    cdef g2int *ids
+    cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+    iofst = <g2int>PyInt_AsLong(ipos*8)
+    ierr = g2_unpack1(cgrib, &iofst, &ids, &idslen)
+    if ierr != 0:
+       msg = "Error unpacking section 1 - error code = %i" % ierr
+       raise RuntimeError(msg)
+
+    idsect = _toarray(ids, zeros(idslen, 'i4'))
+    return idsect,iofst/8
+
+
+
+def unpack3(gribmsg, ipos, object zeros):
+    """
+ Unpacks Section 3 (Grid Definition Section) as defined in GRIB Edition 2.
+
+ gds,gdtmpl,deflist,ipos = unpack3(gribmsg,ipos)
+ 
+ INPUTS:
+ cgrib    - Char array ontaining Section 3 of the GRIB2 message
+ iofst    - Byte offset for the beginning of Section 3 in cgrib.
+ zeros    - Numeric/numpy array/scip.base zeros function (used to allocate
+            output python arrays).  Python is used to allocate the arrays
+            so no implementation-specific (Numeric, numpy array, scipy_core)
+            C API functions need to be used.  This means that any of these
+            array modules can be used simply by changing the import statement
+            in your python code.
+
+ RETURNS:      
+ ipos     - Byte offset at the end of Section 3, returned.
+  gds     - numpy array containg information read from the appropriate GRIB Grid 
+            Definition Section 3 for the field being returned.
+            gds[0]=Source of grid definition (see Code Table 3.0)
+            gds[1]=Number of grid points in the defined grid.
+            gds[2]=Number of octets needed for each 
+                        additional grid points definition.  
+                        Used to define number of
+                        points in each row ( or column ) for
+                        non-regular grids.  
+                        = 0, if using regular grid.
+            gds[3]=Interpretation of list for optional points 
+                        definition.  (Code Table 3.11)
+            gds[4]=Grid Definition Template Number (Code Table 3.1)
+ gdstmpl -  numpy array containing the data values for 
+            the specified Grid Definition
+            Template ( NN=gds[4] ).  Each element of this integer 
+            array contains an entry (in the order specified) of Grid
+            Defintion Template 3.NN
+ deflist -  (Used if gds[2] != 0) numpy array containing
+            the number of grid points contained in each row ( or column ).
+            (part of Section 3)
+ ERROR CODES:   2 = Not Section 3
+                5 = "GRIB" message contains an undefined Grid Definition
+                    Template.
+                6 = memory allocation error
+    """
+    cdef unsigned char *cgrib
+    cdef g2int *igds, *igdstmpl, *ideflist
+    cdef g2int mapgridlen, iofst, idefnum, ierr
+    cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+    iofst = <g2int>PyInt_AsLong(ipos*8)
+    ierr=g2_unpack3(cgrib,&iofst,&igds,&igdstmpl,&mapgridlen,&ideflist,&idefnum)
+    if ierr != 0:
+       msg = "Error unpacking section 3 - error code = %i" % ierr
+       raise RuntimeError(msg)
+
+    gdtmpl = _toarray(igdstmpl, zeros(mapgridlen, 'i4'))
+    gds = _toarray(igds, zeros(5, 'i4'))
+    deflist = _toarray(ideflist, zeros(idefnum, 'i4'))
+
+    return gds,gdtmpl,deflist,iofst/8
+
+def unpack4(gribmsg,ipos,object zeros):
+    """
+ Unpacks Section 4 (Product Definition Section) as defined in GRIB Edition 2.
+
+ pdtmpl,pdtnum,coordlist,ipos = unpack4(gribmsg,ipos)
+ 
+ INPUTS:
+   gribmsg  - Character string containing Section 4 of the GRIB2 message
+   ipos     - Byte offset of the beginning of Section 4 in cgrib.
+   zeros    - Numeric/numpy array/scip.base zeros function (used to allocate
+              output python arrays).  Python is used to allocate the arrays
+              so no implementation-specific (Numeric, numpy array, scipy_core)
+              C API functions need to be used.  This means that any of these
+              array modules can be used simply by changing the import statement
+              in your python code.
+
+ RETURNS:       
+   pdtmpl   -  numpy array containing the data values for 
+               the specified Product Definition
+               Template ( N=ipdsnum ).  Each element of this integer
+               array contains an entry (in the order specified) 
+               of Product Defintion Template 4.N               
+   pdtnum    - Product Definition Template Number ( see Code Table 4.0)   
+   coordlist - numpy array containing floating point values 
+               intended to document
+               the vertical discretisation associated to model data
+               on hybrid coordinate vertical levels.  (part of Section 4)
+   ipos      - Byte offset of the end of Section 4, returned.
+
+ ERROR CODES: 2 = Not section 4
+              5 = "GRIB" message contains an undefined Product Definition
+                  Template.
+              6 = memory allocation error
+    """
+    cdef unsigned char *cgrib
+    cdef g2int *ipdstmpl
+    cdef g2float *icoordlist
+    cdef g2int mappdslen, iofst, ipdsnum, ierr, numcoord
+    cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+    iofst = <g2int>PyInt_AsLong(ipos*8)
+    ierr=g2_unpack4(cgrib,&iofst,&ipdsnum,&ipdstmpl,&mappdslen,&icoordlist,&numcoord)
+    if ierr != 0:
+       msg = "Error unpacking section 4 - error code = %i" % ierr
+       raise RuntimeError(msg)
+
+    pdtmpl = _toarray(ipdstmpl, zeros(mappdslen, 'i4'))
+    coordlist = _toarray(icoordlist, zeros(numcoord, 'f4'))
+
+    return pdtmpl,ipdsnum,coordlist,iofst/8
+    
+def unpack5(gribmsg,ipos,object zeros):
+    """
+ Unpacks Section 5 (Data Representation Section) as defined in GRIB Edition 2.
+
+ drtmpl,drtnum,ndpts,ipos = unpack5(gribmsg,ipos)
+
+ INPUTS:
+   gribmsg  - Character string containing Section 5 of the GRIB2 message
+   ipos     - Byte offset for the beginning of Section 5 in cgrib.
+   zeros   - Numeric/numpy array/scip.base zeros function (used to allocate
+             output python arrays).  Python is used to allocate the arrays
+             so no implementation-specific (Numeric, numpy array, scipy_core)
+             C API functions need to be used.  This means that any of these
+             array modules can be used simply by changing the import statement
+             in your python code.
+
+ RETURNS:      
+   drtmpl  -  numpy array containing the data values for 
+              the specified Data Representation
+              Template ( N=idrsnum ).  Each element of this integer
+              array contains an entry (in the order specified) of Data
+              Representation Template 5.N
+   drtnum   - Data Representation Template Number ( see Code Table 5.0)
+   ndpts    - Number of data points to be unpacked (in sxns 6 and 7).
+   ipos     - Byte offset at the end of Section 5.
+
+ ERROR CODES: 2 = Not Section 5
+              6 = memory allocation error
+              7 = "GRIB" message contains an undefined Data
+                  Representation Template
+    """
+    cdef unsigned char *cgrib
+    cdef g2int *idrstmpl
+    cdef g2int iofst, ierr, ndpts, idrsnum, mapdrslen
+    cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+    iofst = <g2int>PyInt_AsLong(ipos*8)
+    ierr=g2_unpack5(cgrib,&iofst,&ndpts,&idrsnum,&idrstmpl,&mapdrslen)
+    if ierr != 0:
+       msg = "Error unpacking section 5 - error code = %i" % ierr
+       raise RuntimeError(msg)
+
+    drtmpl = _toarray(idrstmpl, zeros(mapdrslen, 'i4'))
+    return drtmpl,idrsnum,ndpts,iofst/8
+    
+def unpack6(gribmsg,ndpts,ipos,object zeros):
+    """
+ Unpacks Section 6 (Bit-Map Section) as defined in GRIB Edition 2.
+
+ bitmap = unpack6(gribmsg,ndpts,ipos)         
+
+ INPUTS:
+   gribmsg  - String containing Section 6 of the GRIB2 message
+   ndpts    - Number of grid points specified in the bit-map (from
+              gds[1] returned by unpack3).
+   ipos     - Byte offset of the beginning of Section 6 in cgrib.
+   zeros   - Numeric/numpy array/scip.base zeros function (used to allocate
+            output python arrays).  Python is used to allocate the arrays
+            so no implementation-specific (Numeric, numpy array, scipy_core)
+            C API functions need to be used.  This means that any of these
+            array modules can be used simply by changing the import statement
+            in your python code.
+ RETURNS:      
+   bmap     - numpy array array containing decoded bitmap. 
+              ( if ibmap=0 ).  Otherwise None.
+   ibmap    - Bitmap indicator ( see Code Table 6.0 )
+              0 = bitmap applies and is included in Section 6.
+              1-253 = Predefined bitmap applies
+              254 = Previously defined bitmap applies to this field
+ ERROR CODES: 2 = Not Section 6
+              4 = Unrecognized pre-defined bit-map.
+              6 = memory allocation error
+    """
+    cdef object bitmap
+    cdef unsigned char *cgrib
+    cdef g2int iofst, ierr, ngpts, ibmap
+    cdef g2int *bmap
+    cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+    iofst = <g2int>PyInt_AsLong(ipos*8)
+    ngpts = <g2int>PyInt_AsLong(ndpts)
+    ierr=g2_unpack6(cgrib,&iofst,ngpts,&ibmap,&bmap)
+    if ierr != 0:
+        msg = "Error unpacking section 6 - error code = %i" % ierr
+        raise RuntimeError(msg)
+    if ibmap == 0:
+        bitmap = _toarray(bmap, zeros(ngpts, 'i4'))
+    else:
+        bitmap = None
+        free(bmap)
+    return bitmap,ibmap
+    
+def unpack7(gribmsg,gdtnum,object gdtmpl,drtnum,object drtmpl,ndpts,ipos,object zeros,printminmax=False,storageorder='C'):
+    """
+ Unpacks Section 7 (Data Section) as defined in GRIB Edition 2.
+
+ fld,fldmin,fldmax = unpack7(gribmsg,gdtnum,gdtmpl,drtnum,drtmpl,ndpts,ipos)
+ INPUTS:
+   gribmsg  - String containing Section 7 of the GRIB2 message
+   gdtnum   - Grid Definition Template Number ( see Code Table 3.0)
+              ( Only used for DRS Template 5.51 )
+   gdtmpl   - numpy array containing the data values for
+              the specified Grid Definition
+              Template ( N=igdsnum ).  Each element of this integer
+              array contains an entry (in the order specified) of Grid
+              Definition Template 3.N
+              ( Only used for DRS Template 5.51 )
+   drtnum   - Data Representation Template Number ( see Code Table 5.0)
+   drtmpl   - numpy array containing the data values for
+              the specified Data Representation
+              Template ( N=idrsnum ).  Each element of this integer
+              array contains an entry (in the order specified) of Data
+              Representation Template 5.N
+   ndpts    - Number of data points unpacked and returned.
+   ipos     - Byte offset of the beginning of Section 7 in cgrib.
+   zeros   - Numeric/numpy array/scip.base zeros function (used to allocate
+            output python arrays).  Python is used to allocate the arrays
+            so no implementation-specific (Numeric, numpy array, scipy_core)
+            C API functions need to be used.  This means that any of these
+            array modules can be used simply by changing the import statement
+            in your python code.
+   storageorder - 'C' for row-major, or 'F' for column-major (Default 'C')
+   printminmax - if True, min/max of fld is printed.
+
+ RETURNS:      
+   fld      - numpy array (float32) containing the unpacked data field.
+
+ ERROR CODES: 2 = Not section 7
+              4 = Unrecognized Data Representation Template
+              5 = need one of GDT 3.50 through 3.53 to decode DRT 5.51
+              6 = memory allocation error
+    """
+    cdef unsigned char *cgrib
+    cdef g2int iofst, ierr, ngpts, idrsnum, igdsnum
+    cdef g2int *igdstmpl, *idrstmpl
+    cdef g2float *fld
+    cdef void *drtmpldat, *gdtmpldat
+    cdef float rmin, rmax
+    cdef int n
+    cdef Py_ssize_t buflen
+    cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+    iofst = <g2int>PyInt_AsLong(ipos*8)
+    ngpts = <g2int>PyInt_AsLong(ndpts)
+    idrsnum = <g2int>PyInt_AsLong(drtnum)
+    igdsnum = <g2int>PyInt_AsLong(gdtnum)
+    PyObject_AsReadBuffer(drtmpl, &drtmpldat, &buflen) 
+    PyObject_AsReadBuffer(gdtmpl, &gdtmpldat, &buflen) 
+    idrstmpl = <g2int *>drtmpldat
+    igdstmpl = <g2int *>gdtmpldat
+    ierr=g2_unpack7(cgrib,&iofst,igdsnum,igdstmpl,idrsnum,idrstmpl,ngpts,&fld)
+    if ierr != 0:
+       msg = "Error unpacking section 7 - error code = %i" % ierr
+       raise RuntimeError(msg)
+
+
+    if printminmax:
+        rmax=-<float>9.9e31
+        rmin=<float>9.9e31
+        for n from 0 <= n < ndpts:
+            if fld[n] > rmax: rmax=fld[n]
+            if fld[n] < rmin: rmin=fld[n]
+        fldmax = PyFloat_FromDouble(rmax)
+        fldmin = PyFloat_FromDouble(rmin)
+        bitsofprecision = drtmpl[3]
+        digitsofprecision = int(math.ceil(math.log10(math.pow(2,bitsofprecision))))
+        format = "%."+repr(digitsofprecision+1)+"g"
+        minmaxstring = 'min/max='+format+'/'+format
+        minmaxstring = minmaxstring % (fldmin,fldmax)
+        print minmaxstring
+
+    data = _toarray(fld, zeros(ngpts, 'f4', order=storageorder))
+    return data
+
+# routines for writing grib2 files.
+
+def grib2_create(object listsec0, object listsec1):
+    """
+ Initializes a new GRIB2 message and packs
+ GRIB2 sections 0 (Indicator Section) and 1 (Identification Section).
+ This routine is used with routines "g2_addgrid", 
+ "grib2_addfield", and "grib2_gribend" to create a complete GRIB2 message.  
+ grib2_create must be called first to initialize a new GRIB2 message.
+ Also, a call to grib2_gribend is required to complete GRIB2 message
+ after all fields have been added.
+
+ gribmsg, ierr = grib2_create(listsec0, listsec1)
+
+   INPUT ARGUMENTS:
+     
+     listsec0 - numpy array containing info needed for GRIB Indicator Section 0.
+                Must have length >= 2.
+                listsec0[0]=Discipline-GRIB Master Table Number
+                            (see Code Table 0.0)
+                listsec0[1]=GRIB Edition Number (currently 2)
+     listsec1 - numpy array containing info needed for GRIB Identification Section 1.
+                Must have len >= 13.
+                listsec1[0]=Id of orginating centre (Common Code Table C-1)
+                listsec1[1]=Id of orginating sub-centre (local table)
+                listsec1[2]=GRIB Master Tables Version Number (Code Table 1.0)
+                listsec1[3]=GRIB Local Tables Version Number (Code Table 1.1)
+                listsec1[4]=Significance of Reference Time (Code Table 1.2)
+                listsec1[5]=Reference Time - Year (4 digits)
+                listsec1[6]=Reference Time - Month
+                listsec1[7]=Reference Time - Day
+                listsec1[8]=Reference Time - Hour
+                listsec1[9]=Reference Time - Minute
+                listsec1[10]=Reference Time - Second
+                listsec1[11]=Production status of data (Code Table 1.3)
+                listsec1[12]=Type of processed data (Code Table 1.4)
+
+   OUTPUT ARGUMENTS:      
+     gribmsg  - string containing the new GRIB2 message.
+     ierr     - return code.
+              > 0 = Current size of new GRIB2 message
+               -1 = Tried to use for version other than GRIB Edition 2
+    """
+    cdef g2int *isec0, *isec1, ierr
+    cdef void *listsec0dat, *listsec1dat
+    cdef Py_ssize_t buflen
+    cdef unsigned char *cgrib
+    # cgrib needs to be big enough to hold sec0 and sec1.
+    lgrib = 4*(len(listsec0)+len(listsec1))
+    gribmsg = lgrib*b" "
+    cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+    PyObject_AsReadBuffer(listsec0, &listsec0dat, &buflen) 
+    PyObject_AsReadBuffer(listsec1, &listsec1dat, &buflen) 
+    isec0 = <g2int *>listsec0dat
+    isec1 = <g2int *>listsec1dat
+    ierr = g2_create(cgrib,isec0,isec1)
+    if ierr < 0:
+       msg = "Error in grib2_create, error code = %i" % ierr
+       raise RuntimeError(msg)
+    gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+    return gribmsg, ierr
+
+def grib2_end(gribmsg):
+    """
+
+    Finalizes a GRIB2 message after all grids
+    and fields have been added.  It adds the End Section ( "7777" )
+    to the end of the GRIB message and calculates the length and stores
+    it in the appropriate place in Section 0.
+    This routine is used with routines "g2_create",  
+    "g2_addgrid", and "g2_addfield" to create a complete GRIB2 message.
+    g2_create must be called first to initialize a new GRIB2 message.
+
+  gribmsg, ierr = grib2_end(gribmsg)
+  
+    INPUT ARGUMENT:
+      gribmsg  - String containing all the data sections added
+                 be previous calls to g2_create, g2_addgrid,
+                 and g2_addfield.
+
+    OUTPUT ARGUMENTS:      
+      gribmsg  - String containing the finalized GRIB2 message
+
+    RETURN VALUES:
+      ierr     - Return code.
+               > 0 = Length of the final GRIB2 message in bytes.
+                -1 = GRIB message was not initialized.  Need to call
+                     routine g2_create first.
+                -2 = GRIB message already complete.  
+                -3 = Sum of Section byte counts doesn't add to total byte count
+                -4 = Previous Section was not 7.
+    """
+    cdef g2int ierr
+    cdef unsigned char *cgrib
+    # add some extra space to grib message (enough to hold section 8).
+    gribmsg = gribmsg + b'        '
+    cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+    ierr = g2_gribend(cgrib)
+    if ierr < 0:
+       msg = "error in grib2_end, error code = %i" % ierr
+       raise RuntimeError(msg)
+    gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+    return gribmsg, ierr
+
+def grib2_addgrid(gribmsg,object gds,object gdstmpl,object deflist=None, defnum = 0):
+    """
+   Packs up a Grid Definition Section (Section 3) 
+   and adds it to a GRIB2 message.  It is used with routines "g2_create",
+   "g2_addfield" and "g2_gribend" to create a complete GRIB2 message.
+   g2_create must be called first to initialize a new GRIB2 message.
+
+   gribmsg, ierr = grib2_addgrid(gribmsg,gds,gdstmpl,ideflist)
+ 
+   INPUT ARGUMENTS:
+     cgrib    - Char array that contains the GRIB2 message to which
+                section should be added.
+     gds      - Contains information needed for GRIB Grid Definition Section 3
+                Must be dimensioned >= 5.
+                gds[0]=Source of grid definition (see Code Table 3.0)
+                gds[1]=Number of grid points in the defined grid.
+                gds[2]=Number of octets needed for each 
+                            additional grid points definition.  
+                            Used to define number of
+                            points in each row ( or column ) for
+                            non-regular grids.  
+                            = 0, if using regular grid.
+                gds[3]=Interpretation of list for optional points 
+                            definition.  (Code Table 3.11)
+                gds[4]=Grid Definition Template Number (Code Table 3.1)
+     gdstmpl  - Contains the data values for the specified Grid Definition
+                Template ( NN=gds[4] ).  Each element of this integer 
+                array contains an entry (in the order specified) of Grid
+                Defintion Template 3.NN
+     deflist  - (Used if gds[2] != 0)  This array contains the
+                number of grid points contained in each row ( or column )
+
+   OUTPUT ARGUMENTS:      
+     cgrib    - Char array to contain the updated GRIB2 message.
+                Must be allocated large enough to store the entire
+                GRIB2 message.
+
+   RETURN VALUES:
+     ierr     - Return code.
+              > 0 = Current size of updated GRIB2 message
+               -1 = GRIB message was not initialized.  Need to call
+                    routine gribcreate first.
+               -2 = GRIB message already complete.  Cannot add new section.
+               -3 = Sum of Section byte counts doesn't add to total byte count
+               -4 = Previous Section was not 1, 2 or 7.
+               -5 = Could not find requested Grid Definition Template.
+    """
+    cdef g2int ierr, idefnum, *igds, *igdstmpl, *ideflist
+    cdef unsigned char  *cgrib
+    cdef void *gdsdat, *deflistdat, *gdstmpldat
+    cdef Py_ssize_t buflen
+    PyObject_AsReadBuffer(gds, &gdsdat, &buflen) 
+    PyObject_AsReadBuffer(gdstmpl, &gdstmpldat, &buflen) 
+    igds = <g2int *>gdsdat
+    igdstmpl = <g2int *>gdstmpldat
+    if igds[2] != 0:
+       PyObject_AsReadBuffer(deflist, &deflistdat, &buflen) 
+       ideflist = <g2int *>deflistdat
+       idefnum = <g2int>PyInt_AsLong(len(deflist))
+    else:
+       ideflist = NULL
+       idefnum = 0
+    gribmsg = gribmsg + 4*(256+4+gds[2]+1)*b" "
+    cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+    ierr = g2_addgrid(cgrib, igds, igdstmpl, ideflist, idefnum)
+    if ierr < 0:
+       msg = "error in grib2_addgrid, error code = %i" % ierr
+       raise RuntimeError(msg)
+    gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+    return gribmsg, ierr
+
+
+def grib2_addfield(gribmsg,pdsnum,object pdstmpl,object coordlist,
+                   drsnum,object drstmpl,object field,
+                   ibitmap,object bitmap):
+    """
+   Packs up Sections 4 through 7 for a given field
+   and adds them to a GRIB2 message.  They are Product Definition Section,
+   Data Representation Section, Bit-Map Section and Data Section, respectively.
+   This routine is used with routines "g2_create",  
+   "g2_addgrid", and "g2_gribend" to create a complete GRIB2 message.  
+   g2_create must be called first to initialize a new GRIB2 message.
+   g2_addgrid must be called after g2_create and
+   before this routine to add the appropriate grid description to
+   the GRIB2 message. A call to g2_gribend is required to complete 
+   GRIB2 message after all fields have been added.
+
+   gribmsg, ierr = g2_addfield(gribmsg,pdsnum,pdstmpl,coordlist,drsnum,
+                               drstmpl,fld,ngrdpts,ibmap,bmap)
+   INPUT ARGUMENT LIST:
+     cgrib    - Char array that contains the GRIB2 message to which sections
+                4 through 7 should be added.
+     pdsnum   - Product Definition Template Number ( see Code Table 4.0)
+     pdstmpl  - numpy array with data values for the specified Product Definition
+                Template ( N=pdsnum ).  Each element of this integer 
+                array contains an entry (in the order specified) of Product
+                Defintion Template 4.N
+     coordlist- numpy array (float32) containg floating point values intended to
+                document the vertical discretisation associated to model data
+                on hybrid coordinate vertical levels.
+     numcoord - number of values in array coordlist.
+     drsnum   - Data Representation Template Number ( see Code Table 5.0 )
+     drstmpl  - numpy array with data values for the specified Data Representation
+                Template ( N=drsnum ).  Each element of this integer 
+                array contains an entry (in the order specified) of Data
+                Representation Template 5.N
+                Note that some values in this template (eg. reference
+                values, number of bits, etc...) may be changed by the
+                data packing algorithms.
+                Use this to specify scaling factors and order of
+                spatial differencing, if desired.
+     field    - numpy array (float32) of data points to pack.
+     ngrdpts  - Number of data points in grid.
+                i.e.  size of fld and bmap.
+     ibitmap  - Bitmap indicator ( see Code Table 6.0 )
+                0 = bitmap applies and is included in Section 6.
+                1-253 = Predefined bitmap applies
+                254 = Previously defined bitmap applies to this field
+                255 = Bit map does not apply to this product.
+     bitmap   - numpy array (int32) containing bitmap to be added. 
+                (if ibitmap=0 or 254)
+
+   OUTPUT ARGUMENT LIST:      
+     gribmsg  - String with the updated GRIB2 message.
+                Must be allocated large enough to store the entire
+                GRIB2 message.
+
+   RETURN VALUES:
+     ierr     - Return code.
+              > 0 = Current size of updated GRIB2 message
+               -1 = GRIB message was not initialized.  Need to call
+                    routine gribcreate first.
+               -2 = GRIB message already complete.  Cannot add new section.
+               -3 = Sum of Section byte counts doesn't add to total byte count
+               -4 = Previous Section was not 3 or 7.
+               -5 = Could not find requested Product Definition Template.
+               -6 = Section 3 (GDS) not previously defined in message
+               -7 = Tried to use unsupported Data Representationi Template
+               -8 = Specified use of a previously defined bitmap, but one
+                    does not exist in the GRIB message.
+               -9 = GDT of one of 5.50 through 5.53 required to pack field 
+                    using DRT 5.51.
+              -10 = Error packing data field. 
+    """
+    cdef g2int ierr,ipdsnum,numcoord,*ipdstmpl,idrsnum,*idrstmpl
+    cdef g2float *fld, *fcoordlist
+    cdef g2int *bmap, ngrdpts, ibmap
+    cdef void *pdtmpldat, *drtmpldat, *coordlistdat, *fielddat, *bitmapdat
+    cdef Py_ssize_t buflen
+    cdef unsigned char *cgrib
+    ipdsnum = <g2int>PyInt_AsLong(pdsnum)
+    PyObject_AsReadBuffer(pdstmpl, &pdtmpldat, &buflen) 
+    ipdstmpl = <g2int *>pdtmpldat
+    idrsnum = <g2int>PyInt_AsLong(drsnum)
+    PyObject_AsReadBuffer(drstmpl, &drtmpldat, &buflen) 
+    idrstmpl = <g2int *>drtmpldat
+    if coordlist is not None:
+        PyObject_AsReadBuffer(coordlist, &coordlistdat, &buflen) 
+        fcoordlist = <g2float *>coordlistdat
+        numcoord = len(coordlist)
+    else:
+        fcoordlist = NULL
+        numcoord = 0
+    PyObject_AsReadBuffer(field, &fielddat, &buflen) 
+    fld = <g2float *>fielddat
+    ibmap = <g2int>PyInt_AsLong(ibitmap)
+    ngrdpts = len(field)
+    if ibitmap == 0 or ibitmap == 254:
+        PyObject_AsReadBuffer(bitmap, &bitmapdat, &buflen) 
+        bmap  = <g2int *>bitmapdat
+    else:
+        bmap = NULL
+    gribmsg = gribmsg + 4*(len(drstmpl)+ngrdpts+4)*b" "
+    cgrib = <unsigned char *>PyBytes_AsString(gribmsg)
+    ierr = g2_addfield(cgrib,ipdsnum,ipdstmpl,fcoordlist,numcoord,idrsnum,idrstmpl,fld,ngrdpts,ibmap,bmap)
+    if ierr < 0:
+       msg = "error in grib2_addfield, error code = %i" % ierr
+       raise RuntimeError(msg)
+    gribmsg = PyBytes_FromStringAndSize(<char *>cgrib, ierr)
+    return gribmsg, ierr
diff --git a/man/cnvgrib1to2.1 b/man/cnvgrib1to2.1
new file mode 100644
index 0000000..b037407
--- /dev/null
+++ b/man/cnvgrib1to2.1
@@ -0,0 +1,64 @@
+.\"updated 31-Oct-2013 by Jos de Kloe <josdekloe at gmail.com>
+
+.TH CNVGRIB1TO2 1 "2013-10-31" "pygrib"
+
+.SH NAME
+.B cnvgrib1to2 \- Convert a GRIB1 file to GRIB2 format
+
+.SH SYNOPSIS
+.B cnvgrib1tos21 
+.I <grib1filename> 
+.I <grib2filename>
+.I [packing_scheme]
+
+.SH DESCRIPTION
+This command (from the pygrib package) converts a GRIB1 formatted file
+to GRIB2 formatted file.
+
+GRIB is a file format defined for meteorological data defined by
+the WMO (World Meteorological Organisation).
+It is commonly used in meteorology to store historical and forecast
+weather data.
+
+.SH OPTIONS
+This program takes an optional 
+.I packing_scheme
+which may be one of:
+.TP
+.B grid_simple
+.TP
+.B grid_complex
+.TP
+.B grid_complex_spatial_differencing
+.TP
+.B grid_jpeg
+.TP
+.B grid_png
+.P
+The default is 
+.I 'grid_jpeg'
+
+.SH EXIT STATUS
+.TP
+0
+if OK or if the program did not start due to a wrong number
+of commandline arguments
+.TP
+1
+if the program failed during the conversion stage
+
+.SH AUTHORS
+Jeffrey Whitaker <jeffrey.s.whitaker at noaa.gov> wrote the code.
+.br
+Alastair McKinstry <mckinstry at debian.org> wrote this man page
+
+.SH SEE ALSO
+Related tools are
+.B cnvgrib2to1,
+.B grib_list
+and
+.B grib_repack
+which are all based on the more general python module
+.I pygrib
+and the c-library 
+.I gribapi
diff --git a/man/cnvgrib2to1.1 b/man/cnvgrib2to1.1
new file mode 100644
index 0000000..2615535
--- /dev/null
+++ b/man/cnvgrib2to1.1
@@ -0,0 +1,45 @@
+.\"updated 31-Oct-2013 by Jos de Kloe <josdekloe at gmail.com>
+
+.TH CNVGRIB2TO1 1 "2013-10-31" "pygrib"
+
+.SH NAME
+.B cnvgrib2to1 \- Convert a GRIB2 file to GRIB1 format
+
+.SH SYNOPSIS
+.B cnvgrib2to1 
+.I <grib2filename> 
+.I <grib1filename>
+
+.SH DESCRIPTION
+This command (from the pygrib package) converts a GRIB2 formatted file
+to a GRIB1 formatted file.
+
+GRIB is a file format defined for meteorological data defined by
+the WMO (World Meteorological Organisation).
+It is commonly used in meteorology to store historical and forecast
+weather data.
+
+.SH EXIT STATUS
+.TP
+0
+if OK or if the program did not start due to a wrong number
+of commandline arguments
+.TP
+1
+if the program failed during the conversion stage
+
+.SH AUTHORS
+Jeffrey Whitaker <jeffrey.s.whitaker at noaa.gov> wrote the code.
+.br
+Alastair McKinstry <mckinstry at debian.org> wrote this man page
+
+.SH SEE ALSO
+Related tools are
+.B cnvgrib1to2,
+.B grib_list
+and
+.B grib_repack
+which are all based on the more general python module
+.I pygrib
+and the c-library 
+.I gribapi
diff --git a/man/grib_list.1 b/man/grib_list.1
new file mode 100644
index 0000000..1e3ba1d
--- /dev/null
+++ b/man/grib_list.1
@@ -0,0 +1,49 @@
+.\"updated 31-Oct-2013 by Jos de Kloe <josdekloe at gmail.com>
+
+.TH grib_list 1 "2013-10-31" "pygrib"
+
+.SH NAME
+.B grib_list \- List the contents of a GRIB or GRIB2 file
+
+.SH SYNOPSIS
+.B grib_list
+.I gribfile [-s] [-m]
+
+.SH DESCRIPTION
+This command (from the pygrib package) lists the contents
+of a GRIB1 or GRIB2 (meteorological data) formatted file.
+
+.SH OPTIONS
+Optional parameters (only one can be specified):
+.TP
+.B -s
+Give a short, rather than long, form of the listing.
+.TP
+.B -m
+Adds min/max of data to short listing.
+
+.SH EXIT STATUS
+.TP
+0
+if OK
+.TP
+1
+if the program failed during the list stage
+or if it did not start due to a wrong number
+of commandline arguments
+
+.SH AUTHORS
+Jeffrey Whitaker <jeffrey.s.whitaker at noaa.gov> wrote the code.
+.br
+Alastair McKinstry <mckinstry at debian.org> wrote this man page.
+
+.SH SEE ALSO
+Related tools are
+.B cnvgrib1to2,
+.B cnvgrib2to1,
+and
+.B grib_repack
+which are all based on the more general python module
+.I pygrib
+and the c-library 
+.I gribapi
diff --git a/man/grib_repack.1 b/man/grib_repack.1
new file mode 100644
index 0000000..ef8cfce
--- /dev/null
+++ b/man/grib_repack.1
@@ -0,0 +1,75 @@
+.\"updated 31-Oct-2013 by Jos de Kloe <josdekloe at gmail.com>
+
+.TH grib_repack 1 "2013-10-31" "pygrib"
+
+.SH NAME
+.B grib_repack \- change the packing scheme in a GRIB2 file
+
+.SH SYNOPSIS
+.B grib_repack 
+.I -pN grib2filein grib2fileout
+.PP
+.B grib_repack -h 
+
+.SH DESCRIPTION
+This command (from the pygrib package) repacks the data in 
+.I grib2filein
+with a different packing scheme, and writes it to a new file named
+.I grib2fileout
+
+.SH OPTIONS
+The following optional parameter is available:
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+show help message
+.TP
+The following parameter is required for normal use and not optional:
+.TP
+\fB\-pN\fR
+Desired packing type, where 
+.I N 
+is:
+.TP
+.B 0
+for simple packing
+.TP
+.B 1
+for simple matrix packing
+.TP
+.B 2
+for complex packing
+.TP
+.B 3
+for complex packing with spatial differencing
+.TP
+.B 4
+for no packing (ieee)
+.TP
+.B 40
+for JPEG2000 packing
+.TP
+.B 41
+for PNG packing
+.TP
+.B 61
+for simple log pre-processing
+
+.SH EXIT STATUS
+.TP
+0
+if OK
+.TP
+1
+if the program failed during the list stage
+or if it did not start due to incorrect commandline arguments
+
+.SH EXAMPLE
+The following commnd converts grib2filein to complex packing
+with spatial differencing, saves result to grib2fileout.
+.TP
+grib_repack -p3 grib2filein grib2fileout
+
+.SH AUTHORS
+Jeffrey Whitaker <jeffrey.s.whitaker at noaa.gov> wrote the code.
+.br
+Alastair McKinstry <mckinstry at debian.org> wrote this man page.
diff --git a/ncepgrib2.py b/ncepgrib2.py
new file mode 100755
index 0000000..5825ac9
--- /dev/null
+++ b/ncepgrib2.py
@@ -0,0 +1,1432 @@
+__version__ = '1.9.3'
+import g2clib
+import struct
+import string
+import math
+import warnings
+import operator
+from datetime import datetime
+try:
+    from StringIO import StringIO
+except ImportError:
+    from io import BytesIO as StringIO
+
+import numpy as np
+from numpy import ma
+try:
+    import pyproj
+except ImportError:
+    try:
+        from mpl_toolkits.basemap import pyproj
+    except:
+        raise ImportError("either pyproj or basemap required")
+
+# Code Table 3.2: Shape of the Earth.
+_earthparams={0:6367470.0,
+1:'Spherical - radius specified in m by data producer',
+2:(6378160.0,6356775.0),
+3:'OblateSpheroid - major and minor axes specified in km by data producer',
+4:(6378137.0,6356752.314),
+5:'WGS84',
+6:6371229.0,
+7:'OblateSpheroid - major and minor axes specified in m by data producer',
+8:6371200.0,
+255:'Missing'}
+for _n in range(192):
+    if not _n in _earthparams: _earthparams[_n]='Reserved'
+for _n in range(192,255):
+    _earthparams[_n] = 'Reserved for local use'
+
+_table0={1:('Melbourne (WMC)','ammc'),
+2:('Melbourne - BMRC (WMC)',None),
+3:('Melbourne (WMC)',None),
+4:('Moscow (WMC)',None),
+5:('Moscow (WMC)',None),
+6:('Moscow (WMC)',None),
+7:('US National Weather Service - NCEP (WMC)','kwbc'),
+8:('US National Weather Service - NWSTG (WMC)',None),
+9:('US National Weather Service - Other (WMC)',None),
+10:('Cairo (RSMC/RAFC)',None),
+11:('Cairo (RSMC/RAFC)',None),
+12:('Dakar (RSMC/RAFC)',None),
+13:('Dakar (RSMC/RAFC)',None),
+14:('Nairobi (RSMC/RAFC)',None),
+15:('Nairobi (RSMC/RAFC)',None),
+16:('Casablanca',None),
+17:('Tunis (RSMC)',None),
+18:('Tunis-Casablanca (RSMC)',None),
+19:('Tunis-Casablanca (RSMC)',None),
+20:('Las Palmas (RAFC)',None),
+21:('Algiers (RSMC)',None),
+22:('ACMAD',None),
+23:('Mozambique (NMC)',None),
+24:('Pretoria (RSMC)',None),
+25:('La Reunion (RSMC)',None),
+26:('Khabarovsk (RSMC)',None),
+27:('Khabarovsk (RSMC)',None),
+28:('New Delhi (RSMC/RAFC)',None),
+29:('New Delhi (RSMC/RAFC)',None),
+30:('Novosibirsk (RSMC)',None),
+31:('Novosibirsk (RSMC)',None),
+32:('Tashkent (RSMC)',None),
+33:('Jeddah (RSMC)',None),
+34:('Japanese Meteorological Agency - Tokyo (RSMC)','rjtd'),
+35:('Japanese Meteorological Agency - Tokyo (RSMC)',None),
+36:('Bankok',None),
+37:('Ulan Bator',None),
+38:('Beijing (RSMC)','babj'),
+39:('Beijing (RSMC)',None),
+40:('Korean Meteorological Administration - Seoul','rksl'),
+41:('Buenos Aires (RSMC/RAFC)',None),
+42:('Buenos Aires (RSMC/RAFC)',None),
+43:('Brasilia (RSMC/RAFC)',None),
+44:('Brasilia (RSMC/RAFC)',None),
+45:('Santiago',None),
+46:('Brazilian Space Agency - INPE','sbsj'),
+47:('Columbia (NMC)',None),
+48:('Ecuador (NMC)',None),
+49:('Peru (NMC)',None),
+50:('Venezuela (NMC)',None),
+51:('Miami (RSMC/RAFC)',None),
+52:('Tropical Prediction Center (NHC), Miami (RSMC)',None),
+53:('Canadian Meteorological Service - Montreal (RSMC)',None),
+54:('Canadian Meteorological Service - Montreal (RSMC)','cwao'),
+55:('San Francisco',None),
+56:('ARINC Center',None),
+57:('U.S. Air Force - Global Weather Center',None),
+58:('US Navy - Fleet Numerical Oceanography Center','fnmo'),
+59:('NOAA Forecast Systems Lab, Boulder CO',None),
+60:('National Center for Atmospheric Research (NCAR), Boulder, CO',None),
+61:('Service ARGOS - Landover, MD, USA',None),
+62:('US Naval Oceanographic Office',None),
+63:('Reserved',None),
+64:('Honolulu',None),
+65:('Darwin (RSMC)',None),
+66:('Darwin (RSMC)',None),
+67:('Melbourne (RSMC)',None),
+68:('Reserved',None),
+69:('Wellington (RSMC/RAFC)',None),
+70:('Wellington (RSMC/RAFC)',None),
+71:('Nadi (RSMC)',None),
+72:('Singapore',None),
+73:('Malaysia (NMC)',None),
+74:('U.K. Met Office - Exeter (RSMC)','egrr'),
+75:('U.K. Met Office - Exeter (RSMC)',None),
+76:('Moscow (RSMC/RAFC)',None),
+77:('Reserved',None),
+78:('Offenbach (RSMC)','edzw'),
+79:('Offenbach (RSMC)',None),
+80:('Rome (RSMC)','cnmc'),
+81:('Rome (RSMC)',None),
+82:('Norrkoping',None),
+83:('Norrkoping',None),
+84:('French Weather Service - Toulouse','lfpw'),
+85:('French Weather Service - Toulouse','lfpw'),
+86:('Helsinki',None),
+87:('Belgrade',None),
+88:('Oslo',None),
+89:('Prague',None),
+90:('Episkopi',None),
+91:('Ankara',None),
+92:('Frankfurt/Main (RAFC)',None),
+93:('London (WAFC)',None),
+94:('Copenhagen',None),
+95:('Rota',None),
+96:('Athens',None),
+97:('European Space Agency (ESA)',None),
+98:('European Center for Medium-Range Weather Forecasts (RSMC)','ecmf'),
+99:('De BiltNone), Netherlands',None),
+100:('Brazzaville',None),
+101:('Abidjan',None),
+102:('Libyan Arab Jamahiriya (NMC)',None),
+103:('Madagascar (NMC)',None),
+104:('Mauritius (NMC)',None),
+105:('Niger (NMC)',None),
+106:('Seychelles (NMC)',None),
+107:('Uganda (NMC)',None),
+108:('Tanzania (NMC)',None),
+109:('Zimbabwe (NMC)',None),
+110:('Hong-Kong',None),
+111:('Afghanistan (NMC)',None),
+112:('Bahrain (NMC)',None),
+113:('Bangladesh (NMC)',None),
+114:('Bhutan (NMC)',None),
+115:('Cambodia (NMC)',None),
+116:("Democratic People's Republic of Korea (NMC)",None),
+117:('Islamic Republic of Iran (NMC)',None),
+118:('Iraq (NMC)',None),
+119:('Kazakhstan (NMC)',None),
+120:('Kuwait (NMC)',None),
+121:('Kyrgyz Republic (NMC)',None),
+122:("Lao People's Democratic Republic (NMC)",None),
+123:('MacaoNone), China',None),
+124:('Maldives (NMC)',None),
+125:('Myanmar (NMC)',None),
+126:('Nepal (NMC)',None),
+127:('Oman (NMC)',None),
+128:('Pakistan (NMC)',None),
+129:('Qatar (NMC)',None),
+130:('Republic of Yemen (NMC)',None),
+131:('Sri Lanka (NMC)',None),
+132:('Tajikistan (NMC)',None),
+133:('Turkmenistan (NMC)',None),
+134:('United Arab Emirates (NMC)',None),
+135:('Uzbekistan (NMC)',None),
+136:('Socialist Republic of Viet Nam (NMC)',None),
+137:('Reserved',None),
+138:('Reserved',None),
+139:('Reserved',None),
+140:('Bolivia (NMC)',None),
+141:('Guyana (NMC)',None),
+142:('Paraguay (NMC)',None),
+143:('Suriname (NMC)',None),
+144:('Uruguay (NMC)',None),
+145:('French Guyana',None),
+146:('Brazilian Navy Hydrographic Center',None),
+147:('Reserved',None),
+148:('Reserved',None),
+149:('Reserved',None),
+150:('Antigua and Barbuda (NMC)',None),
+151:('Bahamas (NMC)',None),
+152:('Barbados (NMC)',None),
+153:('Belize (NMC)',None),
+154:('British Caribbean Territories Center',None),
+155:('San Jose',None),
+156:('Cuba (NMC)',None),
+157:('Dominica (NMC)',None),
+158:('Dominican Republic (NMC)',None),
+159:('El Salvador (NMC)',None),
+160:('US NOAA/NESDIS',None),
+161:('US NOAA Office of Oceanic and Atmospheric Research',None),
+162:('Guatemala (NMC)',None),
+163:('Haiti (NMC)',None),
+164:('Honduras (NMC)',None),
+165:('Jamaica (NMC)',None),
+166:('Mexico',None),
+167:('Netherlands Antilles and Aruba (NMC)',None),
+168:('Nicaragua (NMC)',None),
+169:('Panama (NMC)',None),
+170:('Saint Lucia (NMC)',None),
+171:('Trinidad and Tobago (NMC)',None),
+172:('French Departments',None),
+173:('Reserved',None),
+174:('Reserved',None),
+175:('Reserved',None),
+176:('Reserved',None),
+177:('Reserved',None),
+178:('Reserved',None),
+179:('Reserved',None),
+180:('Reserved',None),
+181:('Reserved',None),
+182:('Reserved',None),
+183:('Reserved',None),
+184:('Reserved',None),
+185:('Reserved',None),
+186:('Reserved',None),
+187:('Reserved',None),
+188:('Reserved',None),
+189:('Reserved',None),
+190:('Cook Islands (NMC)',None),
+191:('French Polynesia (NMC)',None),
+192:('Tonga (NMC)',None),
+193:('Vanuatu (NMC)',None),
+194:('Brunei (NMC)',None),
+195:('Indonesia (NMC)',None),
+196:('Kiribati (NMC)',None),
+197:('Federated States of Micronesia (NMC)',None),
+198:('New Caledonia (NMC)',None),
+199:('Niue',None),
+200:('Papua New Guinea (NMC)',None),
+201:('Philippines (NMC)',None),
+202:('Samoa (NMC)',None),
+203:('Solomon Islands (NMC)',None),
+204:('Reserved',None),
+205:('Reserved',None),
+206:('Reserved',None),
+207:('Reserved',None),
+208:('Reserved',None),
+209:('Reserved',None),
+210:('Frascati',None),
+211:('Lanion',None),
+212:('Lisboa',None),
+213:('Reykjavik',None),
+214:('Madrid','lemm'),
+215:('Zurich',None),
+216:('Service ARGOS - ToulouseNone), FR',None),
+217:('Bratislava',None),
+218:('Budapest',None),
+219:('Ljubljana',None),
+220:('Warsaw',None),
+221:('Zagreb',None),
+222:('Albania (NMC)',None),
+223:('Armenia (NMC)',None),
+224:('Austria (NMC)',None),
+225:('Azerbaijan (NMC)',None),
+226:('Belarus (NMC)',None),
+227:('Belgium (NMC)',None),
+228:('Bosnia and Herzegovina (NMC)',None),
+229:('Bulgaria (NMC)',None),
+230:('Cyprus (NMC)',None),
+231:('Estonia (NMC)',None),
+232:('Georgia (NMC)',None),
+233:('Dublin',None),
+234:('Israel (NMC)',None),
+235:('Jordan (NMC)',None),
+236:('Latvia (NMC)',None),
+237:('Lebanon (NMC)',None),
+238:('Lithuania (NMC)',None),
+239:('Luxembourg',None),
+240:('Malta (NMC)',None),
+241:('Monaco',None),
+242:('Romania (NMC)',None),
+243:('Syrian Arab Republic (NMC)',None),
+244:('The former Yugoslav Republic of Macedonia (NMC)',None),
+245:('Ukraine (NMC)',None),
+246:('Republic of Moldova',None),
+247:('Reserved',None),
+248:('Reserved',None),
+249:('Reserved',None),
+250:('Reserved',None),
+251:('Reserved',None),
+252:('Reserved',None),
+253:('Reserved',None),
+254:('EUMETSAT Operations Center',None),
+255:('Missing Value',None)}
+
+def _dec2bin(val, maxbits = 8):
+    """
+    A decimal to binary converter. Returns bits in a list.
+    """
+    retval = []
+    for i in range(maxbits - 1, -1, -1):
+        bit = int(val / (2 ** i))
+        val = (val % (2 ** i))
+        retval.append(bit)
+    return retval
+
+def _putieeeint(r):
+    """convert a float to a IEEE format 32 bit integer"""
+    ra = np.array([r],'f')
+    ia = np.empty(1,'i')
+    g2clib.rtoi_ieee(ra,ia)
+    return ia[0]
+
+def _getieeeint(i):
+    """convert an IEEE format 32 bit integer to a float"""
+    ia = np.array([i],'i')
+    ra = np.empty(1,'f')
+    g2clib.itor_ieee(ia,ra)
+    return ra[0]
+
+def _isString(string):
+    """Test if string is a string like object if not return 0 """
+    try: string + ''
+    except: return 0
+    else: return 1
+
+class Grib2Message:
+    """
+ Class for accessing data in a GRIB Edition 2 message.
+
+ The L{Grib2Decode} function returns a list of these class instances,
+ one for each grib message in the file.
+
+ When a class instance is created, metadata in the GRIB2 file
+ is decoded and used to set various instance variables.
+
+ @ivar bitmap_indicator_flag: flag to indicate whether a bit-map is used (0 for yes, 255 for no).
+ @ivar data_representation_template: data representation template from section 5.
+ @ivar data_representation_template_number: data representation template number
+ from section 5
+ (U{Table 5.0
+ <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table5-0.shtml>})
+ @ivar has_local_use_section:  True if grib message contains a local use
+ section. If True the actual local use section is contained in the
+ C{_local_use_section} instance variable, as a raw byte string.
+ @ivar discipline_code: product discipline code for grib message
+ (U{Table 0.0
+ <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table0-0.shtml>}).
+ @ivar earthRmajor: major (equatorial) earth radius.
+ @ivar earthRminor: minor (polar) earth radius.
+ @ivar grid_definition_info: grid definition section information from section 3.
+  See L{Grib2Encode.addgrid} for details.
+ @ivar grid_definition_template: grid definition template from section 3.
+ @ivar grid_definition_template_number: grid definition template number from section 3
+ (U{Table 3.1
+ <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-1.shtml>}).
+ @ivar gridlength_in_x_direction: x (or longitudinal) direction grid length.
+ @ivar gridlength_in_y_direction: y (or latitudinal) direction grid length.
+ @ivar identification_section: data from identification section (section 1).
+  See L{Grib2Encode.__init__} for details.
+ @ivar latitude_first_gridpoint: latitude of first grid point on grid.
+ @ivar latitude_last_gridpoint: latitude of last grid point on grid.
+ @ivar longitude_first_gridpoint: longitude of first grid point on grid.
+ @ivar longitude_last_gridpoint: longitude of last grid point on grid.
+ @ivar originating_center: name of national/international originating center.
+ @ivar center_wmo_code: 4 character wmo code for originating center.
+ @ivar scanmodeflags: scanning mode flags from Table 3.4
+ (U{Table 3.4
+ <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-4.shtml>}).
+
+  - bit 1:
+
+    0 - Points in the first row or column scan in the +i (+x) direction
+
+    1 - Points in the first row or column scan in the -i (-x) direction
+
+  - bit 2:
+
+    0 - Points in the first row or column scan in the -j (-y) direction
+
+    1 - Points in the first row or column scan in the +j (+y) direction
+
+  - bit 3:
+
+    0 - Adjacent points in the i (x) direction are consecutive (row-major order).
+
+    1 - Adjacent points in the j (y) direction are consecutive (column-major order).
+
+  - bit 4:
+
+    0 - All rows scan in the same direction
+
+    1 - Adjacent rows scan in the opposite direction
+
+ @ivar number_of_data_points_to_unpack: total number of data points in grib message.
+ @ivar points_in_x_direction: number of points in the x (longitudinal) direction.
+ @ivar points_in_y_direction: number of points in the y (latitudinal) direction.
+ @ivar product_definition_template: product definition template from section 4.
+ @ivar product_definition_template_number: product definition template number from section 4
+ (U{Table 4.0
+ <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table4-0.shtml>}).
+ @ivar shape_of_earth: string describing the shape of the earth (e.g. 'Oblate Spheroid', 'Spheroid').
+ @ivar spectral_truncation_parameters:  pentagonal truncation parameters that describe the
+ spherical harmonic truncation (only relevant for grid_definition_template_numbers 50-52).
+ For triangular truncation, all three of these numbers are the same.
+ @ivar latitude_of_southern_pole: the geographic latitude in degrees of the southern
+ pole of the coordinate system (for rotated lat/lon or gaussian grids).
+ @ivar longitude_of_southern_pole: the geographic longitude in degrees of the southern
+ pole of the coordinate system (for rotated lat/lon or gaussian grids).
+ @ivar angle_of_pole_rotation: The angle of rotation in degrees about the new
+ polar axis (measured clockwise when looking from the southern to the northern pole)
+ of the coordinate system. For rotated lat/lon or gaussian grids.
+ @ivar missing_value: primary missing value (for data_representation_template_numbers
+ 2 and 3).
+ @ivar missing_value2: secondary missing value (for data_representation_template_numbers
+ 2 and 3).
+ @ivar proj4_: instance variables with this prefix are used to set the map projection
+ parameters for U{PROJ.4<http://proj.maptools.org>}.
+    """
+    def __init__(self,**kwargs):
+        """
+ create a Grib2Decode class instance given a GRIB Edition 2 filename.
+
+ (used by L{Grib2Decode} function - not directly called by user)
+        """
+        for k,v in kwargs.items():
+            setattr(self,k,v)
+        # grid information
+        gdsinfo = self.grid_definition_info
+        gdtnum = self.grid_definition_template_number
+        gdtmpl = self.grid_definition_template
+        reggrid = gdsinfo[2] == 0 # gdsinfo[2]=0 means regular 2-d grid
+        # shape of the earth.
+        if gdtnum not in [50,51,52,1200]:
+            earthR = _earthparams[gdtmpl[0]]
+            if earthR == 'Reserved': earthR = None
+        else:
+            earthR = None
+        if _isString(earthR) and (earthR.startswith('Reserved') or earthR=='Missing'):
+            self.shape_of_earth = earthR
+            self.earthRminor = None
+            self.earthRmajor = None
+        elif _isString(earthR) and earthR.startswith('Spherical'):
+            self.shape_of_earth = earthR
+            scaledearthR = gdtmpl[2]
+            earthRscale = gdtmpl[1]
+            self.earthRmajor = math.pow(10,-earthRscale)*scaledearthR
+            self.earthRminor = self.earthRmajor
+        elif _isString(earthR) and earthR.startswith('OblateSpheroid'):
+            self.shape_of_earth = earthR
+            scaledearthRmajor = gdtmpl[4]
+            earthRmajorscale = gdtmpl[3]
+            self.earthRmajor = math.pow(10,-earthRmajorscale)*scaledearthRmajor
+            self.earthRmajor = self.earthRmajor*1000. # convert to m from km
+            scaledearthRminor = gdtmpl[6]
+            earthRminorscale = gdtmpl[5]
+            self.earthRminor = math.pow(10,-earthRminorscale)*scaledearthRminor
+            self.earthRminor = self.earthRminor*1000. # convert to m from km
+        elif _isString(earthR) and earthR.startswith('WGS84'):
+            self.shape_of_earth = earthR
+            self.earthRmajor = 6378137.0
+            self.earthRminor = 6356752.3142
+        elif isinstance(earthR,tuple):
+            self.shape_of_earth = 'OblateSpheroid'
+            self.earthRmajor = earthR[0]
+            self.earthRminor = earthR[1]
+        else:
+            if earthR is not None:
+                self.shape_of_earth = 'Spherical'
+                self.earthRmajor = earthR
+                self.earthRminor = self.earthRmajor
+        if reggrid and gdtnum not in [50,51,52,53,100,120,1000,1200]:
+            self.points_in_x_direction = gdtmpl[7]
+            self.points_in_y_direction = gdtmpl[8]
+        if not reggrid and gdtnum == 40: # 'reduced' gaussian grid.
+            self.points_in_y_direction = gdtmpl[8]
+        if gdtnum in [0,1,203,205,32768]: # regular or rotated lat/lon grid
+            scalefact = float(gdtmpl[9])
+            divisor = float(gdtmpl[10])
+            if scalefact == 0: scalefact = 1.
+            if divisor <= 0: divisor = 1.e6
+            self.latitude_first_gridpoint = scalefact*gdtmpl[11]/divisor
+            self.longitude_first_gridpoint = scalefact*gdtmpl[12]/divisor
+            self.latitude_last_gridpoint = scalefact*gdtmpl[14]/divisor
+            self.longitude_last_gridpoint = scalefact*gdtmpl[15]/divisor
+            self.gridlength_in_x_direction = scalefact*gdtmpl[16]/divisor
+            self.gridlength_in_y_direction = scalefact*gdtmpl[17]/divisor
+            if self.latitude_first_gridpoint > self.latitude_last_gridpoint:
+                self.gridlength_in_y_direction = -self.gridlength_in_y_direction
+            if self.longitude_first_gridpoint > self.longitude_last_gridpoint:
+                self.gridlength_in_x_direction = -self.gridlength_in_x_direction
+            self.scanmodeflags = _dec2bin(gdtmpl[18])[0:4]
+            if gdtnum == 1:
+                self.latitude_of_southern_pole = scalefact*gdtmpl[19]/divisor
+                self.longitude_of_southern_pole = scalefact*gdtmpl[20]/divisor
+                self.angle_of_pole_rotation = gdtmpl[21]
+        elif gdtnum == 10: # mercator
+            self.latitude_first_gridpoint = gdtmpl[9]/1.e6
+            self.longitude_first_gridpoint = gdtmpl[10]/1.e6
+            self.latitude_last_gridpoint = gdtmpl[13]/1.e6
+            self.longitude_last_gridpoint = gdtmpl[14]/1.e6
+            self.gridlength_in_x_direction = gdtmpl[17]/1.e3
+            self.gridlength_in_y_direction= gdtmpl[18]/1.e3
+            self.proj4_lat_ts = gdtmpl[12]/1.e6
+            self.proj4_lon_0 = 0.5*(self.longitude_first_gridpoint+self.longitude_last_gridpoint)
+            self.proj4_proj = 'merc'
+            self.scanmodeflags = _dec2bin(gdtmpl[15])[0:4]
+        elif gdtnum == 20: # stereographic
+            projflag = _dec2bin(gdtmpl[16])[0]
+            self.latitude_first_gridpoint = gdtmpl[9]/1.e6
+            self.longitude_first_gridpoint = gdtmpl[10]/1.e6
+            self.proj4_lat_ts = gdtmpl[12]/1.e6
+            if projflag == 0:
+                self.proj4_lat_0 = 90
+            elif projflag == 1:
+                self.proj4_lat_0 = -90
+            else:
+                raise ValueError('Invalid projection center flag = %s'%projflag)
+            self.proj4_lon_0 = gdtmpl[13]/1.e6
+            self.gridlength_in_x_direction = gdtmpl[14]/1000.
+            self.gridlength_in_y_direction = gdtmpl[15]/1000.
+            self.proj4_proj = 'stere'
+            self.scanmodeflags = _dec2bin(gdtmpl[17])[0:4]
+        elif gdtnum == 30: # lambert conformal
+            self.latitude_first_gridpoint = gdtmpl[9]/1.e6
+            self.longitude_first_gridpoint = gdtmpl[10]/1.e6
+            self.gridlength_in_x_direction = gdtmpl[14]/1000.
+            self.gridlength_in_y_direction = gdtmpl[15]/1000.
+            self.proj4_lat_1 = gdtmpl[18]/1.e6
+            self.proj4_lat_2 = gdtmpl[19]/1.e6
+            self.proj4_lat_0 = gdtmpl[12]/1.e6
+            self.proj4_lon_0 = gdtmpl[13]/1.e6
+            self.proj4_proj = 'lcc'
+            self.scanmodeflags = _dec2bin(gdtmpl[17])[0:4]
+        elif gdtnum == 31: # albers equal area.
+            self.latitude_first_gridpoint = gdtmpl[9]/1.e6
+            self.longitude_first_gridpoint = gdtmpl[10]/1.e6
+            self.gridlength_in_x_direction = gdtmpl[14]/1000.
+            self.gridlength_in_y_direction = gdtmpl[15]/1000.
+            self.proj4_lat_1 = gdtmpl[18]/1.e6
+            self.proj4_lat_2 = gdtmpl[19]/1.e6
+            self.proj4_lat_0 = gdtmpl[12]/1.e6
+            self.proj4_lon_0 = gdtmpl[13]/1.e6
+            self.proj4_proj = 'aea'
+            self.scanmodeflags = _dec2bin(gdtmpl[17])[0:4]
+        elif gdtnum == 40 or gdtnum == 41: # gaussian grid.
+            scalefact = float(gdtmpl[9])
+            divisor = float(gdtmpl[10])
+            if scalefact == 0: scalefact = 1.
+            if divisor <= 0: divisor = 1.e6
+            self.points_between_pole_and_equator = gdtmpl[17]
+            self.latitude_first_gridpoint = scalefact*gdtmpl[11]/divisor
+            self.longitude_first_gridpoint = scalefact*gdtmpl[12]/divisor
+            self.latitude_last_gridpoint = scalefact*gdtmpl[14]/divisor
+            self.longitude_last_gridpoint = scalefact*gdtmpl[15]/divisor
+            if reggrid:
+                self.gridlength_in_x_direction = scalefact*gdtmpl[16]/divisor
+                if self.longitude_first_gridpoint > self.longitude_last_gridpoint:
+                    self.gridlength_in_x_direction = -self.gridlength_in_x_direction
+            self.scanmodeflags = _dec2bin(gdtmpl[18])[0:4]
+            if gdtnum == 41:
+                self.latitude_of_southern_pole = scalefact*gdtmpl[19]/divisor
+                self.longitude_of_southern_pole = scalefact*gdtmpl[20]/divisor
+                self.angle_of_pole_rotation = gdtmpl[21]
+        elif gdtnum == 50: # spectral coefficients.
+            self.spectral_truncation_parameters = (gdtmpl[0],gdtmpl[1],gdtmpl[2])
+            self.scanmodeflags = [None,None,None,None] # doesn't apply
+        elif gdtnum == 90: # near-sided vertical perspective satellite projection
+            self.proj4_lat_0 = gdtmpl[9]/1.e6
+            self.proj4_lon_0 = gdtmpl[10]/1.e6
+            self.proj4_h = self.earthRmajor * (gdtmpl[18]/1.e6)
+            dx = gdtmpl[12]
+            dy = gdtmpl[13]
+            # if lat_0 is equator, it's a geostationary view.
+            if self.proj4_lat_0 == 0.: # if lat_0 is equator, it's a
+                self.proj4_proj = 'geos'
+            # general case of 'near-side perspective projection' (untested)
+            else:
+                self.proj4_proj = 'nsper'
+                msg = """
+only geostationary perspective is supported.
+lat/lon values returned by grid method may be incorrect."""
+                warnings.warn(msg)
+            # latitude of horizon on central meridian
+            lonmax = 90.-(180./np.pi)*np.arcsin(self.earthRmajor/self.proj4_h)
+            # longitude of horizon on equator
+            latmax = 90.-(180./np.pi)*np.arcsin(self.earthRminor/self.proj4_h)
+            # 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.
+            # h is measured from surface of earth at equator.
+            self.proj4_h = self.proj4_h - self.earthRmajor
+            # width and height of visible projection
+            P = pyproj.Proj(proj=self.proj4_proj,\
+                            a=self.earthRmajor,b=self.earthRminor,\
+                            lat_0=0,lon_0=0,h=self.proj4_h)
+            x1,y1 = P(0.,latmax); x2,y2 = P(lonmax,0.)
+            width = 2*x2; height = 2*y1
+            self.gridlength_in_x_direction = width/dx
+            self.gridlength_in_y_direction = height/dy
+            self.scanmodeflags = _dec2bin(gdtmpl[16])[0:4]
+        elif gdtnum == 110: # azimuthal equidistant.
+            self.proj4_lat_0 = gdtmpl[9]/1.e6
+            self.proj4_lon_0 = gdtmpl[10]/1.e6
+            self.gridlength_in_x_direction = gdtmpl[12]/1000.
+            self.gridlength_in_y_direction = gdtmpl[13]/1000.
+            self.proj4_proj = 'aeqd'
+            self.scanmodeflags = _dec2bin(gdtmpl[15])[0:4]
+        elif gdtnum == 204: # curvilinear orthogonal
+            self.scanmodeflags = _dec2bin(gdtmpl[18])[0:4]
+        # missing value.
+        drtnum = self.data_representation_template_number
+        drtmpl = self.data_representation_template
+        if (drtnum == 2 or drtnum == 3) and drtmpl[6] != 0:
+            self.missing_value = _getieeeint(drtmpl[7])
+            if drtmpl[6] == 2:
+                self.missing_value2 = _getieeeint(drtmpl[8])
+
+    def __repr__(self):
+        strings = []
+        keys = self.__dict__.keys()
+        keys.sort()
+        for k in keys:
+            if not k.startswith('_'):
+                strings.append('%s = %s\n'%(k,self.__dict__[k]))
+        return ''.join(strings)
+
+    def data(self,fill_value=9.9692099683868690e+36,masked_array=True,expand=True,order=None):
+        """
+ returns an unpacked data grid.  Can also be accomplished with L{values}
+ property.
+
+ @keyword fill_value: missing or masked data is filled with this value
+ (default 9.9692099683868690e+36).
+
+ @keyword masked_array: if True, return masked array if there is bitmap
+ for missing or masked data (default True).
+
+ @keyword expand:  if True (default), ECMWF 'reduced' gaussian grids are
+ expanded to regular gaussian grids.
+
+ @keyword order: if 1, linear interpolation is used for expanding reduced
+ gaussian grids.  if 0, nearest neighbor interpolation is used. Default
+ is 0 if grid has missing or bitmapped values, 1 otherwise.
+
+ @return: C{B{data}}, a float32 numpy regular or masked array
+ with shape (nlats,lons) containing the requested grid.
+        """
+        # make sure scan mode is supported.
+        # if there is no 'scanmodeflags', then grid is not supported.
+        from redtoreg import _redtoreg
+        if not hasattr(self,'scanmodeflags'):
+            raise ValueError('unsupported grid definition template number %s'%self.grid_definition_template_number)
+        else:
+            if self.scanmodeflags[2]:
+                storageorder='F'
+            else:
+                storageorder='C'
+        bitmapflag = self.bitmap_indicator_flag
+        drtnum = self.data_representation_template_number
+        drtmpl = self.data_representation_template
+        # default order=0 is missing values or bitmap exists.
+        if order is None:
+            if ((drtnum == 3 or drtnum == 2) and drtmpl[6] != 0) or bitmapflag == 0:
+                order = 0
+            else:
+                order = 1
+        try:
+            f = open(self._grib_filename,'rb')
+        except (TypeError,IOError):
+            f = StringIO(self._grib_filename)
+        f.seek(self._grib_message_byteoffset)
+        gribmsg = f.read(self._grib_message_length)
+        f.close()
+        gdtnum = self.grid_definition_template_number
+        gdtmpl = self.grid_definition_template
+        ndpts = self.number_of_data_points_to_unpack
+        gdsinfo = self.grid_definition_info
+        ngrdpts = gdsinfo[1]
+        ipos = self._section7_byte_offset
+        fld1=g2clib.unpack7(gribmsg,gdtnum,gdtmpl,drtnum,drtmpl,ndpts,ipos,np.empty,storageorder=storageorder)
+        # apply bitmap.
+        if bitmapflag == 0:
+            bitmap=self._bitmap
+            fld = fill_value*np.ones(ngrdpts,'f')
+            np.put(fld,np.nonzero(bitmap),fld1)
+            if masked_array:
+                fld = ma.masked_values(fld,fill_value)
+        # missing values instead of bitmap
+        elif masked_array and hasattr(self,'missing_value'):
+            if hasattr(self, 'missing_value2'):
+                mask = np.logical_or(fld1 == self.missing_value, fld1 == self.missing_value2)
+            else:
+                mask = fld1 == self.missing_value
+            fld = ma.array(fld1,mask=mask)
+        else:
+            fld = fld1
+        nx = None; ny = None
+        if hasattr(self,'points_in_x_direction'):
+            nx = self.points_in_x_direction
+        if hasattr(self,'points_in_y_direction'):
+            ny = self.points_in_y_direction
+        if nx is not None and ny is not None: # rectangular grid.
+            if ma.isMA(fld):
+                fld = ma.reshape(fld,(ny,nx))
+            else:
+                fld = np.reshape(fld,(ny,nx))
+        else:
+            if gdsinfo[2] and gdtnum == 40: # ECMWF 'reduced' global gaussian grid.
+                if expand:
+                    nx = 2*ny
+                    lonsperlat = self.grid_definition_list
+                    if ma.isMA(fld):
+                        fld = ma.filled(fld)
+                        fld = _redtoreg(nx, lonsperlat.astype(np.long),\
+                                fld.astype(np.double), fill_value)
+                        fld = ma.masked_values(fld,fill_value)
+                    else:
+                        fld = _redtoreg(nx, lonsperlat.astype(np.long),\
+                                fld.astype(np.double), fill_value)
+        # check scan modes for rect grids.
+        if nx is not None and ny is not None:
+            # rows scan in the -x direction (so flip)
+            #if self.scanmodeflags[0]:
+            #    fldsave = fld.astype('f') # casting makes a copy
+            #    fld[:,:] = fldsave[:,::-1]
+            # columns scan in the -y direction (so flip)
+            #if not self.scanmodeflags[1]:
+            #    fldsave = fld.astype('f') # casting makes a copy
+            #    fld[:,:] = fldsave[::-1,:]
+            # adjacent rows scan in opposite direction.
+            # (flip every other row)
+            if self.scanmodeflags[3]:
+                fldsave = fld.astype('f') # casting makes a copy
+                fld[1::2,:] = fldsave[1::2,::-1]
+        return fld
+
+    values = property(data)
+
+    def latlons(self):
+        """alias for L{grid}"""
+        return self.grid()
+
+    def grid(self):
+        """
+ return lats,lons (in degrees) of grid.
+ currently can handle reg. lat/lon, global gaussian, mercator, stereographic,
+ lambert conformal, albers equal-area, space-view and azimuthal
+ equidistant grids.  L{latlons} method does the same thing.
+
+ @return: C{B{lats},B{lons}}, float32 numpy arrays
+ containing latitudes and longitudes of grid (in degrees).
+        """
+        from pygrib import gaulats
+        gdsinfo = self.grid_definition_info
+        gdtnum = self.grid_definition_template_number
+        gdtmpl = self.grid_definition_template
+        reggrid = gdsinfo[2] == 0 # gdsinfo[2]=0 means regular 2-d grid
+        projparams = {}
+        projparams['a']=self.earthRmajor
+        projparams['b']=self.earthRminor
+        if gdtnum == 0: # regular lat/lon grid
+            lon1, lat1 = self.longitude_first_gridpoint, self.latitude_first_gridpoint
+            lon2, lat2 = self.longitude_last_gridpoint, self.latitude_last_gridpoint
+            delon = self.gridlength_in_x_direction
+            delat = self.gridlength_in_y_direction
+            lats = np.arange(lat1,lat2+delat,delat)
+            lons = np.arange(lon1,lon2+delon,delon)
+            # flip if scan mode says to.
+            #if self.scanmodeflags[0]:
+            #    lons = lons[::-1]
+            #if not self.scanmodeflags[1]:
+            #    lats = lats[::-1]
+            projparams['proj'] = 'cyl'
+            lons,lats = np.meshgrid(lons,lats) # make 2-d arrays.
+        elif gdtnum == 40: # gaussian grid (only works for global!)
+            lon1, lat1 = self.longitude_first_gridpoint, self.latitude_first_gridpoint
+            lon2, lat2 = self.longitude_last_gridpoint, self.latitude_last_gridpoint
+            nlats = self.points_in_y_direction
+            if not reggrid: # ECMWF 'reduced' gaussian grid.
+                nlons = 2*nlats
+                delon = 360./nlons
+            else:
+                nlons = self.points_in_x_direction
+                delon = self.gridlength_in_x_direction
+            lons = np.arange(lon1,lon2+delon,delon)
+            # compute gaussian lats (north to south)
+            lats = gaulats(nlats)
+            if lat1 < lat2:  # reverse them if necessary
+                lats = lats[::-1]
+            # flip if scan mode says to.
+            #if self.scanmodeflags[0]:
+            #    lons = lons[::-1]
+            #if not self.scanmodeflags[1]:
+            #    lats = lats[::-1]
+            projparams['proj'] = 'cyl'
+            lons,lats = np.meshgrid(lons,lats) # make 2-d arrays
+        # mercator, lambert conformal, stereographic, albers equal area, azimuthal equidistant
+        elif gdtnum in [10,20,30,31,110]:
+            nx = self.points_in_x_direction
+            ny = self.points_in_y_direction
+            dx = self.gridlength_in_x_direction
+            dy = self.gridlength_in_y_direction
+            lon1, lat1 = self.longitude_first_gridpoint, self.latitude_first_gridpoint
+            if gdtnum == 10: # mercator.
+                projparams['lat_ts']=self.proj4_lat_ts
+                projparams['proj']=self.proj4_proj
+                projparams['lon_0']=self.proj4_lon_0
+                pj = pyproj.Proj(projparams)
+                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)
+            elif gdtnum == 20:  # stereographic
+                projparams['lat_ts']=self.proj4_lat_ts
+                projparams['proj']=self.proj4_proj
+                projparams['lat_0']=self.proj4_lat_0
+                projparams['lon_0']=self.proj4_lon_0
+                pj = pyproj.Proj(projparams)
+                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)
+            elif gdtnum in [30,31]: # lambert, albers
+                projparams['lat_1']=self.proj4_lat_1
+                projparams['lat_2']=self.proj4_lat_2
+                projparams['proj']=self.proj4_proj
+                projparams['lon_0']=self.proj4_lon_0
+                pj = pyproj.Proj(projparams)
+                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)
+            elif gdtnum == 110: # azimuthal equidistant
+                projparams['proj']=self.proj4_proj
+                projparams['lat_0']=self.proj4_lat_0
+                projparams['lon_0']=self.proj4_lon_0
+                pj = pyproj.Proj(projparams)
+                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)
+        elif gdtnum == 90: # satellite projection.
+            nx = self.points_in_x_direction
+            ny = self.points_in_y_direction
+            dx = self.gridlength_in_x_direction
+            dy = self.gridlength_in_y_direction
+            projparams['proj']=self.proj4_proj
+            projparams['lon_0']=self.proj4_lon_0
+            projparams['lat_0']=self.proj4_lat_0
+            projparams['h']=self.proj4_h
+            pj = pyproj.Proj(projparams)
+            x = dx*np.indices((ny,nx),'f')[1,:,:]
+            x = x - 0.5*x.max()
+            y = dy*np.indices((ny,nx),'f')[0,:,:]
+            y = y - 0.5*y.max()
+            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)
+        else:
+            raise ValueError('unsupported grid')
+        self.projparams = projparams
+        return lats.astype('f'), lons.astype('f')
+
+def Grib2Decode(filename,gribmsg=False):
+    """
+ Read the contents of a GRIB2 file.
+
+ @param filename: name of GRIB2 file (default, gribmsg=False) or binary string
+ representing a grib message (if gribmsg=True).
+
+ @return:  a list of L{Grib2Message} instances representing all of the
+ grib messages in the file.  Messages with multiple fields are split
+ into separate messages (so that each L{Grib2Message} instance contains
+ just one data field). The metadata in each GRIB2 message can be
+ accessed via L{Grib2Message} instance variables, the actual data
+ can be read using L{Grib2Message.data}, and the lat/lon values of the grid
+ can be accesses using L{Grib2Message.grid}. If there is only one grib
+ message, just the L{Grib2Message} instance is returned, instead of a list
+ with one element.
+    """
+    if gribmsg:
+        f = StringIO(filename)
+    else:
+        f = open(filename,'rb')
+    nmsg = 0
+    # loop over grib messages, read section 0, get entire grib message.
+    disciplines = []
+    startingpos = []
+    msglen = []
+    while 1:
+        # find next occurence of string 'GRIB' (or EOF).
+        nbyte = f.tell()
+        while 1:
+            f.seek(nbyte)
+            start = f.read(4).decode('ascii','ignore')
+            if start == '' or start == 'GRIB': break
+            nbyte = nbyte + 1
+        if start == '': break # at EOF
+        # otherwise, start (='GRIB') contains indicator message (section 0)
+        startpos = f.tell()-4
+        f.seek(2,1)  # next two octets are reserved
+        # get discipline info.
+        disciplines.append(struct.unpack('>B',f.read(1))[0])
+        # check to see it's a grib edition 2 file.
+        vers = struct.unpack('>B',f.read(1))[0]
+        if vers != 2:
+            raise IOError('not a GRIB2 file (version number %d)' % vers)
+        lengrib = struct.unpack('>q',f.read(8))[0]
+        msglen.append(lengrib)
+        startingpos.append(startpos)
+        # read in entire grib message.
+        f.seek(startpos)
+        gribmsg = f.read(lengrib)
+        # make sure the message ends with '7777'
+        end = gribmsg[-4:lengrib].decode('ascii','ignore')
+        if end != '7777':
+           raise IOError('partial GRIB message (no "7777" at end)')
+        # do next message.
+        nmsg=nmsg+1
+    # if no grib messages found, nmsg is still 0 and it's not GRIB.
+    if nmsg==0:
+       raise IOError('not a GRIB file')
+    # now for each grib message, find number of fields.
+    numfields = []
+    f.seek(0) # rewind file.
+    for n in range(nmsg):
+        f.seek(startingpos[n])
+        gribmsg = f.read(msglen[n])
+        pos = 0
+        numflds = 0
+        while 1:
+            if gribmsg[pos:pos+4].decode('ascii','ignore') == 'GRIB':
+                sectnum = 0
+                lensect = 16
+            elif gribmsg[pos:pos+4].decode('ascii','ignore') == '7777':
+                break
+            else:
+                lensect = struct.unpack('>i',gribmsg[pos:pos+4])[0]
+                sectnum = struct.unpack('>B',gribmsg[pos+4:pos+5])[0]
+                if sectnum == 4: numflds=numflds+1
+                #if sectnum == 2: numlocal=numlocal+1
+            pos = pos + lensect
+            #print sectnum,lensect,pos
+        #print n+1,len(gribmsg),numfields,numlocal
+        numfields.append(numflds)
+    # decode each section in grib message (sections 1 and above).
+    gdtnum = [] # grid defn template number from sxn 3
+    gdtmpl = [] # grid defn template from sxn 3
+    gdeflist = [] # optional grid definition list from sxn 3
+    gdsinfo = [] # grid definition section info from sxn3
+    pdtmpl = [] # product defn template from sxn 4
+    pdtnum = [] # product defn template number from sxn 4
+    coordlist = [] # vertical coordinate info from sxn 4
+    drtmpl = [] # data representation template from sxn 5
+    drtnum = [] # data representation template number from sxn 5
+    ndpts = [] # number of data points to be unpacked (from sxn 5)
+    bitmapflag = [] # bit-map indicator flag from sxn 6
+    bitmap = [] # bitmap from sxn 6.
+    pos7 = [] # byte offset for section 7.
+    localsxn = [] # local use sections.
+    msgstart = [] # byte offset in file for message start.
+    msglength = [] # length of the message in bytes.
+    message = [] # the actual grib message.
+    identsect = [] # identification section (section 1).
+    discipline = [] # discipline code.
+    for n in range(nmsg):
+        spos = startingpos[n]
+        lengrib = msglen[n]
+        #gribmsg = gribmsgs[n]
+        f.seek(spos)
+        gribmsg = f.read(lengrib)
+        discipl = disciplines[n]
+        lensect0 = 16
+        # get length of section 1 and section number.
+        #lensect1 = struct.unpack('>i',gribmsg[lensect0:lensect0+4])[0]
+        #sectnum1 = struct.unpack('>B',gribmsg[lensect0+4])[0]
+        #print 'sectnum1, lensect1 = ',sectnum1,lensect1
+        # unpack section 1, octets 1-21 (13 parameters).  This section
+        # can occur only once per grib message.
+        #idsect,pos = _unpack1(gribmsg,lensect0) # python version
+        idsect,pos = g2clib.unpack1(gribmsg,lensect0,np.empty) # c version
+        # loop over rest of sections in message.
+        gdtnums = []
+        gdtmpls = []
+        gdeflists = []
+        gdsinfos = []
+        pdtmpls = []
+        coordlists = []
+        pdtnums = []
+        drtmpls = []
+        drtnums = []
+        ndptslist = []
+        bitmapflags = []
+        bitmaps = []
+        sxn7pos = []
+        localsxns = []
+        while 1:
+            # check to see if this is the end of the message.
+            if gribmsg[pos:pos+4].decode('ascii','ignore') == '7777': break
+            lensect = struct.unpack('>i',gribmsg[pos:pos+4])[0]
+            sectnum = struct.unpack('>B',gribmsg[pos+4:pos+5])[0]
+            # section 2, local use section.
+            if sectnum == 2:
+                # "local use section", used by NDFD to store WX
+                # strings.  This section is returned as a raw
+                # bytestring for further dataset-specific parsing,
+                # not as a numpy array.
+                localsxns.append(gribmsg[pos+5:pos+lensect])
+                pos = pos + lensect
+            # section 3, grid definition section.
+            elif sectnum == 3:
+                gds,gdtempl,deflist,pos = g2clib.unpack3(gribmsg,pos,np.empty)
+                gdtnums.append(gds[4])
+                gdtmpls.append(gdtempl)
+                gdeflists.append(deflist)
+                gdsinfos.append(gds)
+            # section, product definition section.
+            elif sectnum == 4:
+                pdtempl,pdtn,coordlst,pos = g2clib.unpack4(gribmsg,pos,np.empty)
+                pdtmpls.append(pdtempl)
+                coordlists.append(coordlst)
+                pdtnums.append(pdtn)
+            # section 5, data representation section.
+            elif sectnum == 5:
+                drtempl,drtn,npts,pos = g2clib.unpack5(gribmsg,pos,np.empty)
+                drtmpls.append(drtempl)
+                drtnums.append(drtn)
+                ndptslist.append(npts)
+            # section 6, bit-map section.
+            elif sectnum == 6:
+                bmap,bmapflag = g2clib.unpack6(gribmsg,gds[1],pos,np.empty)
+                #bitmapflag = struct.unpack('>B',gribmsg[pos+5])[0]
+                if bmapflag == 0:
+                    bitmaps.append(bmap.astype('b'))
+                # use last defined bitmap.
+                elif bmapflag == 254:
+                    bmapflag = 0
+                    for bmp in bitmaps[::-1]:
+                        if bmp is not None: bitmaps.append(bmp)
+                else:
+                    bitmaps.append(None)
+                bitmapflags.append(bmapflag)
+                pos = pos + lensect
+            # section 7, data section (nothing done here,
+            # data unpacked when getfld method is invoked).
+            else:
+                if sectnum != 7:
+                   msg = 'unknown section = %i' % sectnum
+                   raise ValueError(msg)
+                sxn7pos.append(pos)
+                pos = pos + lensect
+        # extend by repeating last value for all remaining fields.
+        gdtnum.append(_repeatlast(numfields[n],gdtnums))
+        gdtmpl.append(_repeatlast(numfields[n],gdtmpls))
+        gdeflist.append(_repeatlast(numfields[n],gdeflists))
+        gdsinfo.append(_repeatlast(numfields[n],gdsinfos))
+        pdtmpl.append(_repeatlast(numfields[n],pdtmpls))
+        pdtnum.append(_repeatlast(numfields[n],pdtnums))
+        coordlist.append(_repeatlast(numfields[n],coordlists))
+        drtmpl.append(_repeatlast(numfields[n],drtmpls))
+        drtnum.append(_repeatlast(numfields[n],drtnums))
+        ndpts.append(_repeatlast(numfields[n],ndptslist))
+        bitmapflag.append(_repeatlast(numfields[n],bitmapflags))
+        bitmap.append(_repeatlast(numfields[n],bitmaps))
+        pos7.append(_repeatlast(numfields[n],sxn7pos))
+        if len(localsxns) == 0:
+            localsxns = [None]
+        localsxn.append(_repeatlast(numfields[n],localsxns))
+        msgstart.append(_repeatlast(numfields[n],[spos]))
+        msglength.append(_repeatlast(numfields[n],[lengrib]))
+        identsect.append(_repeatlast(numfields[n],[idsect]))
+        discipline.append(_repeatlast(numfields[n],[discipl]))
+
+    gdtnum = _flatten(gdtnum)
+    gdtmpl = _flatten(gdtmpl)
+    gdeflist = _flatten(gdeflist)
+    gdsinfo = _flatten(gdsinfo)
+    pdtmpl = _flatten(pdtmpl)
+    pdtnum = _flatten(pdtnum)
+    coordlist = _flatten(coordlist)
+    drtmpl = _flatten(drtmpl)
+    drtnum = _flatten(drtnum)
+    ndpts = _flatten(ndpts)
+    bitmapflag = _flatten(bitmapflag)
+    bitmap = _flatten(bitmap)
+    pos7 = _flatten(pos7)
+    localsxn = _flatten(localsxn)
+    msgstart = _flatten(msgstart)
+    msglength = _flatten(msglength)
+    identsect = _flatten(identsect)
+    discipline = _flatten(discipline)
+
+    gribs = []
+    for n in range(len(msgstart)):
+        kwargs = {}
+        kwargs['originating_center']=_table0[identsect[n][0]][0]
+        wmo_code = _table0[identsect[n][0]][1]
+        if wmo_code is not None:
+            kwargs['center_wmo_code']=wmo_code
+        kwargs['grid_definition_template_number']=gdtnum[n]
+        kwargs['grid_definition_template']=gdtmpl[n]
+        if gdeflist[n] != []:
+            kwargs['grid_definition_list']=gdeflist[n]
+        kwargs['grid_definition_info']=gdsinfo[n]
+        kwargs['discipline_code']=discipline[n]
+        kwargs['product_definition_template_number']=pdtnum[n]
+        kwargs['product_definition_template']=pdtmpl[n]
+        kwargs['data_representation_template_number']=drtnum[n]
+        kwargs['data_representation_template']=drtmpl[n]
+        if coordlist[n] != []:
+            kwargs['extra_vertical_coordinate_info']=coordlist[n]
+        kwargs['number_of_data_points_to_unpack']=ndpts[n]
+        kwargs['bitmap_indicator_flag']=bitmapflag[n]
+        if bitmap[n] is not []:
+            kwargs['_bitmap']=bitmap[n]
+        kwargs['_section7_byte_offset']=pos7[n]
+        kwargs['_grib_message_byteoffset']=msgstart[n]
+        kwargs['_grib_message_length']=msglength[n]
+        kwargs['_grib_filename']=filename
+        kwargs['identification_section']=identsect[n]
+        kwargs['_grib_message_number']=n+1
+        if localsxn[n] is not None:
+            kwargs['has_local_use_section'] = True
+            kwargs['_local_use_section']=localsxn[n]
+        else:
+            kwargs['has_local_use_section'] = False
+        gribs.append(Grib2Message(**kwargs))
+    f.close()
+    if len(gribs) == 1:
+        return gribs[0]
+    else:
+        return gribs
+
+def dump(filename, grbs):
+    """
+ write the given L{Grib2Message} instances to a grib file.
+
+ @param filename: file to write grib data to.
+ @param grbs: a list of L{Grib2Message} instances.
+    """
+    gribfile = open(filename,'wb')
+    for grb in grbs:
+        try:
+            f = open(grb._grib_filename,'rb')
+        except TypeError:
+            f = StringIO(grb._grib_filename)
+        f.seek(grb._grib_message_byteoffset)
+        gribmsg = f.read(grb._grib_message_length)
+        f.close()
+        gribfile.write(gribmsg)
+    gribfile.close()
+
+# private methods and functions below here.
+
+def _getdate(idsect):
+    """return yyyy,mm,dd,min,ss from section 1"""
+    yyyy=idsect[5]
+    mm=idsect[6]
+    dd=idsect[7]
+    hh=idsect[8]
+    min=idsect[9]
+    ss=idsect[10]
+    return yyyy,mm,dd,hh,min,ss
+
+def _unpack1(gribmsg,pos):
+    """unpack section 1 given starting point in bytes
+    used to test pyrex interface to g2_unpack1"""
+    idsect = []
+    pos = pos + 5
+    idsect.append(struct.unpack('>h',gribmsg[pos:pos+2])[0])
+    pos = pos + 2
+    idsect.append(struct.unpack('>h',gribmsg[pos:pos+2])[0])
+    pos = pos + 2
+    idsect.append(struct.unpack('>B',gribmsg[pos:pos+1])[0])
+    pos = pos + 1
+    idsect.append(struct.unpack('>B',gribmsg[pos:pos+1])[0])
+    pos = pos + 1
+    idsect.append(struct.unpack('>B',gribmsg[pos:pos+1])[0])
+    pos = pos + 1
+    idsect.append(struct.unpack('>h',gribmsg[pos:pos+2])[0])
+    pos = pos + 2
+    idsect.append(struct.unpack('>B',gribmsg[pos:pos+1])[0])
+    pos = pos + 1
+    idsect.append(struct.unpack('>B',gribmsg[pos:pos+1])[0])
+    pos = pos + 1
+    idsect.append(struct.unpack('>B',gribmsg[pos:pos+1])[0])
+    pos = pos + 1
+    idsect.append(struct.unpack('>B',gribmsg[pos:pos+1])[0])
+    pos = pos + 1
+    idsect.append(struct.unpack('>B',gribmsg[pos:pos+1])[0])
+    pos = pos + 1
+    idsect.append(struct.unpack('>B',gribmsg[pos:pos+1])[0])
+    pos = pos + 1
+    idsect.append(struct.unpack('>B',gribmsg[pos:pos+1])[0])
+    pos = pos + 1
+    return np.array(idsect,'i'),pos
+
+def _repeatlast(numfields,listin):
+    """repeat last item in listin, until len(listin) = numfields"""
+    if len(listin) < numfields:
+        last = listin[-1]
+        for n in range(len(listin),numfields):
+            listin.append(last)
+    return listin
+
+def _flatten(lst):
+    try:
+        flist = functools.reduce(operator.add,lst)
+    except NameError: # no reduce in python 3.
+        import functools
+        flist = functools.reduce(operator.add,lst)
+    return flist
+
+
+class Grib2Encode:
+    """
+ Class for encoding data into a GRIB2 message.
+  - Creating a class instance (L{__init__}) initializes the message and adds
+    sections 0 and 1 (the indicator and identification sections),
+  - method L{addgrid} adds a grid definition (section 3) to the messsage.
+  - method L{addfield} adds sections 4-7 to the message (the product
+    definition, data representation, bitmap and data sections).
+  - method L{end} adds the end section (section 8) and terminates the message.
+
+
+ A GRIB Edition 2 message is a machine independent format for storing
+ one or more gridded data fields.  Each GRIB2 message consists of the
+ following sections:
+  - SECTION 0: Indicator Section - only one per message
+  - SECTION 1: Identification Section - only one per message
+  - SECTION 2: (Local Use Section) - optional
+  - SECTION 3: Grid Definition Section
+  - SECTION 4: Product Definition Section
+  - SECTION 5: Data Representation Section
+  - SECTION 6: Bit-map Section
+  - SECTION 7: Data Section
+  - SECTION 8: End Section
+
+ Sequences of GRIB sections 2 to 7, 3 to 7, or sections 4 to 7 may be repeated
+ within a single GRIB message.  All sections within such repeated sequences
+ must be present and shall appear in the numerical order noted above.
+ Unrepeated sections remain in effect until redefined.
+
+ Note:  Writing section 2 (the 'local use section') is
+ not yet supported.
+
+ @ivar msg: A binary string containing the GRIB2 message.
+ After the message has been terminated by calling
+ the L{end} method, this string can be written to a file.
+    """
+
+    def __init__(self, discipline, idsect):
+        """
+ create a Grib2Enecode class instance given the GRIB2 discipline
+ parameter and the identification section (sections 0 and 1).
+
+ The GRIB2 message is stored as a binary string in instance variable L{msg}.
+
+ L{addgrid}, L{addfield} and L{end} class methods must be called to complete
+ the GRIB2 message.
+
+ @param discipline:  Discipline or GRIB Master Table Number (Code Table 0.0).
+ (0 for meteorlogical, 1 for hydrological, 2 for land surface, 3 for space,
+ 10 for oceanographic products).
+
+ @param idsect:  Sequence containing identification section (section 1).
+  - idsect[0]=Id of orginating centre (Common Code
+    U{Table C-1<http://www.nws.noaa.gov/tg/GRIB_C1.htm>})
+  - idsect[1]=Id of orginating sub-centre (local table)
+  - idsect[2]=GRIB Master Tables Version Number (Code
+    U{Table 1.0
+    <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-0.shtml>})
+  - idsect[3]=GRIB Local Tables Version Number (Code
+    U{Table 1.1
+    <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-1.shtml>})
+  - idsect[4]=Significance of Reference Time (Code
+    U{Table 1.2
+    <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-2.shtml>})
+  - idsect[5]=Reference Time - Year (4 digits)
+  - idsect[6]=Reference Time - Month
+  - idsect[7]=Reference Time - Day
+  - idsect[8]=Reference Time - Hour
+  - idsect[9]=Reference Time - Minute
+  - idsect[10]=Reference Time - Second
+  - idsect[11]=Production status of data (Code
+    U{Table 1.3
+    <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-3.shtml>})
+  - idsect[12]=Type of processed data (Code
+    U{Table
+    1.4<http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-4.shtml>})
+        """
+        self.msg,msglen=g2clib.grib2_create(np.array([discipline,2],np.int32),np.array(idsect,np.int32))
+
+    def addgrid(self,gdsinfo,gdtmpl,deflist=None):
+        """
+ Add a grid definition section (section 3) to the GRIB2 message.
+
+ @param gdsinfo: Sequence containing information needed for the grid definition section.
+  - gdsinfo[0] = Source of grid definition (see Code
+    U{Table 3.0
+    <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-0.shtml>})
+  - gdsinfo[1] = Number of grid points in the defined grid.
+  - gdsinfo[2] = Number of octets needed for each additional grid points defn.
+    Used to define number of points in each row for non-reg grids (=0 for
+    regular grid).
+  - gdsinfo[3] = Interp. of list for optional points defn (Code
+    U{Table 3.11
+    <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-11.shtml>})
+  - gdsinfo[4] = Grid Definition Template Number (Code
+    U{Table 3.1
+    <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-1.shtml>})
+
+ @param gdtmpl: Contains the data values for the specified Grid Definition
+ Template ( NN=gdsinfo[4] ).  Each element of this integer
+ array contains an entry (in the order specified) of Grid
+ Definition Template 3.NN
+
+ @param deflist: (Used if gdsinfo[2] != 0)  Sequence containing the
+ number of grid points contained in each row (or column)
+ of a non-regular grid.
+        """
+        if deflist is not None:
+            dflist = np.array(deflist,'i')
+        else:
+            dflist = None
+        self.scanmodeflags = None
+        gdtnum = gdsinfo[4]
+        if gdtnum in [0,1,2,3,40,41,42,43,44,203,205,32768,32769]:
+            self.scanmodeflags = _dec2bin(gdtmpl[18])[0:4]
+        elif gdtnum == 10: # mercator
+            self.scanmodeflags = _dec2bin(gdtmpl[15])[0:4]
+        elif gdtnum == 20: # stereographic
+            self.scanmodeflags = _dec2bin(gdtmpl[17])[0:4]
+        elif gdtnum == 30: # lambert conformal
+            self.scanmodeflags = _dec2bin(gdtmpl[17])[0:4]
+        elif gdtnum == 31: # albers equal area.
+            self.scanmodeflags = _dec2bin(gdtmpl[17])[0:4]
+        elif gdtnum == 90: # near-sided vertical perspective satellite projection
+            self.scanmodeflags = _dec2bin(gdtmpl[16])[0:4]
+        elif gdtnum == 110: # azimuthal equidistant.
+            self.scanmodeflags = _dec2bin(gdtmpl[15])[0:4]
+        elif gdtnum == 120:
+            self.scanmodeflags = _dec2bin(gdtmpl[6])[0:4]
+        elif gdtnum == 204: # curvilinear orthogonal
+            self.scanmodeflags = _dec2bin(gdtmpl[18])[0:4]
+        elif gdtnum in [1000,1100]:
+            self.scanmodeflags = _dec2bin(gdtmpl[12])[0:4]
+        self.msg,msglen=g2clib.grib2_addgrid(self.msg,np.array(gdsinfo,'i'),np.array(gdtmpl,'i'),dflist)
+
+    def addfield(self,pdtnum,pdtmpl,drtnum,drtmpl,field,coordlist=None):
+        """
+ Add a product definition section, data representation section,
+ bitmap section and data section to the GRIB2 message (sections 4-7).
+ Must be called after grid definition section is created with L{addgrid}.
+
+ @param pdtnum: Product Definition Template Number (see Code U{Table
+ 4.0<http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table4-0.shtml>})
+
+ @param pdtmpl: Sequence with the data values for the specified Product Definition
+ Template (N=pdtnum).  Each element of this integer
+ array contains an entry (in the order specified) of Product
+ Definition Template 4.N
+
+ @param drtnum: Data Representation Template Number (see Code
+ U{Table 5.0
+ <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table5-0.shtml>})
+
+ @param drtmpl: Sequence with the data values for the specified Data Representation
+ Template (N=drtnum).  Each element of this integer
+ array contains an entry (in the order specified) of Data
+ Representation Template 5.N
+ Note that some values in this template (eg. reference
+ values, number of bits, etc...) may be changed by the
+ data packing algorithms.
+ Use this to specify scaling factors and order of
+ spatial differencing, if desired.
+
+ @param field:  numpy array of data points to pack.
+ If field is a masked array, then a bitmap is created from
+ the mask.
+
+ @param coordlist: Sequence containing floating point values intended to document
+ the vertical discretization with model data
+ on hybrid coordinate vertical levels. Default None.
+        """
+        if not hasattr(self,'scanmodeflags'):
+            raise ValueError('addgrid must be called before addfield')
+        # reorder array to be consistent with
+        # specified scan order.
+        if self.scanmodeflags is not None:
+            #if self.scanmodeflags[0]:
+            ## rows scan in the -x direction (so flip)
+            #    fieldsave = field.astype('f') # casting makes a copy
+            #    field[:,:] = fieldsave[:,::-1]
+            ## columns scan in the -y direction (so flip)
+            #if not self.scanmodeflags[1]:
+            #    fieldsave = field.astype('f') # casting makes a copy
+            #    field[:,:] = fieldsave[::-1,:]
+            # adjacent rows scan in opposite direction.
+            # (flip every other row)
+            if self.scanmodeflags[3]:
+                fieldsave = field.astype('f') # casting makes a copy
+                field[1::2,:] = fieldsave[1::2,::-1]
+        fld = field.astype('f')
+        if ma.isMA(field):
+            bmap = 1 - np.ravel(field.mask.astype('i'))
+            bitmapflag  = 0
+        else:
+            bitmapflag = 255
+            bmap = None
+        if coordlist is not None:
+            crdlist = np.array(coordlist,'f')
+        else:
+            crdlist = None
+        self.msg,msglen=g2clib.grib2_addfield(self.msg,pdtnum,np.array(pdtmpl,'i'),crdlist,drtnum,np.array(drtmpl,'i'),np.ravel(fld),bitmapflag,bmap)
+
+    def end(self):
+        """
+ Add an end section (section 8) to the GRIB2 message.
+ A GRIB2 message is not complete without an end section.
+ Once an end section is added, the GRIB2 message can be
+ output to a file.
+        """
+        self.msg,msglen=g2clib.grib2_end(self.msg)
diff --git a/ncepgrib2_docs/api-objects.txt b/ncepgrib2_docs/api-objects.txt
new file mode 100644
index 0000000..9a094cd
--- /dev/null
+++ b/ncepgrib2_docs/api-objects.txt
@@ -0,0 +1,61 @@
+ncepgrib2	ncepgrib2-module.html
+ncepgrib2._dec2bin	ncepgrib2-module.html#_dec2bin
+ncepgrib2.dump	ncepgrib2-module.html#dump
+ncepgrib2._repeatlast	ncepgrib2-module.html#_repeatlast
+ncepgrib2._table0	ncepgrib2-module.html#_table0
+ncepgrib2._putieeeint	ncepgrib2-module.html#_putieeeint
+ncepgrib2.__package__	ncepgrib2-module.html#__package__
+ncepgrib2._n	ncepgrib2-module.html#_n
+ncepgrib2._getieeeint	ncepgrib2-module.html#_getieeeint
+ncepgrib2._getdate	ncepgrib2-module.html#_getdate
+ncepgrib2._earthparams	ncepgrib2-module.html#_earthparams
+ncepgrib2._unpack1	ncepgrib2-module.html#_unpack1
+ncepgrib2._isString	ncepgrib2-module.html#_isString
+ncepgrib2.Grib2Decode	ncepgrib2-module.html#Grib2Decode
+ncepgrib2._flatten	ncepgrib2-module.html#_flatten
+ncepgrib2.Grib2Encode	ncepgrib2.Grib2Encode-class.html
+ncepgrib2.Grib2Encode.msg	ncepgrib2.Grib2Encode-class.html#msg
+ncepgrib2.Grib2Encode.addgrid	ncepgrib2.Grib2Encode-class.html#addgrid
+ncepgrib2.Grib2Encode.end	ncepgrib2.Grib2Encode-class.html#end
+ncepgrib2.Grib2Encode.__init__	ncepgrib2.Grib2Encode-class.html#__init__
+ncepgrib2.Grib2Encode.addfield	ncepgrib2.Grib2Encode-class.html#addfield
+ncepgrib2.Grib2Message	ncepgrib2.Grib2Message-class.html
+ncepgrib2.Grib2Message.shape_of_earth	ncepgrib2.Grib2Message-class.html#shape_of_earth
+ncepgrib2.Grib2Message.data_representation_template_number	ncepgrib2.Grib2Message-class.html#data_representation_template_number
+ncepgrib2.Grib2Message.latlons	ncepgrib2.Grib2Message-class.html#latlons
+ncepgrib2.Grib2Message.product_definition_template_number	ncepgrib2.Grib2Message-class.html#product_definition_template_number
+ncepgrib2.Grib2Message.longitude_of_southern_pole	ncepgrib2.Grib2Message-class.html#longitude_of_southern_pole
+ncepgrib2.Grib2Message.bitmap_indicator_flag	ncepgrib2.Grib2Message-class.html#bitmap_indicator_flag
+ncepgrib2.Grib2Message.missing_value	ncepgrib2.Grib2Message-class.html#missing_value
+ncepgrib2.Grib2Message.__init__	ncepgrib2.Grib2Message-class.html#__init__
+ncepgrib2.Grib2Message.has_local_use_section	ncepgrib2.Grib2Message-class.html#has_local_use_section
+ncepgrib2.Grib2Message.scanmodeflags	ncepgrib2.Grib2Message-class.html#scanmodeflags
+ncepgrib2.Grib2Message.proj4_	ncepgrib2.Grib2Message-class.html#proj4_
+ncepgrib2.Grib2Message.earthRminor	ncepgrib2.Grib2Message-class.html#earthRminor
+ncepgrib2.Grib2Message.grid_definition_template_number	ncepgrib2.Grib2Message-class.html#grid_definition_template_number
+ncepgrib2.Grib2Message.longitude_first_gridpoint	ncepgrib2.Grib2Message-class.html#longitude_first_gridpoint
+ncepgrib2.Grib2Message.grid_definition_info	ncepgrib2.Grib2Message-class.html#grid_definition_info
+ncepgrib2.Grib2Message.identification_section	ncepgrib2.Grib2Message-class.html#identification_section
+ncepgrib2.Grib2Message.earthRmajor	ncepgrib2.Grib2Message-class.html#earthRmajor
+ncepgrib2.Grib2Message.latitude_of_southern_pole	ncepgrib2.Grib2Message-class.html#latitude_of_southern_pole
+ncepgrib2.Grib2Message.angle_of_pole_rotation	ncepgrib2.Grib2Message-class.html#angle_of_pole_rotation
+ncepgrib2.Grib2Message.gridlength_in_x_direction	ncepgrib2.Grib2Message-class.html#gridlength_in_x_direction
+ncepgrib2.Grib2Message.discipline_code	ncepgrib2.Grib2Message-class.html#discipline_code
+ncepgrib2.Grib2Message.grid	ncepgrib2.Grib2Message-class.html#grid
+ncepgrib2.Grib2Message.data	ncepgrib2.Grib2Message-class.html#data
+ncepgrib2.Grib2Message.center_wmo_code	ncepgrib2.Grib2Message-class.html#center_wmo_code
+ncepgrib2.Grib2Message.spectral_truncation_parameters	ncepgrib2.Grib2Message-class.html#spectral_truncation_parameters
+ncepgrib2.Grib2Message.number_of_data_points_to_unpack	ncepgrib2.Grib2Message-class.html#number_of_data_points_to_unpack
+ncepgrib2.Grib2Message.originating_center	ncepgrib2.Grib2Message-class.html#originating_center
+ncepgrib2.Grib2Message.gridlength_in_y_direction	ncepgrib2.Grib2Message-class.html#gridlength_in_y_direction
+ncepgrib2.Grib2Message.points_in_x_direction	ncepgrib2.Grib2Message-class.html#points_in_x_direction
+ncepgrib2.Grib2Message.product_definition_template	ncepgrib2.Grib2Message-class.html#product_definition_template
+ncepgrib2.Grib2Message.grid_definition_template	ncepgrib2.Grib2Message-class.html#grid_definition_template
+ncepgrib2.Grib2Message.values	ncepgrib2.Grib2Message-class.html#values
+ncepgrib2.Grib2Message.__repr__	ncepgrib2.Grib2Message-class.html#__repr__
+ncepgrib2.Grib2Message.longitude_last_gridpoint	ncepgrib2.Grib2Message-class.html#longitude_last_gridpoint
+ncepgrib2.Grib2Message.points_in_y_direction	ncepgrib2.Grib2Message-class.html#points_in_y_direction
+ncepgrib2.Grib2Message.latitude_last_gridpoint	ncepgrib2.Grib2Message-class.html#latitude_last_gridpoint
+ncepgrib2.Grib2Message.latitude_first_gridpoint	ncepgrib2.Grib2Message-class.html#latitude_first_gridpoint
+ncepgrib2.Grib2Message.data_representation_template	ncepgrib2.Grib2Message-class.html#data_representation_template
+ncepgrib2.Grib2Message.missing_value2	ncepgrib2.Grib2Message-class.html#missing_value2
diff --git a/ncepgrib2_docs/class-tree.html b/ncepgrib2_docs/class-tree.html
new file mode 100644
index 0000000..0690b5e
--- /dev/null
+++ b/ncepgrib2_docs/class-tree.html
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>Class Hierarchy</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="ncepgrib2-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Trees   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%"> </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<center><b>
+ [ <a href="module-tree.html">Module Hierarchy</a>
+ | <a href="class-tree.html">Class Hierarchy</a> ]
+</b></center><br />
+<h1 class="epydoc">Class Hierarchy</h1>
+<ul class="nomargin-top">
+    <li> <strong class="uidlink"><a href="ncepgrib2.Grib2Encode-class.html">ncepgrib2.Grib2Encode</a></strong>:
+      <em class="summary">Class for encoding data into a GRIB2 message.</em>
+    </li>
+    <li> <strong class="uidlink"><a href="ncepgrib2.Grib2Message-class.html">ncepgrib2.Grib2Message</a></strong>:
+      <em class="summary">Class for accessing data in a GRIB Edition 2 message.</em>
+    </li>
+</ul>
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="ncepgrib2-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Trees   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1
+    on Wed Nov 20 14:10:14 2013
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/ncepgrib2_docs/crarr.png b/ncepgrib2_docs/crarr.png
new file mode 100644
index 0000000..26b43c5
Binary files /dev/null and b/ncepgrib2_docs/crarr.png differ
diff --git a/ncepgrib2_docs/epydoc.css b/ncepgrib2_docs/epydoc.css
new file mode 100644
index 0000000..90e0507
--- /dev/null
+++ b/ncepgrib2_docs/epydoc.css
@@ -0,0 +1,322 @@
+
+
+/* Epydoc CSS Stylesheet
+ *
+ * This stylesheet can be used to customize the appearance of epydoc's
+ * HTML output.
+ *
+ */
+
+/* Default Colors & Styles
+ *   - Set the default foreground & background color with 'body'; and 
+ *     link colors with 'a:link' and 'a:visited'.
+ *   - Use bold for decision list terms.
+ *   - The heading styles defined here are used for headings *within*
+ *     docstring descriptions.  All headings used by epydoc itself use
+ *     either class='epydoc' or class='toc' (CSS styles for both
+ *     defined below).
+ */
+body                        { background: #ffffff; color: #000000; }
+p                           { margin-top: 0.5em; margin-bottom: 0.5em; }
+a:link                      { color: #0000ff; }
+a:visited                   { color: #204080; }
+dt                          { font-weight: bold; }
+h1                          { font-size: +140%; font-style: italic;
+                              font-weight: bold; }
+h2                          { font-size: +125%; font-style: italic;
+                              font-weight: bold; }
+h3                          { font-size: +110%; font-style: italic;
+                              font-weight: normal; }
+code                        { font-size: 100%; }
+/* N.B.: class, not pseudoclass */
+a.link                      { font-family: monospace; }
+ 
+/* Page Header & Footer
+ *   - The standard page header consists of a navigation bar (with
+ *     pointers to standard pages such as 'home' and 'trees'); a
+ *     breadcrumbs list, which can be used to navigate to containing
+ *     classes or modules; options links, to show/hide private
+ *     variables and to show/hide frames; and a page title (using
+ *     <h1>).  The page title may be followed by a link to the
+ *     corresponding source code (using 'span.codelink').
+ *   - The footer consists of a navigation bar, a timestamp, and a
+ *     pointer to epydoc's homepage.
+ */ 
+h1.epydoc                   { margin: 0; font-size: +140%; font-weight: bold; }
+h2.epydoc                   { font-size: +130%; font-weight: bold; }
+h3.epydoc                   { font-size: +115%; font-weight: bold;
+                              margin-top: 0.2em; }
+td h3.epydoc                { font-size: +115%; font-weight: bold;
+                              margin-bottom: 0; }
+table.navbar                { background: #a0c0ff; color: #000000;
+                              border: 2px groove #c0d0d0; }
+table.navbar table          { color: #000000; }
+th.navbar-select            { background: #70b0ff;
+                              color: #000000; } 
+table.navbar a              { text-decoration: none; }  
+table.navbar a:link         { color: #0000ff; }
+table.navbar a:visited      { color: #204080; }
+span.breadcrumbs            { font-size: 85%; font-weight: bold; }
+span.options                { font-size: 70%; }
+span.codelink               { font-size: 85%; }
+td.footer                   { font-size: 85%; }
+
+/* Table Headers
+ *   - Each summary table and details section begins with a 'header'
+ *     row.  This row contains a section title (marked by
+ *     'span.table-header') as well as a show/hide private link
+ *     (marked by 'span.options', defined above).
+ *   - Summary tables that contain user-defined groups mark those
+ *     groups using 'group header' rows.
+ */
+td.table-header             { background: #70b0ff; color: #000000;
+                              border: 1px solid #608090; }
+td.table-header table       { color: #000000; }
+td.table-header table a:link      { color: #0000ff; }
+td.table-header table a:visited   { color: #204080; }
+span.table-header           { font-size: 120%; font-weight: bold; }
+th.group-header             { background: #c0e0f8; color: #000000;
+                              text-align: left; font-style: italic; 
+                              font-size: 115%; 
+                              border: 1px solid #608090; }
+
+/* Summary Tables (functions, variables, etc)
+ *   - Each object is described by a single row of the table with
+ *     two cells.  The left cell gives the object's type, and is
+ *     marked with 'code.summary-type'.  The right cell gives the
+ *     object's name and a summary description.
+ *   - CSS styles for the table's header and group headers are
+ *     defined above, under 'Table Headers'
+ */
+table.summary               { border-collapse: collapse;
+                              background: #e8f0f8; color: #000000;
+                              border: 1px solid #608090;
+                              margin-bottom: 0.5em; }
+td.summary                  { border: 1px solid #608090; }
+code.summary-type           { font-size: 85%; }
+table.summary a:link        { color: #0000ff; }
+table.summary a:visited     { color: #204080; }
+
+
+/* Details Tables (functions, variables, etc)
+ *   - Each object is described in its own div.
+ *   - A single-row summary table w/ table-header is used as
+ *     a header for each details section (CSS style for table-header
+ *     is defined above, under 'Table Headers').
+ */
+table.details               { border-collapse: collapse;
+                              background: #e8f0f8; color: #000000;
+                              border: 1px solid #608090;
+                              margin: .2em 0 0 0; }
+table.details table         { color: #000000; }
+table.details a:link        { color: #0000ff; }
+table.details a:visited     { color: #204080; }
+
+/* Fields */
+dl.fields                   { margin-left: 2em; margin-top: 1em;
+                              margin-bottom: 1em; }
+dl.fields dd ul             { margin-left: 0em; padding-left: 0em; }
+dl.fields dd ul li ul       { margin-left: 2em; padding-left: 0em; }
+div.fields                  { margin-left: 2em; }
+div.fields p                { margin-bottom: 0.5em; }
+
+/* Index tables (identifier index, term index, etc)
+ *   - link-index is used for indices containing lists of links
+ *     (namely, the identifier index & term index).
+ *   - index-where is used in link indices for the text indicating
+ *     the container/source for each link.
+ *   - metadata-index is used for indices containing metadata
+ *     extracted from fields (namely, the bug index & todo index).
+ */
+table.link-index            { border-collapse: collapse;
+                              background: #e8f0f8; color: #000000;
+                              border: 1px solid #608090; }
+td.link-index               { border-width: 0px; }
+table.link-index a:link     { color: #0000ff; }
+table.link-index a:visited  { color: #204080; }
+span.index-where            { font-size: 70%; }
+table.metadata-index        { border-collapse: collapse;
+                              background: #e8f0f8; color: #000000;
+                              border: 1px solid #608090; 
+                              margin: .2em 0 0 0; }
+td.metadata-index           { border-width: 1px; border-style: solid; }
+table.metadata-index a:link { color: #0000ff; }
+table.metadata-index a:visited  { color: #204080; }
+
+/* Function signatures
+ *   - sig* is used for the signature in the details section.
+ *   - .summary-sig* is used for the signature in the summary 
+ *     table, and when listing property accessor functions.
+ * */
+.sig-name                   { color: #006080; }
+.sig-arg                    { color: #008060; }
+.sig-default                { color: #602000; }
+.summary-sig                { font-family: monospace; }
+.summary-sig-name           { color: #006080; font-weight: bold; }
+table.summary a.summary-sig-name:link
+                            { color: #006080; font-weight: bold; }
+table.summary a.summary-sig-name:visited
+                            { color: #006080; font-weight: bold; }
+.summary-sig-arg            { color: #006040; }
+.summary-sig-default        { color: #501800; }
+
+/* Subclass list
+ */
+ul.subclass-list { display: inline; margin: 0; padding: 0; }
+ul.subclass-list li { display: inline; margin: 0; padding: 0; }
+
+/* To render variables, classes etc. like functions */
+table.summary .summary-name { color: #006080; font-weight: bold;
+                              font-family: monospace; }
+table.summary
+     a.summary-name:link    { color: #006080; font-weight: bold;
+                              font-family: monospace; }
+table.summary
+    a.summary-name:visited  { color: #006080; font-weight: bold;
+                              font-family: monospace; }
+
+/* Variable values
+ *   - In the 'variable details' sections, each varaible's value is
+ *     listed in a 'pre.variable' box.  The width of this box is
+ *     restricted to 80 chars; if the value's repr is longer than
+ *     this it will be wrapped, using a backslash marked with
+ *     class 'variable-linewrap'.  If the value's repr is longer
+ *     than 3 lines, the rest will be ellided; and an ellipsis
+ *     marker ('...' marked with 'variable-ellipsis') will be used.
+ *   - If the value is a string, its quote marks will be marked
+ *     with 'variable-quote'.
+ *   - If the variable is a regexp, it is syntax-highlighted using
+ *     the re* CSS classes.
+ */
+pre.variable                { padding: .5em; margin: 0;
+                              background: #dce4ec; color: #000000;
+                              border: 1px solid #708890; }
+.variable-linewrap          { color: #604000; font-weight: bold; }
+.variable-ellipsis          { color: #604000; font-weight: bold; }
+.variable-quote             { color: #604000; font-weight: bold; }
+.variable-group             { color: #008000; font-weight: bold; }
+.variable-op                { color: #604000; font-weight: bold; }
+.variable-string            { color: #006030; }
+.variable-unknown           { color: #a00000; font-weight: bold; }
+.re                         { color: #000000; }
+.re-char                    { color: #006030; }
+.re-op                      { color: #600000; }
+.re-group                   { color: #003060; }
+.re-ref                     { color: #404040; }
+
+/* Base tree
+ *   - Used by class pages to display the base class hierarchy.
+ */
+pre.base-tree               { font-size: 80%; margin: 0; }
+
+/* Frames-based table of contents headers
+ *   - Consists of two frames: one for selecting modules; and
+ *     the other listing the contents of the selected module.
+ *   - h1.toc is used for each frame's heading
+ *   - h2.toc is used for subheadings within each frame.
+ */
+h1.toc                      { text-align: center; font-size: 105%;
+                              margin: 0; font-weight: bold;
+                              padding: 0; }
+h2.toc                      { font-size: 100%; font-weight: bold; 
+                              margin: 0.5em 0 0 -0.3em; }
+
+/* Syntax Highlighting for Source Code
+ *   - doctest examples are displayed in a 'pre.py-doctest' block.
+ *     If the example is in a details table entry, then it will use
+ *     the colors specified by the 'table pre.py-doctest' line.
+ *   - Source code listings are displayed in a 'pre.py-src' block.
+ *     Each line is marked with 'span.py-line' (used to draw a line
+ *     down the left margin, separating the code from the line
+ *     numbers).  Line numbers are displayed with 'span.py-lineno'.
+ *     The expand/collapse block toggle button is displayed with
+ *     'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not
+ *     modify the font size of the text.)
+ *   - If a source code page is opened with an anchor, then the
+ *     corresponding code block will be highlighted.  The code
+ *     block's header is highlighted with 'py-highlight-hdr'; and
+ *     the code block's body is highlighted with 'py-highlight'.
+ *   - The remaining py-* classes are used to perform syntax
+ *     highlighting (py-string for string literals, py-name for names,
+ *     etc.)
+ */
+pre.py-doctest              { padding: .5em; margin: 1em;
+                              background: #e8f0f8; color: #000000;
+                              border: 1px solid #708890; }
+table pre.py-doctest        { background: #dce4ec;
+                              color: #000000; }
+pre.py-src                  { border: 2px solid #000000; 
+                              background: #f0f0f0; color: #000000; }
+.py-line                    { border-left: 2px solid #000000; 
+                              margin-left: .2em; padding-left: .4em; }
+.py-lineno                  { font-style: italic; font-size: 90%;
+                              padding-left: .5em; }
+a.py-toggle                 { text-decoration: none; }
+div.py-highlight-hdr        { border-top: 2px solid #000000;
+                              border-bottom: 2px solid #000000;
+                              background: #d8e8e8; }
+div.py-highlight            { border-bottom: 2px solid #000000;
+                              background: #d0e0e0; }
+.py-prompt                  { color: #005050; font-weight: bold;}
+.py-more                    { color: #005050; font-weight: bold;}
+.py-string                  { color: #006030; }
+.py-comment                 { color: #003060; }
+.py-keyword                 { color: #600000; }
+.py-output                  { color: #404040; }
+.py-name                    { color: #000050; }
+.py-name:link               { color: #000050 !important; }
+.py-name:visited            { color: #000050 !important; }
+.py-number                  { color: #005000; }
+.py-defname                 { color: #000060; font-weight: bold; }
+.py-def-name                { color: #000060; font-weight: bold; }
+.py-base-class              { color: #000060; }
+.py-param                   { color: #000060; }
+.py-docstring               { color: #006030; }
+.py-decorator               { color: #804020; }
+/* Use this if you don't want links to names underlined: */
+/*a.py-name                   { text-decoration: none; }*/
+
+/* Graphs & Diagrams
+ *   - These CSS styles are used for graphs & diagrams generated using
+ *     Graphviz dot.  'img.graph-without-title' is used for bare
+ *     diagrams (to remove the border created by making the image
+ *     clickable).
+ */
+img.graph-without-title     { border: none; }
+img.graph-with-title        { border: 1px solid #000000; }
+span.graph-title            { font-weight: bold; }
+span.graph-caption          { }
+
+/* General-purpose classes
+ *   - 'p.indent-wrapped-lines' defines a paragraph whose first line
+ *     is not indented, but whose subsequent lines are.
+ *   - The 'nomargin-top' class is used to remove the top margin (e.g.
+ *     from lists).  The 'nomargin' class is used to remove both the
+ *     top and bottom margin (but not the left or right margin --
+ *     for lists, that would cause the bullets to disappear.)
+ */
+p.indent-wrapped-lines      { padding: 0 0 0 7em; text-indent: -7em; 
+                              margin: 0; }
+.nomargin-top               { margin-top: 0; }
+.nomargin                   { margin-top: 0; margin-bottom: 0; }
+
+/* HTML Log */
+div.log-block               { padding: 0; margin: .5em 0 .5em 0;
+                              background: #e8f0f8; color: #000000;
+                              border: 1px solid #000000; }
+div.log-error               { padding: .1em .3em .1em .3em; margin: 4px;
+                              background: #ffb0b0; color: #000000;
+                              border: 1px solid #000000; }
+div.log-warning             { padding: .1em .3em .1em .3em; margin: 4px;
+                              background: #ffffb0; color: #000000;
+                              border: 1px solid #000000; }
+div.log-info               { padding: .1em .3em .1em .3em; margin: 4px;
+                              background: #b0ffb0; color: #000000;
+                              border: 1px solid #000000; }
+h2.log-hdr                  { background: #70b0ff; color: #000000;
+                              margin: 0; padding: 0em 0.5em 0em 0.5em;
+                              border-bottom: 1px solid #000000; font-size: 110%; }
+p.log                       { font-weight: bold; margin: .5em 0 .5em 0; }
+tr.opt-changed              { color: #000000; font-weight: bold; }
+tr.opt-default              { color: #606060; }
+pre.log                     { margin: 0; padding: 0; padding-left: 1em; }
diff --git a/ncepgrib2_docs/epydoc.js b/ncepgrib2_docs/epydoc.js
new file mode 100644
index 0000000..e787dbc
--- /dev/null
+++ b/ncepgrib2_docs/epydoc.js
@@ -0,0 +1,293 @@
+function toggle_private() {
+        // Search for any private/public links on this page.  Store
+        // their old text in "cmd," so we will know what action to
+        // take; and change their text to the opposite action.
+        var cmd = "?";
+        var elts = document.getElementsByTagName("a");
+        for(var i=0; i<elts.length; i++) {
+          if (elts[i].className == "privatelink") {
+            cmd = elts[i].innerHTML;
+            elts[i].innerHTML = ((cmd && cmd.substr(0,4)=="show")?
+                                    "hide private":"show private");
+          }
+        }
+        // Update all DIVs containing private objects.
+        var elts = document.getElementsByTagName("div");
+        for(var i=0; i<elts.length; i++) {
+          if (elts[i].className == "private") {
+            elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"none":"block");
+          }
+          else if (elts[i].className == "public") {
+            elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"block":"none");
+          }
+        }
+        // Update all table rows containing private objects.  Note, we
+        // use "" instead of "block" becaue IE & firefox disagree on what
+        // this should be (block vs table-row), and "" just gives the
+        // default for both browsers.
+        var elts = document.getElementsByTagName("tr");
+        for(var i=0; i<elts.length; i++) {
+          if (elts[i].className == "private") {
+            elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"none":"");
+          }
+        }
+        // Update all list items containing private objects.
+        var elts = document.getElementsByTagName("li");
+        for(var i=0; i<elts.length; i++) {
+          if (elts[i].className == "private") {
+            elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?
+                                        "none":"");
+          }
+        }
+        // Update all list items containing private objects.
+        var elts = document.getElementsByTagName("ul");
+        for(var i=0; i<elts.length; i++) {
+          if (elts[i].className == "private") {
+            elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"none":"block");
+          }
+        }
+        // Set a cookie to remember the current option.
+        document.cookie = "EpydocPrivate="+cmd;
+      }
+function show_private() {
+        var elts = document.getElementsByTagName("a");
+        for(var i=0; i<elts.length; i++) {
+          if (elts[i].className == "privatelink") {
+            cmd = elts[i].innerHTML;
+            if (cmd && cmd.substr(0,4)=="show")
+                toggle_private();
+          }
+        }
+      }
+function getCookie(name) {
+        var dc = document.cookie;
+        var prefix = name + "=";
+        var begin = dc.indexOf("; " + prefix);
+        if (begin == -1) {
+          begin = dc.indexOf(prefix);
+          if (begin != 0) return null;
+        } else
+        { begin += 2; }
+        var end = document.cookie.indexOf(";", begin);
+        if (end == -1)
+        { end = dc.length; }
+        return unescape(dc.substring(begin + prefix.length, end));
+      }
+function setFrame(url1, url2) {
+          parent.frames[1].location.href = url1;
+          parent.frames[2].location.href = url2;
+      }
+function checkCookie() {
+        var cmd=getCookie("EpydocPrivate");
+        if (cmd && cmd.substr(0,4)!="show" && location.href.indexOf("#_") < 0)
+            toggle_private();
+      }
+function toggleCallGraph(id) {
+        var elt = document.getElementById(id);
+        if (elt.style.display == "none")
+            elt.style.display = "block";
+        else
+            elt.style.display = "none";
+      }
+function expand(id) {
+  var elt = document.getElementById(id+"-expanded");
+  if (elt) elt.style.display = "block";
+  var elt = document.getElementById(id+"-expanded-linenums");
+  if (elt) elt.style.display = "block";
+  var elt = document.getElementById(id+"-collapsed");
+  if (elt) { elt.innerHTML = ""; elt.style.display = "none"; }
+  var elt = document.getElementById(id+"-collapsed-linenums");
+  if (elt) { elt.innerHTML = ""; elt.style.display = "none"; }
+  var elt = document.getElementById(id+"-toggle");
+  if (elt) { elt.innerHTML = "-"; }
+}
+
+function collapse(id) {
+  var elt = document.getElementById(id+"-expanded");
+  if (elt) elt.style.display = "none";
+  var elt = document.getElementById(id+"-expanded-linenums");
+  if (elt) elt.style.display = "none";
+  var elt = document.getElementById(id+"-collapsed-linenums");
+  if (elt) { elt.innerHTML = "<br />"; elt.style.display="block"; }
+  var elt = document.getElementById(id+"-toggle");
+  if (elt) { elt.innerHTML = "+"; }
+  var elt = document.getElementById(id+"-collapsed");
+  if (elt) {
+    elt.style.display = "block";
+    
+    var indent = elt.getAttribute("indent");
+    var pad = elt.getAttribute("pad");
+    var s = "<tt class='py-lineno'>";
+    for (var i=0; i<pad.length; i++) { s += " " }
+    s += "</tt>";
+    s += "  <tt class='py-line'>";
+    for (var i=0; i<indent.length; i++) { s += " " }
+    s += "<a href='#' onclick='expand(\"" + id;
+    s += "\");return false'>...</a></tt><br />";
+    elt.innerHTML = s;
+  }
+}
+
+function toggle(id) {
+  elt = document.getElementById(id+"-toggle");
+  if (elt.innerHTML == "-")
+      collapse(id); 
+  else
+      expand(id);
+  return false;
+}
+
+function highlight(id) {
+  var elt = document.getElementById(id+"-def");
+  if (elt) elt.className = "py-highlight-hdr";
+  var elt = document.getElementById(id+"-expanded");
+  if (elt) elt.className = "py-highlight";
+  var elt = document.getElementById(id+"-collapsed");
+  if (elt) elt.className = "py-highlight";
+}
+
+function num_lines(s) {
+  var n = 1;
+  var pos = s.indexOf("\n");
+  while ( pos > 0) {
+    n += 1;
+    pos = s.indexOf("\n", pos+1);
+  }
+  return n;
+}
+
+// Collapse all blocks that mave more than `min_lines` lines.
+function collapse_all(min_lines) {
+  var elts = document.getElementsByTagName("div");
+  for (var i=0; i<elts.length; i++) {
+    var elt = elts[i];
+    var split = elt.id.indexOf("-");
+    if (split > 0)
+      if (elt.id.substring(split, elt.id.length) == "-expanded")
+        if (num_lines(elt.innerHTML) > min_lines)
+          collapse(elt.id.substring(0, split));
+  }
+}
+
+function expandto(href) {
+  var start = href.indexOf("#")+1;
+  if (start != 0 && start != href.length) {
+    if (href.substring(start, href.length) != "-") {
+      collapse_all(4);
+      pos = href.indexOf(".", start);
+      while (pos != -1) {
+        var id = href.substring(start, pos);
+        expand(id);
+        pos = href.indexOf(".", pos+1);
+      }
+      var id = href.substring(start, href.length);
+      expand(id);
+      highlight(id);
+    }
+  }
+}
+
+function kill_doclink(id) {
+  var parent = document.getElementById(id);
+  parent.removeChild(parent.childNodes.item(0));
+}
+function auto_kill_doclink(ev) {
+  if (!ev) var ev = window.event;
+  if (!this.contains(ev.toElement)) {
+    var parent = document.getElementById(this.parentID);
+    parent.removeChild(parent.childNodes.item(0));
+  }
+}
+
+function doclink(id, name, targets_id) {
+  var elt = document.getElementById(id);
+
+  // If we already opened the box, then destroy it.
+  // (This case should never occur, but leave it in just in case.)
+  if (elt.childNodes.length > 1) {
+    elt.removeChild(elt.childNodes.item(0));
+  }
+  else {
+    // The outer box: relative + inline positioning.
+    var box1 = document.createElement("div");
+    box1.style.position = "relative";
+    box1.style.display = "inline";
+    box1.style.top = 0;
+    box1.style.left = 0;
+  
+    // A shadow for fun
+    var shadow = document.createElement("div");
+    shadow.style.position = "absolute";
+    shadow.style.left = "-1.3em";
+    shadow.style.top = "-1.3em";
+    shadow.style.background = "#404040";
+    
+    // The inner box: absolute positioning.
+    var box2 = document.createElement("div");
+    box2.style.position = "relative";
+    box2.style.border = "1px solid #a0a0a0";
+    box2.style.left = "-.2em";
+    box2.style.top = "-.2em";
+    box2.style.background = "white";
+    box2.style.padding = ".3em .4em .3em .4em";
+    box2.style.fontStyle = "normal";
+    box2.onmouseout=auto_kill_doclink;
+    box2.parentID = id;
+
+    // Get the targets
+    var targets_elt = document.getElementById(targets_id);
+    var targets = targets_elt.getAttribute("targets");
+    var links = "";
+    target_list = targets.split(",");
+    for (var i=0; i<target_list.length; i++) {
+        var target = target_list[i].split("=");
+        links += "<li><a href='" + target[1] + 
+               "' style='text-decoration:none'>" +
+               target[0] + "</a></li>";
+    }
+  
+    // Put it all together.
+    elt.insertBefore(box1, elt.childNodes.item(0));
+    //box1.appendChild(box2);
+    box1.appendChild(shadow);
+    shadow.appendChild(box2);
+    box2.innerHTML =
+        "Which <b>"+name+"</b> do you want to see documentation for?" +
+        "<ul style='margin-bottom: 0;'>" +
+        links + 
+        "<li><a href='#' style='text-decoration:none' " +
+        "onclick='kill_doclink(\""+id+"\");return false;'>"+
+        "<i>None of the above</i></a></li></ul>";
+  }
+  return false;
+}
+
+function get_anchor() {
+          var href = location.href;
+          var start = href.indexOf("#")+1;
+          if ((start != 0) && (start != href.length))
+              return href.substring(start, href.length);
+      }
+function redirect_url(dottedName) {
+          // Scan through each element of the "pages" list, and check
+          // if "name" matches with any of them.
+          for (var i=0; i<pages.length; i++) {
+
+              // Each page has the form "<pagename>-m" or "<pagename>-c";
+              // extract the <pagename> portion & compare it to dottedName.
+              var pagename = pages[i].substring(0, pages[i].length-2);
+              if (pagename == dottedName.substring(0,pagename.length)) {
+
+                  // We've found a page that matches `dottedName`;
+                  // construct its URL, using leftover `dottedName`
+                  // content to form an anchor.
+                  var pagetype = pages[i].charAt(pages[i].length-1);
+                  var url = pagename + ((pagetype=="m")?"-module.html":
+                                                        "-class.html");
+                  if (dottedName.length > pagename.length)
+                      url += "#" + dottedName.substring(pagename.length+1,
+                                                        dottedName.length);
+                  return url;
+              }
+          }
+      }
diff --git a/ncepgrib2_docs/help.html b/ncepgrib2_docs/help.html
new file mode 100644
index 0000000..b952f98
--- /dev/null
+++ b/ncepgrib2_docs/help.html
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>Help</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="ncepgrib2-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Help   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%"> </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+
+<h1 class="epydoc"> API Documentation </h1>
+
+<p> This document contains the API (Application Programming Interface)
+documentation for this project.  Documentation for the Python
+objects defined by the project is divided into separate pages for each
+package, module, and class.  The API documentation also includes two
+pages containing information about the project as a whole: a trees
+page, and an index page.  </p>
+
+<h2> Object Documentation </h2>
+
+  <p>Each <strong>Package Documentation</strong> page contains: </p>
+  <ul>
+    <li> A description of the package. </li>
+    <li> A list of the modules and sub-packages contained by the
+    package.  </li>
+    <li> A summary of the classes defined by the package. </li>
+    <li> A summary of the functions defined by the package. </li>
+    <li> A summary of the variables defined by the package. </li>
+    <li> A detailed description of each function defined by the
+    package. </li>
+    <li> A detailed description of each variable defined by the
+    package. </li>
+  </ul>
+  
+  <p>Each <strong>Module Documentation</strong> page contains:</p>
+  <ul>
+    <li> A description of the module. </li>
+    <li> A summary of the classes defined by the module. </li>
+    <li> A summary of the functions defined by the module. </li>
+    <li> A summary of the variables defined by the module. </li>
+    <li> A detailed description of each function defined by the
+    module. </li>
+    <li> A detailed description of each variable defined by the
+    module. </li>
+  </ul>
+  
+  <p>Each <strong>Class Documentation</strong> page contains: </p>
+  <ul>
+    <li> A class inheritance diagram. </li>
+    <li> A list of known subclasses. </li>
+    <li> A description of the class. </li>
+    <li> A summary of the methods defined by the class. </li>
+    <li> A summary of the instance variables defined by the class. </li>
+    <li> A summary of the class (static) variables defined by the
+    class. </li> 
+    <li> A detailed description of each method defined by the
+    class. </li>
+    <li> A detailed description of each instance variable defined by the
+    class. </li> 
+    <li> A detailed description of each class (static) variable defined
+    by the class. </li> 
+  </ul>
+
+<h2> Project Documentation </h2>
+
+  <p> The <strong>Trees</strong> page contains the module and class hierarchies: </p>
+  <ul>
+    <li> The <em>module hierarchy</em> lists every package and module, with
+    modules grouped into packages.  At the top level, and within each
+    package, modules and sub-packages are listed alphabetically. </li>
+    <li> The <em>class hierarchy</em> lists every class, grouped by base
+    class.  If a class has more than one base class, then it will be
+    listed under each base class.  At the top level, and under each base
+    class, classes are listed alphabetically. </li>
+  </ul>
+  
+  <p> The <strong>Index</strong> page contains indices of terms and
+  identifiers: </p>
+  <ul>
+    <li> The <em>term index</em> lists every term indexed by any object's
+    documentation.  For each term, the index provides links to each
+    place where the term is indexed. </li>
+    <li> The <em>identifier index</em> lists the (short) name of every package,
+    module, class, method, function, variable, and parameter.  For each
+    identifier, the index provides a short description, and a link to
+    its documentation. </li>
+  </ul>
+
+<h2> The Table of Contents </h2>
+
+<p> The table of contents occupies the two frames on the left side of
+the window.  The upper-left frame displays the <em>project
+contents</em>, and the lower-left frame displays the <em>module
+contents</em>: </p>
+
+<table class="help summary" border="1" cellspacing="0" cellpadding="3">
+  <tr style="height: 30%">
+    <td align="center" style="font-size: small">
+       Project<br />Contents<hr />...</td>
+    <td align="center" style="font-size: small" rowspan="2" width="70%">
+      API<br />Documentation<br />Frame<br /><br /><br />
+    </td>
+  </tr>
+  <tr>
+    <td align="center" style="font-size: small">
+      Module<br />Contents<hr /> <br />...<br /> 
+    </td>
+  </tr>
+</table><br />
+
+<p> The <strong>project contents frame</strong> contains a list of all packages
+and modules that are defined by the project.  Clicking on an entry
+will display its contents in the module contents frame.  Clicking on a
+special entry, labeled "Everything," will display the contents of
+the entire project. </p>
+
+<p> The <strong>module contents frame</strong> contains a list of every
+submodule, class, type, exception, function, and variable defined by a
+module or package.  Clicking on an entry will display its
+documentation in the API documentation frame.  Clicking on the name of
+the module, at the top of the frame, will display the documentation
+for the module itself. </p>
+
+<p> The "<strong>frames</strong>" and "<strong>no frames</strong>" buttons below the top
+navigation bar can be used to control whether the table of contents is
+displayed or not. </p>
+
+<h2> The Navigation Bar </h2>
+
+<p> A navigation bar is located at the top and bottom of every page.
+It indicates what type of page you are currently viewing, and allows
+you to go to related pages.  The following table describes the labels
+on the navigation bar.  Note that not some labels (such as
+[Parent]) are not displayed on all pages. </p>
+
+<table class="summary" border="1" cellspacing="0" cellpadding="3" width="100%">
+<tr class="summary">
+  <th>Label</th>
+  <th>Highlighted when...</th>
+  <th>Links to...</th>
+</tr>
+  <tr><td valign="top"><strong>[Parent]</strong></td>
+      <td valign="top"><em>(never highlighted)</em></td>
+      <td valign="top"> the parent of the current package </td></tr>
+  <tr><td valign="top"><strong>[Package]</strong></td>
+      <td valign="top">viewing a package</td>
+      <td valign="top">the package containing the current object
+      </td></tr>
+  <tr><td valign="top"><strong>[Module]</strong></td>
+      <td valign="top">viewing a module</td>
+      <td valign="top">the module containing the current object
+      </td></tr> 
+  <tr><td valign="top"><strong>[Class]</strong></td>
+      <td valign="top">viewing a class </td>
+      <td valign="top">the class containing the current object</td></tr>
+  <tr><td valign="top"><strong>[Trees]</strong></td>
+      <td valign="top">viewing the trees page</td>
+      <td valign="top"> the trees page </td></tr>
+  <tr><td valign="top"><strong>[Index]</strong></td>
+      <td valign="top">viewing the index page</td>
+      <td valign="top"> the index page </td></tr>
+  <tr><td valign="top"><strong>[Help]</strong></td>
+      <td valign="top">viewing the help page</td>
+      <td valign="top"> the help page </td></tr>
+</table>
+
+<p> The "<strong>show private</strong>" and "<strong>hide private</strong>" buttons below
+the top navigation bar can be used to control whether documentation
+for private objects is displayed.  Private objects are usually defined
+as objects whose (short) names begin with a single underscore, but do
+not end with an underscore.  For example, "<code>_x</code>",
+"<code>__pprint</code>", and "<code>epydoc.epytext._tokenize</code>"
+are private objects; but "<code>re.sub</code>",
+"<code>__init__</code>", and "<code>type_</code>" are not.  However,
+if a module defines the "<code>__all__</code>" variable, then its
+contents are used to decide which objects are private. </p>
+
+<p> A timestamp below the bottom navigation bar indicates when each
+page was last updated. </p>
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="ncepgrib2-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Help   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1
+    on Wed Nov 20 14:10:14 2013
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/ncepgrib2_docs/identifier-index.html b/ncepgrib2_docs/identifier-index.html
new file mode 100644
index 0000000..0aab755
--- /dev/null
+++ b/ncepgrib2_docs/identifier-index.html
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>Identifier Index</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="ncepgrib2-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Indices   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%"> </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<table border="0" width="100%">
+<tr valign="bottom"><td>
+<h1 class="epydoc">Identifier Index</h1>
+</td><td>
+[
+ <a href="#A">A</a>
+  B
+  C
+ <a href="#D">D</a>
+ <a href="#E">E</a>
+  F
+ <a href="#G">G</a>
+  H
+  I
+  J
+  K
+ <a href="#L">L</a>
+  M
+ <a href="#N">N</a>
+  O
+  P
+  Q
+  R
+  S
+  T
+  U
+ <a href="#V">V</a>
+  W
+  X
+  Y
+  Z
+ <a href="#_">_</a>
+]
+</td></table>
+<table border="0" width="100%">
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="A">A</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="ncepgrib2.Grib2Encode-class.html#addfield">addfield()</a><br />
+<span class="index-where">(in <a href="ncepgrib2.Grib2Encode-class.html">Grib2Encode</a>)</span></td>
+<td width="33%" class="link-index"><a href="ncepgrib2.Grib2Encode-class.html#addgrid">addgrid()</a><br />
+<span class="index-where">(in <a href="ncepgrib2.Grib2Encode-class.html">Grib2Encode</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="D">D</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="ncepgrib2.Grib2Message-class.html#data">data()</a><br />
+<span class="index-where">(in <a href="ncepgrib2.Grib2Message-class.html">Grib2Message</a>)</span></td>
+<td width="33%" class="link-index"><a href="ncepgrib2-module.html#dump">dump()</a><br />
+<span class="index-where">(in <a href="ncepgrib2-module.html">ncepgrib2</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="E">E</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="ncepgrib2.Grib2Encode-class.html#end">end()</a><br />
+<span class="index-where">(in <a href="ncepgrib2.Grib2Encode-class.html">Grib2Encode</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="G">G</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="ncepgrib2-module.html#Grib2Decode">Grib2Decode()</a><br />
+<span class="index-where">(in <a href="ncepgrib2-module.html">ncepgrib2</a>)</span></td>
+<td width="33%" class="link-index"><a href="ncepgrib2.Grib2Message-class.html">Grib2Message</a><br />
+<span class="index-where">(in <a href="ncepgrib2-module.html">ncepgrib2</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="ncepgrib2.Grib2Encode-class.html">Grib2Encode</a><br />
+<span class="index-where">(in <a href="ncepgrib2-module.html">ncepgrib2</a>)</span></td>
+<td width="33%" class="link-index"><a href="ncepgrib2.Grib2Message-class.html#grid">grid()</a><br />
+<span class="index-where">(in <a href="ncepgrib2.Grib2Message-class.html">Grib2Message</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="L">L</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="ncepgrib2.Grib2Message-class.html#latlons">latlons()</a><br />
+<span class="index-where">(in <a href="ncepgrib2.Grib2Message-class.html">Grib2Message</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="N">N</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="ncepgrib2-module.html">ncepgrib2</a></td>
+<td width="33%" class="link-index"> </td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="V">V</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="ncepgrib2.Grib2Message-class.html#values">values</a><br />
+<span class="index-where">(in <a href="ncepgrib2.Grib2Message-class.html">Grib2Message</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr><td class="link-index"> </td><td class="link-index"> </td><td class="link-index"> </td></tr>
+</table>
+</td></tr>
+<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="_">_</a></h2></td>
+<td valign="top">
+<table class="link-index" width="100%" border="1">
+<tr>
+<td width="33%" class="link-index"><a href="ncepgrib2.Grib2Encode-class.html#__init__">__init__()</a><br />
+<span class="index-where">(in <a href="ncepgrib2.Grib2Encode-class.html">Grib2Encode</a>)</span></td>
+<td width="33%" class="link-index"><a href="ncepgrib2.Grib2Message-class.html#__repr__">__repr__()</a><br />
+<span class="index-where">(in <a href="ncepgrib2.Grib2Message-class.html">Grib2Message</a>)</span></td>
+<td width="33%" class="link-index"><a href="ncepgrib2-module.html#_table0">_table0</a><br />
+<span class="index-where">(in <a href="ncepgrib2-module.html">ncepgrib2</a>)</span></td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="ncepgrib2.Grib2Message-class.html#__init__">__init__()</a><br />
+<span class="index-where">(in <a href="ncepgrib2.Grib2Message-class.html">Grib2Message</a>)</span></td>
+<td width="33%" class="link-index"><a href="ncepgrib2-module.html#_earthparams">_earthparams</a><br />
+<span class="index-where">(in <a href="ncepgrib2-module.html">ncepgrib2</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+<tr>
+<td width="33%" class="link-index"><a href="ncepgrib2-module.html#__package__">__package__</a><br />
+<span class="index-where">(in <a href="ncepgrib2-module.html">ncepgrib2</a>)</span></td>
+<td width="33%" class="link-index"><a href="ncepgrib2-module.html#_n">_n</a><br />
+<span class="index-where">(in <a href="ncepgrib2-module.html">ncepgrib2</a>)</span></td>
+<td width="33%" class="link-index"> </td>
+</tr>
+</table>
+</td></tr>
+</table>
+<br /><br /><!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="ncepgrib2-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Indices   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1
+    on Wed Nov 20 14:10:14 2013
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/ncepgrib2_docs/index.html b/ncepgrib2_docs/index.html
new file mode 100644
index 0000000..f24eb74
--- /dev/null
+++ b/ncepgrib2_docs/index.html
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>ncepgrib2</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Home   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%">
+      <span class="breadcrumbs">
+        Module ncepgrib2
+      </span>
+    </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<!-- ==================== MODULE DESCRIPTION ==================== -->
+<h1 class="epydoc">Module ncepgrib2</h1><p class="nomargin-top"><span class="codelink"><a href="ncepgrib2-pysrc.html">source code</a></span></p>
+<hr />
+<div class="fields">      <p><strong>Version:</strong>
+        1.9.3
+      </p>
+</div><!-- ==================== CLASSES ==================== -->
+<a name="section-Classes"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Classes</span></td>
+</tr>
+<tr>
+    <td class="summary" colspan="2">
+        <a href="ncepgrib2.Grib2Encode-class.html" class="summary-name">Grib2Encode</a><br />
+      Class for encoding data into a GRIB2 message.
+    </td>
+  </tr>
+<tr>
+    <td class="summary" colspan="2">
+        <a href="ncepgrib2.Grib2Message-class.html" class="summary-name">Grib2Message</a><br />
+      Class for accessing data in a GRIB Edition 2 message.
+    </td>
+  </tr>
+</table>
+<!-- ==================== FUNCTIONS ==================== -->
+<a name="section-Functions"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Functions</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="ncepgrib2-module.html#Grib2Decode" class="summary-sig-name">Grib2Decode</a>(<span class="summary-sig-arg">filename</span>,
+        <span class="summary-sig-arg">gribmsg</span>=<span class="summary-sig-default">False</span>)</span><br />
+      Read the contents of a GRIB2 file.</td>
+          <td align="right" valign="top">
+            <span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Decode">source code</a></span>
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="ncepgrib2-module.html#dump" class="summary-sig-name">dump</a>(<span class="summary-sig-arg">filename</span>,
+        <span class="summary-sig-arg">grbs</span>)</span><br />
+      write the given <a href="ncepgrib2.Grib2Message-class.html" 
+      class="link">Grib2Message</a> instances to a grib file.</td>
+          <td align="right" valign="top">
+            <span class="codelink"><a href="ncepgrib2-pysrc.html#dump">source code</a></span>
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+</table>
+<!-- ==================== VARIABLES ==================== -->
+<a name="section-Variables"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Variables</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="None">None</code>
+    </td>
+  </tr>
+</table>
+<!-- ==================== FUNCTION DETAILS ==================== -->
+<a name="section-FunctionDetails"></a>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Function Details</span></td>
+</tr>
+</table>
+<a name="Grib2Decode"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">Grib2Decode</span>(<span class="sig-arg">filename</span>,
+        <span class="sig-arg">gribmsg</span>=<span class="sig-default">False</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    ><span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Decode">source code</a></span> 
+    </td>
+  </tr></table>
+  
+  <p>Read the contents of a GRIB2 file.</p>
+  <dl class="fields">
+    <dt>Parameters:</dt>
+    <dd><ul class="nomargin-top">
+        <li><strong class="pname"><code>filename</code></strong> - name of GRIB2 file (default, gribmsg=False) or binary string 
+          representing a grib message (if gribmsg=True).</li>
+    </ul></dd>
+    <dt>Returns:</dt>
+        <dd>a list of <a href="ncepgrib2.Grib2Message-class.html" 
+          class="link">Grib2Message</a> instances representing all of the 
+          grib messages in the file.  Messages with multiple fields are 
+          split into separate messages (so that each <a 
+          href="ncepgrib2.Grib2Message-class.html" 
+          class="link">Grib2Message</a> instance contains just one data 
+          field). The metadata in each GRIB2 message can be accessed via <a
+          href="ncepgrib2.Grib2Message-class.html" 
+          class="link">Grib2Message</a> instance variables, the actual data
+          can be read using <a 
+          href="ncepgrib2.Grib2Message-class.html#data" 
+          class="link">Grib2Message.data</a>, and the lat/lon values of the
+          grid can be accesses using <a 
+          href="ncepgrib2.Grib2Message-class.html#grid" 
+          class="link">Grib2Message.grid</a>. If there is only one grib 
+          message, just the <a href="ncepgrib2.Grib2Message-class.html" 
+          class="link">Grib2Message</a> instance is returned, instead of a 
+          list with one element.</dd>
+  </dl>
+</td></tr></table>
+</div>
+<a name="dump"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">dump</span>(<span class="sig-arg">filename</span>,
+        <span class="sig-arg">grbs</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    ><span class="codelink"><a href="ncepgrib2-pysrc.html#dump">source code</a></span> 
+    </td>
+  </tr></table>
+  
+  <p>write the given <a href="ncepgrib2.Grib2Message-class.html" 
+  class="link">Grib2Message</a> instances to a grib file.</p>
+  <dl class="fields">
+    <dt>Parameters:</dt>
+    <dd><ul class="nomargin-top">
+        <li><strong class="pname"><code>filename</code></strong> - file to write grib data to.</li>
+        <li><strong class="pname"><code>grbs</code></strong> - a list of <a href="ncepgrib2.Grib2Message-class.html" 
+          class="link">Grib2Message</a> instances.</li>
+    </ul></dd>
+  </dl>
+</td></tr></table>
+</div>
+<br />
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Home   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1
+    on Wed Nov 20 14:10:14 2013
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/ncepgrib2_docs/module-tree.html b/ncepgrib2_docs/module-tree.html
new file mode 100644
index 0000000..0a1dfec
--- /dev/null
+++ b/ncepgrib2_docs/module-tree.html
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>Module Hierarchy</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="ncepgrib2-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Trees   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%"> </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<center><b>
+ [ <a href="module-tree.html">Module Hierarchy</a>
+ | <a href="class-tree.html">Class Hierarchy</a> ]
+</b></center><br />
+<h1 class="epydoc">Module Hierarchy</h1>
+<ul class="nomargin-top">
+    <li> <strong class="uidlink"><a href="ncepgrib2-module.html">ncepgrib2</a></strong>    </li>
+</ul>
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="ncepgrib2-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Trees   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1
+    on Wed Nov 20 14:10:14 2013
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/ncepgrib2_docs/ncepgrib2-module.html b/ncepgrib2_docs/ncepgrib2-module.html
new file mode 100644
index 0000000..f24eb74
--- /dev/null
+++ b/ncepgrib2_docs/ncepgrib2-module.html
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>ncepgrib2</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Home   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%">
+      <span class="breadcrumbs">
+        Module ncepgrib2
+      </span>
+    </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<!-- ==================== MODULE DESCRIPTION ==================== -->
+<h1 class="epydoc">Module ncepgrib2</h1><p class="nomargin-top"><span class="codelink"><a href="ncepgrib2-pysrc.html">source code</a></span></p>
+<hr />
+<div class="fields">      <p><strong>Version:</strong>
+        1.9.3
+      </p>
+</div><!-- ==================== CLASSES ==================== -->
+<a name="section-Classes"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Classes</span></td>
+</tr>
+<tr>
+    <td class="summary" colspan="2">
+        <a href="ncepgrib2.Grib2Encode-class.html" class="summary-name">Grib2Encode</a><br />
+      Class for encoding data into a GRIB2 message.
+    </td>
+  </tr>
+<tr>
+    <td class="summary" colspan="2">
+        <a href="ncepgrib2.Grib2Message-class.html" class="summary-name">Grib2Message</a><br />
+      Class for accessing data in a GRIB Edition 2 message.
+    </td>
+  </tr>
+</table>
+<!-- ==================== FUNCTIONS ==================== -->
+<a name="section-Functions"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Functions</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="ncepgrib2-module.html#Grib2Decode" class="summary-sig-name">Grib2Decode</a>(<span class="summary-sig-arg">filename</span>,
+        <span class="summary-sig-arg">gribmsg</span>=<span class="summary-sig-default">False</span>)</span><br />
+      Read the contents of a GRIB2 file.</td>
+          <td align="right" valign="top">
+            <span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Decode">source code</a></span>
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="ncepgrib2-module.html#dump" class="summary-sig-name">dump</a>(<span class="summary-sig-arg">filename</span>,
+        <span class="summary-sig-arg">grbs</span>)</span><br />
+      write the given <a href="ncepgrib2.Grib2Message-class.html" 
+      class="link">Grib2Message</a> instances to a grib file.</td>
+          <td align="right" valign="top">
+            <span class="codelink"><a href="ncepgrib2-pysrc.html#dump">source code</a></span>
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+</table>
+<!-- ==================== VARIABLES ==================== -->
+<a name="section-Variables"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Variables</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="None">None</code>
+    </td>
+  </tr>
+</table>
+<!-- ==================== FUNCTION DETAILS ==================== -->
+<a name="section-FunctionDetails"></a>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Function Details</span></td>
+</tr>
+</table>
+<a name="Grib2Decode"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">Grib2Decode</span>(<span class="sig-arg">filename</span>,
+        <span class="sig-arg">gribmsg</span>=<span class="sig-default">False</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    ><span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Decode">source code</a></span> 
+    </td>
+  </tr></table>
+  
+  <p>Read the contents of a GRIB2 file.</p>
+  <dl class="fields">
+    <dt>Parameters:</dt>
+    <dd><ul class="nomargin-top">
+        <li><strong class="pname"><code>filename</code></strong> - name of GRIB2 file (default, gribmsg=False) or binary string 
+          representing a grib message (if gribmsg=True).</li>
+    </ul></dd>
+    <dt>Returns:</dt>
+        <dd>a list of <a href="ncepgrib2.Grib2Message-class.html" 
+          class="link">Grib2Message</a> instances representing all of the 
+          grib messages in the file.  Messages with multiple fields are 
+          split into separate messages (so that each <a 
+          href="ncepgrib2.Grib2Message-class.html" 
+          class="link">Grib2Message</a> instance contains just one data 
+          field). The metadata in each GRIB2 message can be accessed via <a
+          href="ncepgrib2.Grib2Message-class.html" 
+          class="link">Grib2Message</a> instance variables, the actual data
+          can be read using <a 
+          href="ncepgrib2.Grib2Message-class.html#data" 
+          class="link">Grib2Message.data</a>, and the lat/lon values of the
+          grid can be accesses using <a 
+          href="ncepgrib2.Grib2Message-class.html#grid" 
+          class="link">Grib2Message.grid</a>. If there is only one grib 
+          message, just the <a href="ncepgrib2.Grib2Message-class.html" 
+          class="link">Grib2Message</a> instance is returned, instead of a 
+          list with one element.</dd>
+  </dl>
+</td></tr></table>
+</div>
+<a name="dump"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">dump</span>(<span class="sig-arg">filename</span>,
+        <span class="sig-arg">grbs</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    ><span class="codelink"><a href="ncepgrib2-pysrc.html#dump">source code</a></span> 
+    </td>
+  </tr></table>
+  
+  <p>write the given <a href="ncepgrib2.Grib2Message-class.html" 
+  class="link">Grib2Message</a> instances to a grib file.</p>
+  <dl class="fields">
+    <dt>Parameters:</dt>
+    <dd><ul class="nomargin-top">
+        <li><strong class="pname"><code>filename</code></strong> - file to write grib data to.</li>
+        <li><strong class="pname"><code>grbs</code></strong> - a list of <a href="ncepgrib2.Grib2Message-class.html" 
+          class="link">Grib2Message</a> instances.</li>
+    </ul></dd>
+  </dl>
+</td></tr></table>
+</div>
+<br />
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Home   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1
+    on Wed Nov 20 14:10:14 2013
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/ncepgrib2_docs/ncepgrib2-pysrc.html b/ncepgrib2_docs/ncepgrib2-pysrc.html
new file mode 100644
index 0000000..d0c78bd
--- /dev/null
+++ b/ncepgrib2_docs/ncepgrib2-pysrc.html
@@ -0,0 +1,1538 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>ncepgrib2</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Home   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%">
+      <span class="breadcrumbs">
+        Module ncepgrib2
+      </span>
+    </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<h1 class="epydoc">Source Code for <a href="ncepgrib2-module.html">Module ncepgrib2</a></h1>
+<pre class="py-src">
+<a name="L1"></a><tt class="py-lineno">   1</tt>  <tt class="py-line"><tt class="py-name">__version__</tt> <tt class="py-op">=</tt> <tt class="py-docstring">'1.9.3'</tt> </tt>
+<a name="L2"></a><tt class="py-lineno">   2</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">g2clib</tt> </tt>
+<a name="L3"></a><tt class="py-lineno">   3</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">struct</tt> </tt>
+<a name="L4"></a><tt class="py-lineno">   4</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">string</tt> </tt>
+<a name="L5"></a><tt class="py-lineno">   5</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">math</tt> </tt>
+<a name="L6"></a><tt class="py-lineno">   6</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">warnings</tt> </tt>
+<a name="L7"></a><tt class="py-lineno">   7</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">operator</tt> </tt>
+<a name="L8"></a><tt class="py-lineno">   8</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">datetime</tt> <tt class="py-keyword">import</tt> <tt class="py-name">datetime</tt> </tt>
+<a name="L9"></a><tt class="py-lineno">   9</tt>  <tt class="py-line"><tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
+<a name="L10"></a><tt class="py-lineno">  10</tt>  <tt class="py-line">    <tt class="py-keyword">from</tt> <tt class="py-name">StringIO</tt> <tt class="py-keyword">import</tt> <tt class="py-name">StringIO</tt> </tt>
+<a name="L11"></a><tt class="py-lineno">  11</tt>  <tt class="py-line"><tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt>
+<a name="L12"></a><tt class="py-lineno">  12</tt>  <tt class="py-line">    <tt class="py-keyword">from</tt> <tt class="py-name">io</tt> <tt class="py-keyword">import</tt> <tt class="py-name">BytesIO</tt> <tt class="py-keyword">as</tt> <tt class="py-name">StringIO</tt> </tt>
+<a name="L13"></a><tt class="py-lineno">  13</tt>  <tt class="py-line"> </tt>
+<a name="L14"></a><tt class="py-lineno">  14</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">numpy</tt> <tt class="py-keyword">as</tt> <tt class="py-name">np</tt> </tt>
+<a name="L15"></a><tt class="py-lineno">  15</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">numpy</tt> <tt class="py-keyword">import</tt> <tt class="py-name">ma</tt> </tt>
+<a name="L16"></a><tt class="py-lineno">  16</tt>  <tt class="py-line"><tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
+<a name="L17"></a><tt class="py-lineno">  17</tt>  <tt class="py-line">    <tt class="py-keyword">import</tt> <tt class="py-name">pyproj</tt> </tt>
+<a name="L18"></a><tt class="py-lineno">  18</tt>  <tt class="py-line"><tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt>
+<a name="L19"></a><tt class="py-lineno">  19</tt>  <tt class="py-line">    <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
+<a name="L20"></a><tt class="py-lineno">  20</tt>  <tt class="py-line">        <tt class="py-keyword">from</tt> <tt class="py-name">mpl_toolkits</tt><tt class="py-op">.</tt><tt class="py-name">basemap</tt> <tt class="py-keyword">import</tt> <tt class="py-name">pyproj</tt> </tt>
+<a name="L21"></a><tt class="py-lineno">  21</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt><tt class="py-op">:</tt> </tt>
+<a name="L22"></a><tt class="py-lineno">  22</tt>  <tt class="py-line">        <tt class="py-keyword">raise</tt> <tt class="py-name">ImportError</tt><tt class="py-op">(</tt><tt class="py-string">"either pyproj or basemap required"</tt><tt class="py-op">)</tt> </tt>
+<a name="L23"></a><tt class="py-lineno">  23</tt>  <tt class="py-line"> </tt>
+<a name="L24"></a><tt class="py-lineno">  24</tt>  <tt class="py-line"><tt class="py-comment"># Code Table 3.2: Shape of the Earth.</tt> </tt>
+<a name="L25"></a><tt class="py-lineno">  25</tt>  <tt class="py-line"><tt id="link-0" class="py-name" targets="Variable ncepgrib2._earthparams=ncepgrib2-module.html#_earthparams"><a title="ncepgrib2._earthparams" class="py-name" href="#" onclick="return doclink('link-0', '_earthparams', 'link-0');">_earthparams</a></tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">6367470.0</tt><tt class="py-op">,</tt> </tt>
+<a name="L26"></a><tt class="py-lineno">  26</tt>  <tt class="py-line"><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-string">'Spherical - radius specified in m by data producer'</tt><tt class="py-op">,</tt> </tt>
+<a name="L27"></a><tt class="py-lineno">  27</tt>  <tt class="py-line"><tt class="py-number">2</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-number">6378160.0</tt><tt class="py-op">,</tt><tt class="py-number">6356775.0</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L28"></a><tt class="py-lineno">  28</tt>  <tt class="py-line"><tt class="py-number">3</tt><tt class="py-op">:</tt><tt class="py-string">'OblateSpheroid - major and minor axes specified in km by data producer'</tt><tt class="py-op">,</tt> </tt>
+<a name="L29"></a><tt class="py-lineno">  29</tt>  <tt class="py-line"><tt class="py-number">4</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-number">6378137.0</tt><tt class="py-op">,</tt><tt class="py-number">6356752.314</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L30"></a><tt class="py-lineno">  30</tt>  <tt class="py-line"><tt class="py-number">5</tt><tt class="py-op">:</tt><tt class="py-string">'WGS84'</tt><tt class="py-op">,</tt> </tt>
+<a name="L31"></a><tt class="py-lineno">  31</tt>  <tt class="py-line"><tt class="py-number">6</tt><tt class="py-op">:</tt><tt class="py-number">6371229.0</tt><tt class="py-op">,</tt> </tt>
+<a name="L32"></a><tt class="py-lineno">  32</tt>  <tt class="py-line"><tt class="py-number">7</tt><tt class="py-op">:</tt><tt class="py-string">'OblateSpheroid - major and minor axes specified in m by data producer'</tt><tt class="py-op">,</tt> </tt>
+<a name="L33"></a><tt class="py-lineno">  33</tt>  <tt class="py-line"><tt class="py-number">8</tt><tt class="py-op">:</tt><tt class="py-number">6371200.0</tt><tt class="py-op">,</tt> </tt>
+<a name="L34"></a><tt class="py-lineno">  34</tt>  <tt class="py-line"><tt class="py-number">255</tt><tt class="py-op">:</tt><tt class="py-string">'Missing'</tt><tt class="py-op">}</tt> </tt>
+<a name="L35"></a><tt class="py-lineno">  35</tt>  <tt class="py-line"><tt class="py-keyword">for</tt> <tt id="link-1" class="py-name" targets="Variable ncepgrib2._n=ncepgrib2-module.html#_n"><a title="ncepgrib2._n" class="py-name" href="#" onclick="return doclink('link-1', '_n', 'link-1');">_n</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-number">192</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L36"></a><tt class="py-lineno">  36</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt id="link-2" class="py-name"><a title="ncepgrib2._n" class="py-name" href="#" onclick="return doclink('link-2', '_n', 'link-1');">_n</a></tt> <tt class="py-keyword">in</tt> <tt id="link-3" class="py-name"><a title="ncepgrib2._earthparams" class="py-name" href="#" onclick="return doclink('link-3', '_earthparams', 'link-0');">_earthparams</a></tt><tt  [...]
+<a name="L37"></a><tt class="py-lineno">  37</tt>  <tt class="py-line"><tt class="py-keyword">for</tt> <tt id="link-6" class="py-name"><a title="ncepgrib2._n" class="py-name" href="#" onclick="return doclink('link-6', '_n', 'link-1');">_n</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-number">192</tt><tt class="py-op">,</tt><tt class="py-number">255</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L38"></a><tt class="py-lineno">  38</tt>  <tt class="py-line">    <tt id="link-7" class="py-name"><a title="ncepgrib2._earthparams" class="py-name" href="#" onclick="return doclink('link-7', '_earthparams', 'link-0');">_earthparams</a></tt><tt class="py-op">[</tt><tt id="link-8" class="py-name"><a title="ncepgrib2._n" class="py-name" href="#" onclick="return doclink('link-8', '_n', 'link-1');">_n</a></tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-string">'Re [...]
+<a name="L39"></a><tt class="py-lineno">  39</tt>  <tt class="py-line"> </tt>
+<a name="L40"></a><tt class="py-lineno">  40</tt>  <tt class="py-line"><tt id="link-9" class="py-name" targets="Variable ncepgrib2._table0=ncepgrib2-module.html#_table0"><a title="ncepgrib2._table0" class="py-name" href="#" onclick="return doclink('link-9', '_table0', 'link-9');">_table0</a></tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Melbourne (WMC)'</tt><tt class="py-op">,</tt><tt [...]
+<a name="L41"></a><tt class="py-lineno">  41</tt>  <tt class="py-line"><tt class="py-number">2</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Melbourne - BMRC (WMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L42"></a><tt class="py-lineno">  42</tt>  <tt class="py-line"><tt class="py-number">3</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Melbourne (WMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L43"></a><tt class="py-lineno">  43</tt>  <tt class="py-line"><tt class="py-number">4</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Moscow (WMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L44"></a><tt class="py-lineno">  44</tt>  <tt class="py-line"><tt class="py-number">5</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Moscow (WMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L45"></a><tt class="py-lineno">  45</tt>  <tt class="py-line"><tt class="py-number">6</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Moscow (WMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L46"></a><tt class="py-lineno">  46</tt>  <tt class="py-line"><tt class="py-number">7</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'US National Weather Service - NCEP (WMC)'</tt><tt class="py-op">,</tt><tt class="py-string">'kwbc'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L47"></a><tt class="py-lineno">  47</tt>  <tt class="py-line"><tt class="py-number">8</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'US National Weather Service - NWSTG (WMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L48"></a><tt class="py-lineno">  48</tt>  <tt class="py-line"><tt class="py-number">9</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'US National Weather Service - Other (WMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L49"></a><tt class="py-lineno">  49</tt>  <tt class="py-line"><tt class="py-number">10</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Cairo (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L50"></a><tt class="py-lineno">  50</tt>  <tt class="py-line"><tt class="py-number">11</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Cairo (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L51"></a><tt class="py-lineno">  51</tt>  <tt class="py-line"><tt class="py-number">12</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Dakar (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L52"></a><tt class="py-lineno">  52</tt>  <tt class="py-line"><tt class="py-number">13</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Dakar (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L53"></a><tt class="py-lineno">  53</tt>  <tt class="py-line"><tt class="py-number">14</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Nairobi (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L54"></a><tt class="py-lineno">  54</tt>  <tt class="py-line"><tt class="py-number">15</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Nairobi (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L55"></a><tt class="py-lineno">  55</tt>  <tt class="py-line"><tt class="py-number">16</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Casablanca'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L56"></a><tt class="py-lineno">  56</tt>  <tt class="py-line"><tt class="py-number">17</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Tunis (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L57"></a><tt class="py-lineno">  57</tt>  <tt class="py-line"><tt class="py-number">18</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Tunis-Casablanca (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L58"></a><tt class="py-lineno">  58</tt>  <tt class="py-line"><tt class="py-number">19</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Tunis-Casablanca (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L59"></a><tt class="py-lineno">  59</tt>  <tt class="py-line"><tt class="py-number">20</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Las Palmas (RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L60"></a><tt class="py-lineno">  60</tt>  <tt class="py-line"><tt class="py-number">21</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Algiers (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L61"></a><tt class="py-lineno">  61</tt>  <tt class="py-line"><tt class="py-number">22</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'ACMAD'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L62"></a><tt class="py-lineno">  62</tt>  <tt class="py-line"><tt class="py-number">23</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Mozambique (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L63"></a><tt class="py-lineno">  63</tt>  <tt class="py-line"><tt class="py-number">24</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Pretoria (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L64"></a><tt class="py-lineno">  64</tt>  <tt class="py-line"><tt class="py-number">25</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'La Reunion (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L65"></a><tt class="py-lineno">  65</tt>  <tt class="py-line"><tt class="py-number">26</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Khabarovsk (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L66"></a><tt class="py-lineno">  66</tt>  <tt class="py-line"><tt class="py-number">27</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Khabarovsk (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L67"></a><tt class="py-lineno">  67</tt>  <tt class="py-line"><tt class="py-number">28</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'New Delhi (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L68"></a><tt class="py-lineno">  68</tt>  <tt class="py-line"><tt class="py-number">29</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'New Delhi (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L69"></a><tt class="py-lineno">  69</tt>  <tt class="py-line"><tt class="py-number">30</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Novosibirsk (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L70"></a><tt class="py-lineno">  70</tt>  <tt class="py-line"><tt class="py-number">31</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Novosibirsk (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L71"></a><tt class="py-lineno">  71</tt>  <tt class="py-line"><tt class="py-number">32</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Tashkent (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L72"></a><tt class="py-lineno">  72</tt>  <tt class="py-line"><tt class="py-number">33</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Jeddah (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L73"></a><tt class="py-lineno">  73</tt>  <tt class="py-line"><tt class="py-number">34</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Japanese Meteorological Agency - Tokyo (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-string">'rjtd'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L74"></a><tt class="py-lineno">  74</tt>  <tt class="py-line"><tt class="py-number">35</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Japanese Meteorological Agency - Tokyo (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L75"></a><tt class="py-lineno">  75</tt>  <tt class="py-line"><tt class="py-number">36</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Bankok'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L76"></a><tt class="py-lineno">  76</tt>  <tt class="py-line"><tt class="py-number">37</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Ulan Bator'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L77"></a><tt class="py-lineno">  77</tt>  <tt class="py-line"><tt class="py-number">38</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Beijing (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-string">'babj'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L78"></a><tt class="py-lineno">  78</tt>  <tt class="py-line"><tt class="py-number">39</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Beijing (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L79"></a><tt class="py-lineno">  79</tt>  <tt class="py-line"><tt class="py-number">40</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Korean Meteorological Administration - Seoul'</tt><tt class="py-op">,</tt><tt class="py-string">'rksl'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L80"></a><tt class="py-lineno">  80</tt>  <tt class="py-line"><tt class="py-number">41</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Buenos Aires (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L81"></a><tt class="py-lineno">  81</tt>  <tt class="py-line"><tt class="py-number">42</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Buenos Aires (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L82"></a><tt class="py-lineno">  82</tt>  <tt class="py-line"><tt class="py-number">43</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Brasilia (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L83"></a><tt class="py-lineno">  83</tt>  <tt class="py-line"><tt class="py-number">44</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Brasilia (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L84"></a><tt class="py-lineno">  84</tt>  <tt class="py-line"><tt class="py-number">45</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Santiago'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L85"></a><tt class="py-lineno">  85</tt>  <tt class="py-line"><tt class="py-number">46</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Brazilian Space Agency - INPE'</tt><tt class="py-op">,</tt><tt class="py-string">'sbsj'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L86"></a><tt class="py-lineno">  86</tt>  <tt class="py-line"><tt class="py-number">47</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Columbia (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L87"></a><tt class="py-lineno">  87</tt>  <tt class="py-line"><tt class="py-number">48</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Ecuador (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L88"></a><tt class="py-lineno">  88</tt>  <tt class="py-line"><tt class="py-number">49</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Peru (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L89"></a><tt class="py-lineno">  89</tt>  <tt class="py-line"><tt class="py-number">50</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Venezuela (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L90"></a><tt class="py-lineno">  90</tt>  <tt class="py-line"><tt class="py-number">51</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Miami (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L91"></a><tt class="py-lineno">  91</tt>  <tt class="py-line"><tt class="py-number">52</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Tropical Prediction Center (NHC), Miami (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L92"></a><tt class="py-lineno">  92</tt>  <tt class="py-line"><tt class="py-number">53</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Canadian Meteorological Service - Montreal (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L93"></a><tt class="py-lineno">  93</tt>  <tt class="py-line"><tt class="py-number">54</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Canadian Meteorological Service - Montreal (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-string">'cwao'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L94"></a><tt class="py-lineno">  94</tt>  <tt class="py-line"><tt class="py-number">55</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'San Francisco'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L95"></a><tt class="py-lineno">  95</tt>  <tt class="py-line"><tt class="py-number">56</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'ARINC Center'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L96"></a><tt class="py-lineno">  96</tt>  <tt class="py-line"><tt class="py-number">57</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'U.S. Air Force - Global Weather Center'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L97"></a><tt class="py-lineno">  97</tt>  <tt class="py-line"><tt class="py-number">58</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'US Navy - Fleet Numerical Oceanography Center'</tt><tt class="py-op">,</tt><tt class="py-string">'fnmo'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L98"></a><tt class="py-lineno">  98</tt>  <tt class="py-line"><tt class="py-number">59</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'NOAA Forecast Systems Lab, Boulder CO'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L99"></a><tt class="py-lineno">  99</tt>  <tt class="py-line"><tt class="py-number">60</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'National Center for Atmospheric Research (NCAR), Boulder, CO'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L100"></a><tt class="py-lineno"> 100</tt>  <tt class="py-line"><tt class="py-number">61</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Service ARGOS - Landover, MD, USA'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L101"></a><tt class="py-lineno"> 101</tt>  <tt class="py-line"><tt class="py-number">62</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'US Naval Oceanographic Office'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L102"></a><tt class="py-lineno"> 102</tt>  <tt class="py-line"><tt class="py-number">63</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L103"></a><tt class="py-lineno"> 103</tt>  <tt class="py-line"><tt class="py-number">64</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Honolulu'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L104"></a><tt class="py-lineno"> 104</tt>  <tt class="py-line"><tt class="py-number">65</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Darwin (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L105"></a><tt class="py-lineno"> 105</tt>  <tt class="py-line"><tt class="py-number">66</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Darwin (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L106"></a><tt class="py-lineno"> 106</tt>  <tt class="py-line"><tt class="py-number">67</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Melbourne (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L107"></a><tt class="py-lineno"> 107</tt>  <tt class="py-line"><tt class="py-number">68</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L108"></a><tt class="py-lineno"> 108</tt>  <tt class="py-line"><tt class="py-number">69</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Wellington (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L109"></a><tt class="py-lineno"> 109</tt>  <tt class="py-line"><tt class="py-number">70</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Wellington (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L110"></a><tt class="py-lineno"> 110</tt>  <tt class="py-line"><tt class="py-number">71</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Nadi (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L111"></a><tt class="py-lineno"> 111</tt>  <tt class="py-line"><tt class="py-number">72</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Singapore'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L112"></a><tt class="py-lineno"> 112</tt>  <tt class="py-line"><tt class="py-number">73</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Malaysia (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L113"></a><tt class="py-lineno"> 113</tt>  <tt class="py-line"><tt class="py-number">74</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'U.K. Met Office - Exeter (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-string">'egrr'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L114"></a><tt class="py-lineno"> 114</tt>  <tt class="py-line"><tt class="py-number">75</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'U.K. Met Office - Exeter (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L115"></a><tt class="py-lineno"> 115</tt>  <tt class="py-line"><tt class="py-number">76</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Moscow (RSMC/RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L116"></a><tt class="py-lineno"> 116</tt>  <tt class="py-line"><tt class="py-number">77</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L117"></a><tt class="py-lineno"> 117</tt>  <tt class="py-line"><tt class="py-number">78</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Offenbach (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-string">'edzw'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L118"></a><tt class="py-lineno"> 118</tt>  <tt class="py-line"><tt class="py-number">79</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Offenbach (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L119"></a><tt class="py-lineno"> 119</tt>  <tt class="py-line"><tt class="py-number">80</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Rome (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-string">'cnmc'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L120"></a><tt class="py-lineno"> 120</tt>  <tt class="py-line"><tt class="py-number">81</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Rome (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L121"></a><tt class="py-lineno"> 121</tt>  <tt class="py-line"><tt class="py-number">82</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Norrkoping'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L122"></a><tt class="py-lineno"> 122</tt>  <tt class="py-line"><tt class="py-number">83</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Norrkoping'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L123"></a><tt class="py-lineno"> 123</tt>  <tt class="py-line"><tt class="py-number">84</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'French Weather Service - Toulouse'</tt><tt class="py-op">,</tt><tt class="py-string">'lfpw'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L124"></a><tt class="py-lineno"> 124</tt>  <tt class="py-line"><tt class="py-number">85</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'French Weather Service - Toulouse'</tt><tt class="py-op">,</tt><tt class="py-string">'lfpw'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L125"></a><tt class="py-lineno"> 125</tt>  <tt class="py-line"><tt class="py-number">86</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Helsinki'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L126"></a><tt class="py-lineno"> 126</tt>  <tt class="py-line"><tt class="py-number">87</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Belgrade'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L127"></a><tt class="py-lineno"> 127</tt>  <tt class="py-line"><tt class="py-number">88</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Oslo'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L128"></a><tt class="py-lineno"> 128</tt>  <tt class="py-line"><tt class="py-number">89</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Prague'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L129"></a><tt class="py-lineno"> 129</tt>  <tt class="py-line"><tt class="py-number">90</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Episkopi'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L130"></a><tt class="py-lineno"> 130</tt>  <tt class="py-line"><tt class="py-number">91</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Ankara'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L131"></a><tt class="py-lineno"> 131</tt>  <tt class="py-line"><tt class="py-number">92</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Frankfurt/Main (RAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L132"></a><tt class="py-lineno"> 132</tt>  <tt class="py-line"><tt class="py-number">93</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'London (WAFC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L133"></a><tt class="py-lineno"> 133</tt>  <tt class="py-line"><tt class="py-number">94</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Copenhagen'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L134"></a><tt class="py-lineno"> 134</tt>  <tt class="py-line"><tt class="py-number">95</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Rota'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L135"></a><tt class="py-lineno"> 135</tt>  <tt class="py-line"><tt class="py-number">96</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Athens'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L136"></a><tt class="py-lineno"> 136</tt>  <tt class="py-line"><tt class="py-number">97</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'European Space Agency (ESA)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L137"></a><tt class="py-lineno"> 137</tt>  <tt class="py-line"><tt class="py-number">98</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'European Center for Medium-Range Weather Forecasts (RSMC)'</tt><tt class="py-op">,</tt><tt class="py-string">'ecmf'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L138"></a><tt class="py-lineno"> 138</tt>  <tt class="py-line"><tt class="py-number">99</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'De BiltNone), Netherlands'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L139"></a><tt class="py-lineno"> 139</tt>  <tt class="py-line"><tt class="py-number">100</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Brazzaville'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L140"></a><tt class="py-lineno"> 140</tt>  <tt class="py-line"><tt class="py-number">101</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Abidjan'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L141"></a><tt class="py-lineno"> 141</tt>  <tt class="py-line"><tt class="py-number">102</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Libyan Arab Jamahiriya (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L142"></a><tt class="py-lineno"> 142</tt>  <tt class="py-line"><tt class="py-number">103</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Madagascar (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L143"></a><tt class="py-lineno"> 143</tt>  <tt class="py-line"><tt class="py-number">104</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Mauritius (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L144"></a><tt class="py-lineno"> 144</tt>  <tt class="py-line"><tt class="py-number">105</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Niger (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L145"></a><tt class="py-lineno"> 145</tt>  <tt class="py-line"><tt class="py-number">106</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Seychelles (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L146"></a><tt class="py-lineno"> 146</tt>  <tt class="py-line"><tt class="py-number">107</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Uganda (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L147"></a><tt class="py-lineno"> 147</tt>  <tt class="py-line"><tt class="py-number">108</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Tanzania (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L148"></a><tt class="py-lineno"> 148</tt>  <tt class="py-line"><tt class="py-number">109</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Zimbabwe (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L149"></a><tt class="py-lineno"> 149</tt>  <tt class="py-line"><tt class="py-number">110</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Hong-Kong'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L150"></a><tt class="py-lineno"> 150</tt>  <tt class="py-line"><tt class="py-number">111</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Afghanistan (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L151"></a><tt class="py-lineno"> 151</tt>  <tt class="py-line"><tt class="py-number">112</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Bahrain (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L152"></a><tt class="py-lineno"> 152</tt>  <tt class="py-line"><tt class="py-number">113</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Bangladesh (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L153"></a><tt class="py-lineno"> 153</tt>  <tt class="py-line"><tt class="py-number">114</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Bhutan (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L154"></a><tt class="py-lineno"> 154</tt>  <tt class="py-line"><tt class="py-number">115</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Cambodia (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L155"></a><tt class="py-lineno"> 155</tt>  <tt class="py-line"><tt class="py-number">116</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">"Democratic People's Republic of Korea (NMC)"</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L156"></a><tt class="py-lineno"> 156</tt>  <tt class="py-line"><tt class="py-number">117</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Islamic Republic of Iran (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L157"></a><tt class="py-lineno"> 157</tt>  <tt class="py-line"><tt class="py-number">118</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Iraq (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L158"></a><tt class="py-lineno"> 158</tt>  <tt class="py-line"><tt class="py-number">119</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Kazakhstan (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L159"></a><tt class="py-lineno"> 159</tt>  <tt class="py-line"><tt class="py-number">120</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Kuwait (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L160"></a><tt class="py-lineno"> 160</tt>  <tt class="py-line"><tt class="py-number">121</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Kyrgyz Republic (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L161"></a><tt class="py-lineno"> 161</tt>  <tt class="py-line"><tt class="py-number">122</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">"Lao People's Democratic Republic (NMC)"</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L162"></a><tt class="py-lineno"> 162</tt>  <tt class="py-line"><tt class="py-number">123</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'MacaoNone), China'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L163"></a><tt class="py-lineno"> 163</tt>  <tt class="py-line"><tt class="py-number">124</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Maldives (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L164"></a><tt class="py-lineno"> 164</tt>  <tt class="py-line"><tt class="py-number">125</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Myanmar (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L165"></a><tt class="py-lineno"> 165</tt>  <tt class="py-line"><tt class="py-number">126</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Nepal (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L166"></a><tt class="py-lineno"> 166</tt>  <tt class="py-line"><tt class="py-number">127</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Oman (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L167"></a><tt class="py-lineno"> 167</tt>  <tt class="py-line"><tt class="py-number">128</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Pakistan (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L168"></a><tt class="py-lineno"> 168</tt>  <tt class="py-line"><tt class="py-number">129</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Qatar (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L169"></a><tt class="py-lineno"> 169</tt>  <tt class="py-line"><tt class="py-number">130</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Republic of Yemen (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L170"></a><tt class="py-lineno"> 170</tt>  <tt class="py-line"><tt class="py-number">131</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Sri Lanka (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L171"></a><tt class="py-lineno"> 171</tt>  <tt class="py-line"><tt class="py-number">132</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Tajikistan (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L172"></a><tt class="py-lineno"> 172</tt>  <tt class="py-line"><tt class="py-number">133</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Turkmenistan (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L173"></a><tt class="py-lineno"> 173</tt>  <tt class="py-line"><tt class="py-number">134</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'United Arab Emirates (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L174"></a><tt class="py-lineno"> 174</tt>  <tt class="py-line"><tt class="py-number">135</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Uzbekistan (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L175"></a><tt class="py-lineno"> 175</tt>  <tt class="py-line"><tt class="py-number">136</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Socialist Republic of Viet Nam (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L176"></a><tt class="py-lineno"> 176</tt>  <tt class="py-line"><tt class="py-number">137</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L177"></a><tt class="py-lineno"> 177</tt>  <tt class="py-line"><tt class="py-number">138</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L178"></a><tt class="py-lineno"> 178</tt>  <tt class="py-line"><tt class="py-number">139</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L179"></a><tt class="py-lineno"> 179</tt>  <tt class="py-line"><tt class="py-number">140</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Bolivia (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L180"></a><tt class="py-lineno"> 180</tt>  <tt class="py-line"><tt class="py-number">141</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Guyana (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L181"></a><tt class="py-lineno"> 181</tt>  <tt class="py-line"><tt class="py-number">142</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Paraguay (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L182"></a><tt class="py-lineno"> 182</tt>  <tt class="py-line"><tt class="py-number">143</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Suriname (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L183"></a><tt class="py-lineno"> 183</tt>  <tt class="py-line"><tt class="py-number">144</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Uruguay (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L184"></a><tt class="py-lineno"> 184</tt>  <tt class="py-line"><tt class="py-number">145</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'French Guyana'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L185"></a><tt class="py-lineno"> 185</tt>  <tt class="py-line"><tt class="py-number">146</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Brazilian Navy Hydrographic Center'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L186"></a><tt class="py-lineno"> 186</tt>  <tt class="py-line"><tt class="py-number">147</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L187"></a><tt class="py-lineno"> 187</tt>  <tt class="py-line"><tt class="py-number">148</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L188"></a><tt class="py-lineno"> 188</tt>  <tt class="py-line"><tt class="py-number">149</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L189"></a><tt class="py-lineno"> 189</tt>  <tt class="py-line"><tt class="py-number">150</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Antigua and Barbuda (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L190"></a><tt class="py-lineno"> 190</tt>  <tt class="py-line"><tt class="py-number">151</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Bahamas (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L191"></a><tt class="py-lineno"> 191</tt>  <tt class="py-line"><tt class="py-number">152</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Barbados (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L192"></a><tt class="py-lineno"> 192</tt>  <tt class="py-line"><tt class="py-number">153</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Belize (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L193"></a><tt class="py-lineno"> 193</tt>  <tt class="py-line"><tt class="py-number">154</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'British Caribbean Territories Center'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L194"></a><tt class="py-lineno"> 194</tt>  <tt class="py-line"><tt class="py-number">155</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'San Jose'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L195"></a><tt class="py-lineno"> 195</tt>  <tt class="py-line"><tt class="py-number">156</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Cuba (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L196"></a><tt class="py-lineno"> 196</tt>  <tt class="py-line"><tt class="py-number">157</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Dominica (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L197"></a><tt class="py-lineno"> 197</tt>  <tt class="py-line"><tt class="py-number">158</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Dominican Republic (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L198"></a><tt class="py-lineno"> 198</tt>  <tt class="py-line"><tt class="py-number">159</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'El Salvador (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L199"></a><tt class="py-lineno"> 199</tt>  <tt class="py-line"><tt class="py-number">160</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'US NOAA/NESDIS'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L200"></a><tt class="py-lineno"> 200</tt>  <tt class="py-line"><tt class="py-number">161</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'US NOAA Office of Oceanic and Atmospheric Research'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L201"></a><tt class="py-lineno"> 201</tt>  <tt class="py-line"><tt class="py-number">162</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Guatemala (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L202"></a><tt class="py-lineno"> 202</tt>  <tt class="py-line"><tt class="py-number">163</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Haiti (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L203"></a><tt class="py-lineno"> 203</tt>  <tt class="py-line"><tt class="py-number">164</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Honduras (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L204"></a><tt class="py-lineno"> 204</tt>  <tt class="py-line"><tt class="py-number">165</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Jamaica (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L205"></a><tt class="py-lineno"> 205</tt>  <tt class="py-line"><tt class="py-number">166</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Mexico'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L206"></a><tt class="py-lineno"> 206</tt>  <tt class="py-line"><tt class="py-number">167</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Netherlands Antilles and Aruba (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L207"></a><tt class="py-lineno"> 207</tt>  <tt class="py-line"><tt class="py-number">168</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Nicaragua (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L208"></a><tt class="py-lineno"> 208</tt>  <tt class="py-line"><tt class="py-number">169</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Panama (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L209"></a><tt class="py-lineno"> 209</tt>  <tt class="py-line"><tt class="py-number">170</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Saint Lucia (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L210"></a><tt class="py-lineno"> 210</tt>  <tt class="py-line"><tt class="py-number">171</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Trinidad and Tobago (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L211"></a><tt class="py-lineno"> 211</tt>  <tt class="py-line"><tt class="py-number">172</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'French Departments'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L212"></a><tt class="py-lineno"> 212</tt>  <tt class="py-line"><tt class="py-number">173</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L213"></a><tt class="py-lineno"> 213</tt>  <tt class="py-line"><tt class="py-number">174</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L214"></a><tt class="py-lineno"> 214</tt>  <tt class="py-line"><tt class="py-number">175</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L215"></a><tt class="py-lineno"> 215</tt>  <tt class="py-line"><tt class="py-number">176</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L216"></a><tt class="py-lineno"> 216</tt>  <tt class="py-line"><tt class="py-number">177</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L217"></a><tt class="py-lineno"> 217</tt>  <tt class="py-line"><tt class="py-number">178</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L218"></a><tt class="py-lineno"> 218</tt>  <tt class="py-line"><tt class="py-number">179</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L219"></a><tt class="py-lineno"> 219</tt>  <tt class="py-line"><tt class="py-number">180</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L220"></a><tt class="py-lineno"> 220</tt>  <tt class="py-line"><tt class="py-number">181</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L221"></a><tt class="py-lineno"> 221</tt>  <tt class="py-line"><tt class="py-number">182</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L222"></a><tt class="py-lineno"> 222</tt>  <tt class="py-line"><tt class="py-number">183</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L223"></a><tt class="py-lineno"> 223</tt>  <tt class="py-line"><tt class="py-number">184</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L224"></a><tt class="py-lineno"> 224</tt>  <tt class="py-line"><tt class="py-number">185</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L225"></a><tt class="py-lineno"> 225</tt>  <tt class="py-line"><tt class="py-number">186</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L226"></a><tt class="py-lineno"> 226</tt>  <tt class="py-line"><tt class="py-number">187</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L227"></a><tt class="py-lineno"> 227</tt>  <tt class="py-line"><tt class="py-number">188</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L228"></a><tt class="py-lineno"> 228</tt>  <tt class="py-line"><tt class="py-number">189</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L229"></a><tt class="py-lineno"> 229</tt>  <tt class="py-line"><tt class="py-number">190</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Cook Islands (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L230"></a><tt class="py-lineno"> 230</tt>  <tt class="py-line"><tt class="py-number">191</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'French Polynesia (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L231"></a><tt class="py-lineno"> 231</tt>  <tt class="py-line"><tt class="py-number">192</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Tonga (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L232"></a><tt class="py-lineno"> 232</tt>  <tt class="py-line"><tt class="py-number">193</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Vanuatu (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L233"></a><tt class="py-lineno"> 233</tt>  <tt class="py-line"><tt class="py-number">194</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Brunei (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L234"></a><tt class="py-lineno"> 234</tt>  <tt class="py-line"><tt class="py-number">195</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Indonesia (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L235"></a><tt class="py-lineno"> 235</tt>  <tt class="py-line"><tt class="py-number">196</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Kiribati (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L236"></a><tt class="py-lineno"> 236</tt>  <tt class="py-line"><tt class="py-number">197</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Federated States of Micronesia (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L237"></a><tt class="py-lineno"> 237</tt>  <tt class="py-line"><tt class="py-number">198</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'New Caledonia (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L238"></a><tt class="py-lineno"> 238</tt>  <tt class="py-line"><tt class="py-number">199</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Niue'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L239"></a><tt class="py-lineno"> 239</tt>  <tt class="py-line"><tt class="py-number">200</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Papua New Guinea (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L240"></a><tt class="py-lineno"> 240</tt>  <tt class="py-line"><tt class="py-number">201</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Philippines (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L241"></a><tt class="py-lineno"> 241</tt>  <tt class="py-line"><tt class="py-number">202</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Samoa (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L242"></a><tt class="py-lineno"> 242</tt>  <tt class="py-line"><tt class="py-number">203</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Solomon Islands (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L243"></a><tt class="py-lineno"> 243</tt>  <tt class="py-line"><tt class="py-number">204</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L244"></a><tt class="py-lineno"> 244</tt>  <tt class="py-line"><tt class="py-number">205</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L245"></a><tt class="py-lineno"> 245</tt>  <tt class="py-line"><tt class="py-number">206</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L246"></a><tt class="py-lineno"> 246</tt>  <tt class="py-line"><tt class="py-number">207</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L247"></a><tt class="py-lineno"> 247</tt>  <tt class="py-line"><tt class="py-number">208</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L248"></a><tt class="py-lineno"> 248</tt>  <tt class="py-line"><tt class="py-number">209</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L249"></a><tt class="py-lineno"> 249</tt>  <tt class="py-line"><tt class="py-number">210</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Frascati'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L250"></a><tt class="py-lineno"> 250</tt>  <tt class="py-line"><tt class="py-number">211</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Lanion'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L251"></a><tt class="py-lineno"> 251</tt>  <tt class="py-line"><tt class="py-number">212</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Lisboa'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L252"></a><tt class="py-lineno"> 252</tt>  <tt class="py-line"><tt class="py-number">213</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reykjavik'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L253"></a><tt class="py-lineno"> 253</tt>  <tt class="py-line"><tt class="py-number">214</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Madrid'</tt><tt class="py-op">,</tt><tt class="py-string">'lemm'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L254"></a><tt class="py-lineno"> 254</tt>  <tt class="py-line"><tt class="py-number">215</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Zurich'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L255"></a><tt class="py-lineno"> 255</tt>  <tt class="py-line"><tt class="py-number">216</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Service ARGOS - ToulouseNone), FR'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L256"></a><tt class="py-lineno"> 256</tt>  <tt class="py-line"><tt class="py-number">217</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Bratislava'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L257"></a><tt class="py-lineno"> 257</tt>  <tt class="py-line"><tt class="py-number">218</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Budapest'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L258"></a><tt class="py-lineno"> 258</tt>  <tt class="py-line"><tt class="py-number">219</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Ljubljana'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L259"></a><tt class="py-lineno"> 259</tt>  <tt class="py-line"><tt class="py-number">220</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Warsaw'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L260"></a><tt class="py-lineno"> 260</tt>  <tt class="py-line"><tt class="py-number">221</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Zagreb'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L261"></a><tt class="py-lineno"> 261</tt>  <tt class="py-line"><tt class="py-number">222</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Albania (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L262"></a><tt class="py-lineno"> 262</tt>  <tt class="py-line"><tt class="py-number">223</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Armenia (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L263"></a><tt class="py-lineno"> 263</tt>  <tt class="py-line"><tt class="py-number">224</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Austria (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L264"></a><tt class="py-lineno"> 264</tt>  <tt class="py-line"><tt class="py-number">225</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Azerbaijan (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L265"></a><tt class="py-lineno"> 265</tt>  <tt class="py-line"><tt class="py-number">226</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Belarus (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L266"></a><tt class="py-lineno"> 266</tt>  <tt class="py-line"><tt class="py-number">227</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Belgium (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L267"></a><tt class="py-lineno"> 267</tt>  <tt class="py-line"><tt class="py-number">228</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Bosnia and Herzegovina (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L268"></a><tt class="py-lineno"> 268</tt>  <tt class="py-line"><tt class="py-number">229</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Bulgaria (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L269"></a><tt class="py-lineno"> 269</tt>  <tt class="py-line"><tt class="py-number">230</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Cyprus (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L270"></a><tt class="py-lineno"> 270</tt>  <tt class="py-line"><tt class="py-number">231</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Estonia (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L271"></a><tt class="py-lineno"> 271</tt>  <tt class="py-line"><tt class="py-number">232</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Georgia (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L272"></a><tt class="py-lineno"> 272</tt>  <tt class="py-line"><tt class="py-number">233</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Dublin'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L273"></a><tt class="py-lineno"> 273</tt>  <tt class="py-line"><tt class="py-number">234</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Israel (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L274"></a><tt class="py-lineno"> 274</tt>  <tt class="py-line"><tt class="py-number">235</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Jordan (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L275"></a><tt class="py-lineno"> 275</tt>  <tt class="py-line"><tt class="py-number">236</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Latvia (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L276"></a><tt class="py-lineno"> 276</tt>  <tt class="py-line"><tt class="py-number">237</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Lebanon (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L277"></a><tt class="py-lineno"> 277</tt>  <tt class="py-line"><tt class="py-number">238</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Lithuania (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L278"></a><tt class="py-lineno"> 278</tt>  <tt class="py-line"><tt class="py-number">239</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Luxembourg'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L279"></a><tt class="py-lineno"> 279</tt>  <tt class="py-line"><tt class="py-number">240</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Malta (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L280"></a><tt class="py-lineno"> 280</tt>  <tt class="py-line"><tt class="py-number">241</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Monaco'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L281"></a><tt class="py-lineno"> 281</tt>  <tt class="py-line"><tt class="py-number">242</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Romania (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L282"></a><tt class="py-lineno"> 282</tt>  <tt class="py-line"><tt class="py-number">243</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Syrian Arab Republic (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L283"></a><tt class="py-lineno"> 283</tt>  <tt class="py-line"><tt class="py-number">244</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'The former Yugoslav Republic of Macedonia (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L284"></a><tt class="py-lineno"> 284</tt>  <tt class="py-line"><tt class="py-number">245</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Ukraine (NMC)'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L285"></a><tt class="py-lineno"> 285</tt>  <tt class="py-line"><tt class="py-number">246</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Republic of Moldova'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L286"></a><tt class="py-lineno"> 286</tt>  <tt class="py-line"><tt class="py-number">247</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L287"></a><tt class="py-lineno"> 287</tt>  <tt class="py-line"><tt class="py-number">248</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L288"></a><tt class="py-lineno"> 288</tt>  <tt class="py-line"><tt class="py-number">249</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L289"></a><tt class="py-lineno"> 289</tt>  <tt class="py-line"><tt class="py-number">250</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L290"></a><tt class="py-lineno"> 290</tt>  <tt class="py-line"><tt class="py-number">251</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L291"></a><tt class="py-lineno"> 291</tt>  <tt class="py-line"><tt class="py-number">252</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L292"></a><tt class="py-lineno"> 292</tt>  <tt class="py-line"><tt class="py-number">253</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L293"></a><tt class="py-lineno"> 293</tt>  <tt class="py-line"><tt class="py-number">254</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'EUMETSAT Operations Center'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
+<a name="L294"></a><tt class="py-lineno"> 294</tt>  <tt class="py-line"><tt class="py-number">255</tt><tt class="py-op">:</tt><tt class="py-op">(</tt><tt class="py-string">'Missing Value'</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">}</tt> </tt>
+<a name="L295"></a><tt class="py-lineno"> 295</tt>  <tt class="py-line"> </tt>
+<a name="_dec2bin"></a><div id="_dec2bin-def"><a name="L296"></a><tt class="py-lineno"> 296</tt> <a class="py-toggle" href="#" id="_dec2bin-toggle" onclick="return toggle('_dec2bin');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2-module.html#_dec2bin">_dec2bin</a><tt class="py-op">(</tt><tt class="py-param">val</tt><tt class="py-op">,</tt> <tt class="py-param">maxbits</tt> <tt class="py-op">=</tt> <tt class="py-number">8</tt><tt class="p [...]
+</div><div id="_dec2bin-collapsed" style="display:none;" pad="++++" indent="++++"></div><div id="_dec2bin-expanded"><a name="L297"></a><tt class="py-lineno"> 297</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
+<a name="L298"></a><tt class="py-lineno"> 298</tt>  <tt class="py-line"><tt class="py-docstring">    A decimal to binary converter. Returns bits in a list.</tt> </tt>
+<a name="L299"></a><tt class="py-lineno"> 299</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
+<a name="L300"></a><tt class="py-lineno"> 300</tt>  <tt class="py-line">    <tt class="py-name">retval</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L301"></a><tt class="py-lineno"> 301</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">i</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">maxbits</tt> <tt class="py-op">-</tt> <tt class="py-number">1</tt><tt class="py-op">,</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">,</tt> <tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt clas [...]
+<a name="L302"></a><tt class="py-lineno"> 302</tt>  <tt class="py-line">        <tt class="py-name">bit</tt> <tt class="py-op">=</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-name">val</tt> <tt class="py-op">/</tt> <tt class="py-op">(</tt><tt class="py-number">2</tt> <tt class="py-op">**</tt> <tt class="py-name">i</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L303"></a><tt class="py-lineno"> 303</tt>  <tt class="py-line">        <tt class="py-name">val</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">val</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-number">2</tt> <tt class="py-op">**</tt> <tt class="py-name">i</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L304"></a><tt class="py-lineno"> 304</tt>  <tt class="py-line">        <tt class="py-name">retval</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">bit</tt><tt class="py-op">)</tt> </tt>
+<a name="L305"></a><tt class="py-lineno"> 305</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">retval</tt> </tt>
+</div><a name="L306"></a><tt class="py-lineno"> 306</tt>  <tt class="py-line"> </tt>
+<a name="_putieeeint"></a><div id="_putieeeint-def"><a name="L307"></a><tt class="py-lineno"> 307</tt> <a class="py-toggle" href="#" id="_putieeeint-toggle" onclick="return toggle('_putieeeint');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2-module.html#_putieeeint">_putieeeint</a><tt class="py-op">(</tt><tt class="py-param">r</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+</div><div id="_putieeeint-collapsed" style="display:none;" pad="++++" indent="++++"></div><div id="_putieeeint-expanded"><a name="L308"></a><tt class="py-lineno"> 308</tt>  <tt class="py-line">    <tt class="py-docstring">"""convert a float to a IEEE format 32 bit integer"""</tt> </tt>
+<a name="L309"></a><tt class="py-lineno"> 309</tt>  <tt class="py-line">    <tt class="py-name">ra</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">array</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-name">r</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-string">'f'</tt><tt class="py-op">)</tt> </tt>
+<a name="L310"></a><tt class="py-lineno"> 310</tt>  <tt class="py-line">    <tt class="py-name">ia</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">empty</tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">,</tt><tt class="py-string">'i'</tt><tt class="py-op">)</tt> </tt>
+<a name="L311"></a><tt class="py-lineno"> 311</tt>  <tt class="py-line">    <tt class="py-name">g2clib</tt><tt class="py-op">.</tt><tt class="py-name">rtoi_ieee</tt><tt class="py-op">(</tt><tt class="py-name">ra</tt><tt class="py-op">,</tt><tt class="py-name">ia</tt><tt class="py-op">)</tt> </tt>
+<a name="L312"></a><tt class="py-lineno"> 312</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">ia</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
+</div><a name="L313"></a><tt class="py-lineno"> 313</tt>  <tt class="py-line"> </tt>
+<a name="_getieeeint"></a><div id="_getieeeint-def"><a name="L314"></a><tt class="py-lineno"> 314</tt> <a class="py-toggle" href="#" id="_getieeeint-toggle" onclick="return toggle('_getieeeint');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2-module.html#_getieeeint">_getieeeint</a><tt class="py-op">(</tt><tt class="py-param">i</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+</div><div id="_getieeeint-collapsed" style="display:none;" pad="++++" indent="++++"></div><div id="_getieeeint-expanded"><a name="L315"></a><tt class="py-lineno"> 315</tt>  <tt class="py-line">    <tt class="py-docstring">"""convert an IEEE format 32 bit integer to a float"""</tt> </tt>
+<a name="L316"></a><tt class="py-lineno"> 316</tt>  <tt class="py-line">    <tt class="py-name">ia</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">array</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-name">i</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-string">'i'</tt><tt class="py-op">)</tt> </tt>
+<a name="L317"></a><tt class="py-lineno"> 317</tt>  <tt class="py-line">    <tt class="py-name">ra</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">empty</tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">,</tt><tt class="py-string">'f'</tt><tt class="py-op">)</tt> </tt>
+<a name="L318"></a><tt class="py-lineno"> 318</tt>  <tt class="py-line">    <tt class="py-name">g2clib</tt><tt class="py-op">.</tt><tt class="py-name">itor_ieee</tt><tt class="py-op">(</tt><tt class="py-name">ia</tt><tt class="py-op">,</tt><tt class="py-name">ra</tt><tt class="py-op">)</tt> </tt>
+<a name="L319"></a><tt class="py-lineno"> 319</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">ra</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
+</div><a name="L320"></a><tt class="py-lineno"> 320</tt>  <tt class="py-line"> </tt>
+<a name="_isString"></a><div id="_isString-def"><a name="L321"></a><tt class="py-lineno"> 321</tt> <a class="py-toggle" href="#" id="_isString-toggle" onclick="return toggle('_isString');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2-module.html#_isString">_isString</a><tt class="py-op">(</tt><tt class="py-param">string</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+</div><div id="_isString-collapsed" style="display:none;" pad="++++" indent="++++"></div><div id="_isString-expanded"><a name="L322"></a><tt class="py-lineno"> 322</tt>  <tt class="py-line">    <tt class="py-docstring">"""Test if string is a string like object if not return 0 """</tt> </tt>
+<a name="L323"></a><tt class="py-lineno"> 323</tt>  <tt class="py-line">    <tt class="py-keyword">try</tt><tt class="py-op">:</tt> <tt class="py-name">string</tt> <tt class="py-op">+</tt> <tt class="py-string">''</tt> </tt>
+<a name="L324"></a><tt class="py-lineno"> 324</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-number">0</tt> </tt>
+<a name="L325"></a><tt class="py-lineno"> 325</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-number">1</tt> </tt>
+</div><a name="L326"></a><tt class="py-lineno"> 326</tt>  <tt class="py-line"> </tt>
+<a name="Grib2Message"></a><div id="Grib2Message-def"><a name="L327"></a><tt class="py-lineno"> 327</tt> <a class="py-toggle" href="#" id="Grib2Message-toggle" onclick="return toggle('Grib2Message');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="ncepgrib2.Grib2Message-class.html">Grib2Message</a><tt class="py-op">:</tt> </tt>
+</div><div id="Grib2Message-collapsed" style="display:none;" pad="++++" indent="++++"></div><div id="Grib2Message-expanded"><a name="L328"></a><tt class="py-lineno"> 328</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
+<a name="L329"></a><tt class="py-lineno"> 329</tt>  <tt class="py-line"><tt class="py-docstring"> Class for accessing data in a GRIB Edition 2 message.</tt> </tt>
+<a name="L330"></a><tt class="py-lineno"> 330</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L331"></a><tt class="py-lineno"> 331</tt>  <tt class="py-line"><tt class="py-docstring"> The L{Grib2Decode} function returns a list of these class instances,</tt> </tt>
+<a name="L332"></a><tt class="py-lineno"> 332</tt>  <tt class="py-line"><tt class="py-docstring"> one for each grib message in the file.</tt> </tt>
+<a name="L333"></a><tt class="py-lineno"> 333</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L334"></a><tt class="py-lineno"> 334</tt>  <tt class="py-line"><tt class="py-docstring"> When a class instance is created, metadata in the GRIB2 file</tt> </tt>
+<a name="L335"></a><tt class="py-lineno"> 335</tt>  <tt class="py-line"><tt class="py-docstring"> is decoded and used to set various instance variables.</tt> </tt>
+<a name="L336"></a><tt class="py-lineno"> 336</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L337"></a><tt class="py-lineno"> 337</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar bitmap_indicator_flag: flag to indicate whether a bit-map is used (0 for yes, 255 for no).</tt> </tt>
+<a name="L338"></a><tt class="py-lineno"> 338</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar data_representation_template: data representation template from section 5.</tt> </tt>
+<a name="L339"></a><tt class="py-lineno"> 339</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar data_representation_template_number: data representation template number</tt> </tt>
+<a name="L340"></a><tt class="py-lineno"> 340</tt>  <tt class="py-line"><tt class="py-docstring"> from section 5</tt> </tt>
+<a name="L341"></a><tt class="py-lineno"> 341</tt>  <tt class="py-line"><tt class="py-docstring"> (U{Table 5.0</tt> </tt>
+<a name="L342"></a><tt class="py-lineno"> 342</tt>  <tt class="py-line"><tt class="py-docstring"> <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table5-0.shtml>})</tt> </tt>
+<a name="L343"></a><tt class="py-lineno"> 343</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar has_local_use_section:  True if grib message contains a local use</tt> </tt>
+<a name="L344"></a><tt class="py-lineno"> 344</tt>  <tt class="py-line"><tt class="py-docstring"> section. If True the actual local use section is contained in the</tt> </tt>
+<a name="L345"></a><tt class="py-lineno"> 345</tt>  <tt class="py-line"><tt class="py-docstring"> C{_local_use_section} instance variable, as a raw byte string.</tt> </tt>
+<a name="L346"></a><tt class="py-lineno"> 346</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar discipline_code: product discipline code for grib message</tt> </tt>
+<a name="L347"></a><tt class="py-lineno"> 347</tt>  <tt class="py-line"><tt class="py-docstring"> (U{Table 0.0</tt> </tt>
+<a name="L348"></a><tt class="py-lineno"> 348</tt>  <tt class="py-line"><tt class="py-docstring"> <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table0-0.shtml>}).</tt> </tt>
+<a name="L349"></a><tt class="py-lineno"> 349</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar earthRmajor: major (equatorial) earth radius.</tt> </tt>
+<a name="L350"></a><tt class="py-lineno"> 350</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar earthRminor: minor (polar) earth radius.</tt> </tt>
+<a name="L351"></a><tt class="py-lineno"> 351</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar grid_definition_info: grid definition section information from section 3.</tt> </tt>
+<a name="L352"></a><tt class="py-lineno"> 352</tt>  <tt class="py-line"><tt class="py-docstring">  See L{Grib2Encode.addgrid} for details.</tt> </tt>
+<a name="L353"></a><tt class="py-lineno"> 353</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar grid_definition_template: grid definition template from section 3.</tt> </tt>
+<a name="L354"></a><tt class="py-lineno"> 354</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar grid_definition_template_number: grid definition template number from section 3</tt> </tt>
+<a name="L355"></a><tt class="py-lineno"> 355</tt>  <tt class="py-line"><tt class="py-docstring"> (U{Table 3.1</tt> </tt>
+<a name="L356"></a><tt class="py-lineno"> 356</tt>  <tt class="py-line"><tt class="py-docstring"> <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-1.shtml>}).</tt> </tt>
+<a name="L357"></a><tt class="py-lineno"> 357</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar gridlength_in_x_direction: x (or longitudinal) direction grid length.</tt> </tt>
+<a name="L358"></a><tt class="py-lineno"> 358</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar gridlength_in_y_direction: y (or latitudinal) direction grid length.</tt> </tt>
+<a name="L359"></a><tt class="py-lineno"> 359</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar identification_section: data from identification section (section 1).</tt> </tt>
+<a name="L360"></a><tt class="py-lineno"> 360</tt>  <tt class="py-line"><tt class="py-docstring">  See L{Grib2Encode.__init__} for details.</tt> </tt>
+<a name="L361"></a><tt class="py-lineno"> 361</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar latitude_first_gridpoint: latitude of first grid point on grid.</tt> </tt>
+<a name="L362"></a><tt class="py-lineno"> 362</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar latitude_last_gridpoint: latitude of last grid point on grid.</tt> </tt>
+<a name="L363"></a><tt class="py-lineno"> 363</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar longitude_first_gridpoint: longitude of first grid point on grid.</tt> </tt>
+<a name="L364"></a><tt class="py-lineno"> 364</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar longitude_last_gridpoint: longitude of last grid point on grid.</tt> </tt>
+<a name="L365"></a><tt class="py-lineno"> 365</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar originating_center: name of national/international originating center.</tt> </tt>
+<a name="L366"></a><tt class="py-lineno"> 366</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar center_wmo_code: 4 character wmo code for originating center.</tt> </tt>
+<a name="L367"></a><tt class="py-lineno"> 367</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar scanmodeflags: scanning mode flags from Table 3.4</tt> </tt>
+<a name="L368"></a><tt class="py-lineno"> 368</tt>  <tt class="py-line"><tt class="py-docstring"> (U{Table 3.4</tt> </tt>
+<a name="L369"></a><tt class="py-lineno"> 369</tt>  <tt class="py-line"><tt class="py-docstring"> <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-4.shtml>}).</tt> </tt>
+<a name="L370"></a><tt class="py-lineno"> 370</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L371"></a><tt class="py-lineno"> 371</tt>  <tt class="py-line"><tt class="py-docstring">  - bit 1:</tt> </tt>
+<a name="L372"></a><tt class="py-lineno"> 372</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L373"></a><tt class="py-lineno"> 373</tt>  <tt class="py-line"><tt class="py-docstring">    0 - Points in the first row or column scan in the +i (+x) direction</tt> </tt>
+<a name="L374"></a><tt class="py-lineno"> 374</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L375"></a><tt class="py-lineno"> 375</tt>  <tt class="py-line"><tt class="py-docstring">    1 - Points in the first row or column scan in the -i (-x) direction</tt> </tt>
+<a name="L376"></a><tt class="py-lineno"> 376</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L377"></a><tt class="py-lineno"> 377</tt>  <tt class="py-line"><tt class="py-docstring">  - bit 2:</tt> </tt>
+<a name="L378"></a><tt class="py-lineno"> 378</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L379"></a><tt class="py-lineno"> 379</tt>  <tt class="py-line"><tt class="py-docstring">    0 - Points in the first row or column scan in the -j (-y) direction</tt> </tt>
+<a name="L380"></a><tt class="py-lineno"> 380</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L381"></a><tt class="py-lineno"> 381</tt>  <tt class="py-line"><tt class="py-docstring">    1 - Points in the first row or column scan in the +j (+y) direction</tt> </tt>
+<a name="L382"></a><tt class="py-lineno"> 382</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L383"></a><tt class="py-lineno"> 383</tt>  <tt class="py-line"><tt class="py-docstring">  - bit 3:</tt> </tt>
+<a name="L384"></a><tt class="py-lineno"> 384</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L385"></a><tt class="py-lineno"> 385</tt>  <tt class="py-line"><tt class="py-docstring">    0 - Adjacent points in the i (x) direction are consecutive (row-major order).</tt> </tt>
+<a name="L386"></a><tt class="py-lineno"> 386</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L387"></a><tt class="py-lineno"> 387</tt>  <tt class="py-line"><tt class="py-docstring">    1 - Adjacent points in the j (y) direction are consecutive (column-major order).</tt> </tt>
+<a name="L388"></a><tt class="py-lineno"> 388</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L389"></a><tt class="py-lineno"> 389</tt>  <tt class="py-line"><tt class="py-docstring">  - bit 4:</tt> </tt>
+<a name="L390"></a><tt class="py-lineno"> 390</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L391"></a><tt class="py-lineno"> 391</tt>  <tt class="py-line"><tt class="py-docstring">    0 - All rows scan in the same direction</tt> </tt>
+<a name="L392"></a><tt class="py-lineno"> 392</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L393"></a><tt class="py-lineno"> 393</tt>  <tt class="py-line"><tt class="py-docstring">    1 - Adjacent rows scan in the opposite direction</tt> </tt>
+<a name="L394"></a><tt class="py-lineno"> 394</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L395"></a><tt class="py-lineno"> 395</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar number_of_data_points_to_unpack: total number of data points in grib message.</tt> </tt>
+<a name="L396"></a><tt class="py-lineno"> 396</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar points_in_x_direction: number of points in the x (longitudinal) direction.</tt> </tt>
+<a name="L397"></a><tt class="py-lineno"> 397</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar points_in_y_direction: number of points in the y (latitudinal) direction.</tt> </tt>
+<a name="L398"></a><tt class="py-lineno"> 398</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar product_definition_template: product definition template from section 4.</tt> </tt>
+<a name="L399"></a><tt class="py-lineno"> 399</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar product_definition_template_number: product definition template number from section 4</tt> </tt>
+<a name="L400"></a><tt class="py-lineno"> 400</tt>  <tt class="py-line"><tt class="py-docstring"> (U{Table 4.0</tt> </tt>
+<a name="L401"></a><tt class="py-lineno"> 401</tt>  <tt class="py-line"><tt class="py-docstring"> <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table4-0.shtml>}).</tt> </tt>
+<a name="L402"></a><tt class="py-lineno"> 402</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar shape_of_earth: string describing the shape of the earth (e.g. 'Oblate Spheroid', 'Spheroid').</tt> </tt>
+<a name="L403"></a><tt class="py-lineno"> 403</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar spectral_truncation_parameters:  pentagonal truncation parameters that describe the</tt> </tt>
+<a name="L404"></a><tt class="py-lineno"> 404</tt>  <tt class="py-line"><tt class="py-docstring"> spherical harmonic truncation (only relevant for grid_definition_template_numbers 50-52).</tt> </tt>
+<a name="L405"></a><tt class="py-lineno"> 405</tt>  <tt class="py-line"><tt class="py-docstring"> For triangular truncation, all three of these numbers are the same.</tt> </tt>
+<a name="L406"></a><tt class="py-lineno"> 406</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar latitude_of_southern_pole: the geographic latitude in degrees of the southern</tt> </tt>
+<a name="L407"></a><tt class="py-lineno"> 407</tt>  <tt class="py-line"><tt class="py-docstring"> pole of the coordinate system (for rotated lat/lon or gaussian grids).</tt> </tt>
+<a name="L408"></a><tt class="py-lineno"> 408</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar longitude_of_southern_pole: the geographic longitude in degrees of the southern</tt> </tt>
+<a name="L409"></a><tt class="py-lineno"> 409</tt>  <tt class="py-line"><tt class="py-docstring"> pole of the coordinate system (for rotated lat/lon or gaussian grids).</tt> </tt>
+<a name="L410"></a><tt class="py-lineno"> 410</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar angle_of_pole_rotation: The angle of rotation in degrees about the new</tt> </tt>
+<a name="L411"></a><tt class="py-lineno"> 411</tt>  <tt class="py-line"><tt class="py-docstring"> polar axis (measured clockwise when looking from the southern to the northern pole)</tt> </tt>
+<a name="L412"></a><tt class="py-lineno"> 412</tt>  <tt class="py-line"><tt class="py-docstring"> of the coordinate system. For rotated lat/lon or gaussian grids.</tt> </tt>
+<a name="L413"></a><tt class="py-lineno"> 413</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar missing_value: primary missing value (for data_representation_template_numbers</tt> </tt>
+<a name="L414"></a><tt class="py-lineno"> 414</tt>  <tt class="py-line"><tt class="py-docstring"> 2 and 3).</tt> </tt>
+<a name="L415"></a><tt class="py-lineno"> 415</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar missing_value2: secondary missing value (for data_representation_template_numbers</tt> </tt>
+<a name="L416"></a><tt class="py-lineno"> 416</tt>  <tt class="py-line"><tt class="py-docstring"> 2 and 3).</tt> </tt>
+<a name="L417"></a><tt class="py-lineno"> 417</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar proj4_: instance variables with this prefix are used to set the map projection</tt> </tt>
+<a name="L418"></a><tt class="py-lineno"> 418</tt>  <tt class="py-line"><tt class="py-docstring"> parameters for U{PROJ.4<http://proj.maptools.org>}.</tt> </tt>
+<a name="L419"></a><tt class="py-lineno"> 419</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
+<a name="Grib2Message.__init__"></a><div id="Grib2Message.__init__-def"><a name="L420"></a><tt class="py-lineno"> 420</tt> <a class="py-toggle" href="#" id="Grib2Message.__init__-toggle" onclick="return toggle('Grib2Message.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2.Grib2Message-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-op">**</tt><tt cl [...]
+</div><div id="Grib2Message.__init__-collapsed" style="display:none;" pad="++++" indent="++++++++"></div><div id="Grib2Message.__init__-expanded"><a name="L421"></a><tt class="py-lineno"> 421</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
+<a name="L422"></a><tt class="py-lineno"> 422</tt>  <tt class="py-line"><tt class="py-docstring"> create a Grib2Decode class instance given a GRIB Edition 2 filename.</tt> </tt>
+<a name="L423"></a><tt class="py-lineno"> 423</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L424"></a><tt class="py-lineno"> 424</tt>  <tt class="py-line"><tt class="py-docstring"> (used by L{Grib2Decode} function - not directly called by user)</tt> </tt>
+<a name="L425"></a><tt class="py-lineno"> 425</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
+<a name="L426"></a><tt class="py-lineno"> 426</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">k</tt><tt class="py-op">,</tt><tt class="py-name">v</tt> <tt class="py-keyword">in</tt> <tt class="py-name">kwargs</tt><tt class="py-op">.</tt><tt class="py-name">items</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L427"></a><tt class="py-lineno"> 427</tt>  <tt class="py-line">            <tt class="py-name">setattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt><tt class="py-name">k</tt><tt class="py-op">,</tt><tt class="py-name">v</tt><tt class="py-op">)</tt> </tt>
+<a name="L428"></a><tt class="py-lineno"> 428</tt>  <tt class="py-line">        <tt class="py-comment"># grid information</tt> </tt>
+<a name="L429"></a><tt class="py-lineno"> 429</tt>  <tt class="py-line">        <tt class="py-name">gdsinfo</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">grid_definition_info</tt> </tt>
+<a name="L430"></a><tt class="py-lineno"> 430</tt>  <tt class="py-line">        <tt class="py-name">gdtnum</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">grid_definition_template_number</tt> </tt>
+<a name="L431"></a><tt class="py-lineno"> 431</tt>  <tt class="py-line">        <tt class="py-name">gdtmpl</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">grid_definition_template</tt> </tt>
+<a name="L432"></a><tt class="py-lineno"> 432</tt>  <tt class="py-line">        <tt class="py-name">reggrid</tt> <tt class="py-op">=</tt> <tt class="py-name">gdsinfo</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt> <tt class="py-comment"># gdsinfo[2]=0 means regular 2-d grid</tt> </tt>
+<a name="L433"></a><tt class="py-lineno"> 433</tt>  <tt class="py-line">        <tt class="py-comment"># shape of the earth.</tt> </tt>
+<a name="L434"></a><tt class="py-lineno"> 434</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">gdtnum</tt> <tt class="py-keyword">not</tt> <tt class="py-keyword">in</tt> <tt class="py-op">[</tt><tt class="py-number">50</tt><tt class="py-op">,</tt><tt class="py-number">51</tt><tt class="py-op">,</tt><tt class="py-number">52</tt><tt class="py-op">,</tt><tt class="py-number">1200</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L435"></a><tt class="py-lineno"> 435</tt>  <tt class="py-line">            <tt class="py-name">earthR</tt> <tt class="py-op">=</tt> <tt id="link-10" class="py-name"><a title="ncepgrib2._earthparams" class="py-name" href="#" onclick="return doclink('link-10', '_earthparams', 'link-0');">_earthparams</a></tt><tt class="py-op">[</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">]</tt> </tt>
+<a name="L436"></a><tt class="py-lineno"> 436</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">earthR</tt> <tt class="py-op">==</tt> <tt class="py-string">'Reserved'</tt><tt class="py-op">:</tt> <tt class="py-name">earthR</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
+<a name="L437"></a><tt class="py-lineno"> 437</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L438"></a><tt class="py-lineno"> 438</tt>  <tt class="py-line">            <tt class="py-name">earthR</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
+<a name="L439"></a><tt class="py-lineno"> 439</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">_isString</tt><tt class="py-op">(</tt><tt class="py-name">earthR</tt><tt class="py-op">)</tt> <tt class="py-keyword">and</tt> <tt class="py-op">(</tt><tt class="py-name">earthR</tt><tt class="py-op">.</tt><tt class="py-name">startswith</tt><tt class="py-op">(</tt><tt class="py-string">'Reserved'</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt  [...]
+<a name="L440"></a><tt class="py-lineno"> 440</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">shape_of_earth</tt> <tt class="py-op">=</tt> <tt class="py-name">earthR</tt> </tt>
+<a name="L441"></a><tt class="py-lineno"> 441</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRminor</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
+<a name="L442"></a><tt class="py-lineno"> 442</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRmajor</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
+<a name="L443"></a><tt class="py-lineno"> 443</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">_isString</tt><tt class="py-op">(</tt><tt class="py-name">earthR</tt><tt class="py-op">)</tt> <tt class="py-keyword">and</tt> <tt class="py-name">earthR</tt><tt class="py-op">.</tt><tt class="py-name">startswith</tt><tt class="py-op">(</tt><tt class="py-string">'Spherical'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L444"></a><tt class="py-lineno"> 444</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">shape_of_earth</tt> <tt class="py-op">=</tt> <tt class="py-name">earthR</tt> </tt>
+<a name="L445"></a><tt class="py-lineno"> 445</tt>  <tt class="py-line">            <tt class="py-name">scaledearthR</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> </tt>
+<a name="L446"></a><tt class="py-lineno"> 446</tt>  <tt class="py-line">            <tt class="py-name">earthRscale</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
+<a name="L447"></a><tt class="py-lineno"> 447</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRmajor</tt> <tt class="py-op">=</tt> <tt class="py-name">math</tt><tt class="py-op">.</tt><tt class="py-name">pow</tt><tt class="py-op">(</tt><tt class="py-number">10</tt><tt class="py-op">,</tt><tt class="py-op">-</tt><tt class="py-name">earthRscale</tt><tt class="py-op">)</tt><tt class="py-op">*</tt><tt class="py-name">scalede [...]
+<a name="L448"></a><tt class="py-lineno"> 448</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRminor</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRmajor</tt> </tt>
+<a name="L449"></a><tt class="py-lineno"> 449</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">_isString</tt><tt class="py-op">(</tt><tt class="py-name">earthR</tt><tt class="py-op">)</tt> <tt class="py-keyword">and</tt> <tt class="py-name">earthR</tt><tt class="py-op">.</tt><tt class="py-name">startswith</tt><tt class="py-op">(</tt><tt class="py-string">'OblateSpheroid'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L450"></a><tt class="py-lineno"> 450</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">shape_of_earth</tt> <tt class="py-op">=</tt> <tt class="py-name">earthR</tt> </tt>
+<a name="L451"></a><tt class="py-lineno"> 451</tt>  <tt class="py-line">            <tt class="py-name">scaledearthRmajor</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">4</tt><tt class="py-op">]</tt> </tt>
+<a name="L452"></a><tt class="py-lineno"> 452</tt>  <tt class="py-line">            <tt class="py-name">earthRmajorscale</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">3</tt><tt class="py-op">]</tt> </tt>
+<a name="L453"></a><tt class="py-lineno"> 453</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRmajor</tt> <tt class="py-op">=</tt> <tt class="py-name">math</tt><tt class="py-op">.</tt><tt class="py-name">pow</tt><tt class="py-op">(</tt><tt class="py-number">10</tt><tt class="py-op">,</tt><tt class="py-op">-</tt><tt class="py-name">earthRmajorscale</tt><tt class="py-op">)</tt><tt class="py-op">*</tt><tt class="py-name">sc [...]
+<a name="L454"></a><tt class="py-lineno"> 454</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRmajor</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRmajor</tt><tt class="py-op">*</tt><tt class="py-number">1000.</tt> <tt class="py-comment"># convert to m from km</tt> </tt>
+<a name="L455"></a><tt class="py-lineno"> 455</tt>  <tt class="py-line">            <tt class="py-name">scaledearthRminor</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">6</tt><tt class="py-op">]</tt> </tt>
+<a name="L456"></a><tt class="py-lineno"> 456</tt>  <tt class="py-line">            <tt class="py-name">earthRminorscale</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">5</tt><tt class="py-op">]</tt> </tt>
+<a name="L457"></a><tt class="py-lineno"> 457</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRminor</tt> <tt class="py-op">=</tt> <tt class="py-name">math</tt><tt class="py-op">.</tt><tt class="py-name">pow</tt><tt class="py-op">(</tt><tt class="py-number">10</tt><tt class="py-op">,</tt><tt class="py-op">-</tt><tt class="py-name">earthRminorscale</tt><tt class="py-op">)</tt><tt class="py-op">*</tt><tt class="py-name">sc [...]
+<a name="L458"></a><tt class="py-lineno"> 458</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRminor</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRminor</tt><tt class="py-op">*</tt><tt class="py-number">1000.</tt> <tt class="py-comment"># convert to m from km</tt> </tt>
+<a name="L459"></a><tt class="py-lineno"> 459</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">_isString</tt><tt class="py-op">(</tt><tt class="py-name">earthR</tt><tt class="py-op">)</tt> <tt class="py-keyword">and</tt> <tt class="py-name">earthR</tt><tt class="py-op">.</tt><tt class="py-name">startswith</tt><tt class="py-op">(</tt><tt class="py-string">'WGS84'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L460"></a><tt class="py-lineno"> 460</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">shape_of_earth</tt> <tt class="py-op">=</tt> <tt class="py-name">earthR</tt> </tt>
+<a name="L461"></a><tt class="py-lineno"> 461</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRmajor</tt> <tt class="py-op">=</tt> <tt class="py-number">6378137.0</tt> </tt>
+<a name="L462"></a><tt class="py-lineno"> 462</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRminor</tt> <tt class="py-op">=</tt> <tt class="py-number">6356752.3142</tt> </tt>
+<a name="L463"></a><tt class="py-lineno"> 463</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">earthR</tt><tt class="py-op">,</tt><tt class="py-name">tuple</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L464"></a><tt class="py-lineno"> 464</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">shape_of_earth</tt> <tt class="py-op">=</tt> <tt class="py-string">'OblateSpheroid'</tt> </tt>
+<a name="L465"></a><tt class="py-lineno"> 465</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRmajor</tt> <tt class="py-op">=</tt> <tt class="py-name">earthR</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
+<a name="L466"></a><tt class="py-lineno"> 466</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRminor</tt> <tt class="py-op">=</tt> <tt class="py-name">earthR</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
+<a name="L467"></a><tt class="py-lineno"> 467</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L468"></a><tt class="py-lineno"> 468</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">earthR</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
+<a name="L469"></a><tt class="py-lineno"> 469</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">shape_of_earth</tt> <tt class="py-op">=</tt> <tt class="py-string">'Spherical'</tt> </tt>
+<a name="L470"></a><tt class="py-lineno"> 470</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRmajor</tt> <tt class="py-op">=</tt> <tt class="py-name">earthR</tt> </tt>
+<a name="L471"></a><tt class="py-lineno"> 471</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRminor</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRmajor</tt> </tt>
+<a name="L472"></a><tt class="py-lineno"> 472</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">reggrid</tt> <tt class="py-keyword">and</tt> <tt class="py-name">gdtnum</tt> <tt class="py-keyword">not</tt> <tt class="py-keyword">in</tt> <tt class="py-op">[</tt><tt class="py-number">50</tt><tt class="py-op">,</tt><tt class="py-number">51</tt><tt class="py-op">,</tt><tt class="py-number">52</tt><tt class="py-op">,</tt><tt class="py-number">53</tt><tt class [...]
+<a name="L473"></a><tt class="py-lineno"> 473</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">points_in_x_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">7</tt><tt class="py-op">]</tt> </tt>
+<a name="L474"></a><tt class="py-lineno"> 474</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">points_in_y_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">8</tt><tt class="py-op">]</tt> </tt>
+<a name="L475"></a><tt class="py-lineno"> 475</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">reggrid</tt> <tt class="py-keyword">and</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">40</tt><tt class="py-op">:</tt> <tt class="py-comment"># 'reduced' gaussian grid.</tt> </tt>
+<a name="L476"></a><tt class="py-lineno"> 476</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">points_in_y_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">8</tt><tt class="py-op">]</tt> </tt>
+<a name="L477"></a><tt class="py-lineno"> 477</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">gdtnum</tt> <tt class="py-keyword">in</tt> <tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">,</tt><tt class="py-number">1</tt><tt class="py-op">,</tt><tt class="py-number">203</tt><tt class="py-op">,</tt><tt class="py-number">205</tt><tt class="py-op">,</tt><tt class="py-number">32768</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> < [...]
+<a name="L478"></a><tt class="py-lineno"> 478</tt>  <tt class="py-line">            <tt class="py-name">scalefact</tt> <tt class="py-op">=</tt> <tt class="py-name">float</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">9</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
+<a name="L479"></a><tt class="py-lineno"> 479</tt>  <tt class="py-line">            <tt class="py-name">divisor</tt> <tt class="py-op">=</tt> <tt class="py-name">float</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">10</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
+<a name="L480"></a><tt class="py-lineno"> 480</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">scalefact</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> <tt class="py-name">scalefact</tt> <tt class="py-op">=</tt> <tt class="py-number">1.</tt> </tt>
+<a name="L481"></a><tt class="py-lineno"> 481</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">divisor</tt> <tt class="py-op"><=</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> <tt class="py-name">divisor</tt> <tt class="py-op">=</tt> <tt class="py-number">1.e6</tt> </tt>
+<a name="L482"></a><tt class="py-lineno"> 482</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_first_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">11</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L483"></a><tt class="py-lineno"> 483</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_first_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">12</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L484"></a><tt class="py-lineno"> 484</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_last_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">14</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L485"></a><tt class="py-lineno"> 485</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_last_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">15</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L486"></a><tt class="py-lineno"> 486</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">16</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L487"></a><tt class="py-lineno"> 487</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_y_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">17</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L488"></a><tt class="py-lineno"> 488</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_first_gridpoint</tt> <tt class="py-op">></tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_last_gridpoint</tt><tt class="py-op">:</tt> </tt>
+<a name="L489"></a><tt class="py-lineno"> 489</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_y_direction</tt> <tt class="py-op">=</tt> <tt class="py-op">-</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_y_direction</tt> </tt>
+<a name="L490"></a><tt class="py-lineno"> 490</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_first_gridpoint</tt> <tt class="py-op">></tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_last_gridpoint</tt><tt class="py-op">:</tt> </tt>
+<a name="L491"></a><tt class="py-lineno"> 491</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> <tt class="py-op">=</tt> <tt class="py-op">-</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> </tt>
+<a name="L492"></a><tt class="py-lineno"> 492</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">18</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</t [...]
+<a name="L493"></a><tt class="py-lineno"> 493</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt> </tt>
+<a name="L494"></a><tt class="py-lineno"> 494</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_of_southern_pole</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">19</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L495"></a><tt class="py-lineno"> 495</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_of_southern_pole</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">20</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L496"></a><tt class="py-lineno"> 496</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">angle_of_pole_rotation</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">21</tt><tt class="py-op">]</tt> </tt>
+<a name="L497"></a><tt class="py-lineno"> 497</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">10</tt><tt class="py-op">:</tt> <tt class="py-comment"># mercator</tt> </tt>
+<a name="L498"></a><tt class="py-lineno"> 498</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_first_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">9</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L499"></a><tt class="py-lineno"> 499</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_first_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">10</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L500"></a><tt class="py-lineno"> 500</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_last_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">13</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L501"></a><tt class="py-lineno"> 501</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_last_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">14</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L502"></a><tt class="py-lineno"> 502</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">17</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e3</tt> </tt>
+<a name="L503"></a><tt class="py-lineno"> 503</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_y_direction</tt><tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">18</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e3</tt> </tt>
+<a name="L504"></a><tt class="py-lineno"> 504</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_ts</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">12</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L505"></a><tt class="py-lineno"> 505</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lon_0</tt> <tt class="py-op">=</tt> <tt class="py-number">0.5</tt><tt class="py-op">*</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_first_gridpoint</tt><tt class="py-op">+</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_last_ [...]
+<a name="L506"></a><tt class="py-lineno"> 506</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_proj</tt> <tt class="py-op">=</tt> <tt class="py-string">'merc'</tt> </tt>
+<a name="L507"></a><tt class="py-lineno"> 507</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">15</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</t [...]
+<a name="L508"></a><tt class="py-lineno"> 508</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">20</tt><tt class="py-op">:</tt> <tt class="py-comment"># stereographic</tt> </tt>
+<a name="L509"></a><tt class="py-lineno"> 509</tt>  <tt class="py-line">            <tt class="py-name">projflag</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">16</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
+<a name="L510"></a><tt class="py-lineno"> 510</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_first_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">9</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L511"></a><tt class="py-lineno"> 511</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_first_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">10</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L512"></a><tt class="py-lineno"> 512</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_ts</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">12</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L513"></a><tt class="py-lineno"> 513</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">projflag</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
+<a name="L514"></a><tt class="py-lineno"> 514</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_0</tt> <tt class="py-op">=</tt> <tt class="py-number">90</tt> </tt>
+<a name="L515"></a><tt class="py-lineno"> 515</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">projflag</tt> <tt class="py-op">==</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt> </tt>
+<a name="L516"></a><tt class="py-lineno"> 516</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_0</tt> <tt class="py-op">=</tt> <tt class="py-op">-</tt><tt class="py-number">90</tt> </tt>
+<a name="L517"></a><tt class="py-lineno"> 517</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L518"></a><tt class="py-lineno"> 518</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Invalid projection center flag = %s'</tt><tt class="py-op">%</tt><tt class="py-name">projflag</tt><tt class="py-op">)</tt> </tt>
+<a name="L519"></a><tt class="py-lineno"> 519</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lon_0</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">13</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L520"></a><tt class="py-lineno"> 520</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">14</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1000.</tt> </tt>
+<a name="L521"></a><tt class="py-lineno"> 521</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_y_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">15</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1000.</tt> </tt>
+<a name="L522"></a><tt class="py-lineno"> 522</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_proj</tt> <tt class="py-op">=</tt> <tt class="py-string">'stere'</tt> </tt>
+<a name="L523"></a><tt class="py-lineno"> 523</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">17</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</t [...]
+<a name="L524"></a><tt class="py-lineno"> 524</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">30</tt><tt class="py-op">:</tt> <tt class="py-comment"># lambert conformal</tt> </tt>
+<a name="L525"></a><tt class="py-lineno"> 525</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_first_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">9</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L526"></a><tt class="py-lineno"> 526</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_first_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">10</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L527"></a><tt class="py-lineno"> 527</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">14</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1000.</tt> </tt>
+<a name="L528"></a><tt class="py-lineno"> 528</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_y_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">15</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1000.</tt> </tt>
+<a name="L529"></a><tt class="py-lineno"> 529</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_1</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">18</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L530"></a><tt class="py-lineno"> 530</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_2</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">19</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L531"></a><tt class="py-lineno"> 531</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_0</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">12</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L532"></a><tt class="py-lineno"> 532</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lon_0</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">13</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L533"></a><tt class="py-lineno"> 533</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_proj</tt> <tt class="py-op">=</tt> <tt class="py-string">'lcc'</tt> </tt>
+<a name="L534"></a><tt class="py-lineno"> 534</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">17</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</t [...]
+<a name="L535"></a><tt class="py-lineno"> 535</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">31</tt><tt class="py-op">:</tt> <tt class="py-comment"># albers equal area.</tt> </tt>
+<a name="L536"></a><tt class="py-lineno"> 536</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_first_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">9</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L537"></a><tt class="py-lineno"> 537</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_first_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">10</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L538"></a><tt class="py-lineno"> 538</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">14</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1000.</tt> </tt>
+<a name="L539"></a><tt class="py-lineno"> 539</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_y_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">15</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1000.</tt> </tt>
+<a name="L540"></a><tt class="py-lineno"> 540</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_1</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">18</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L541"></a><tt class="py-lineno"> 541</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_2</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">19</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L542"></a><tt class="py-lineno"> 542</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_0</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">12</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L543"></a><tt class="py-lineno"> 543</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lon_0</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">13</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L544"></a><tt class="py-lineno"> 544</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_proj</tt> <tt class="py-op">=</tt> <tt class="py-string">'aea'</tt> </tt>
+<a name="L545"></a><tt class="py-lineno"> 545</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">17</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</t [...]
+<a name="L546"></a><tt class="py-lineno"> 546</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">40</tt> <tt class="py-keyword">or</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">41</tt><tt class="py-op">:</tt> <tt class="py-comment"># gaussian grid.</tt> </tt>
+<a name="L547"></a><tt class="py-lineno"> 547</tt>  <tt class="py-line">            <tt class="py-name">scalefact</tt> <tt class="py-op">=</tt> <tt class="py-name">float</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">9</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
+<a name="L548"></a><tt class="py-lineno"> 548</tt>  <tt class="py-line">            <tt class="py-name">divisor</tt> <tt class="py-op">=</tt> <tt class="py-name">float</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">10</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
+<a name="L549"></a><tt class="py-lineno"> 549</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">scalefact</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> <tt class="py-name">scalefact</tt> <tt class="py-op">=</tt> <tt class="py-number">1.</tt> </tt>
+<a name="L550"></a><tt class="py-lineno"> 550</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">divisor</tt> <tt class="py-op"><=</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> <tt class="py-name">divisor</tt> <tt class="py-op">=</tt> <tt class="py-number">1.e6</tt> </tt>
+<a name="L551"></a><tt class="py-lineno"> 551</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">points_between_pole_and_equator</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">17</tt><tt class="py-op">]</tt> </tt>
+<a name="L552"></a><tt class="py-lineno"> 552</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_first_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">11</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L553"></a><tt class="py-lineno"> 553</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_first_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">12</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L554"></a><tt class="py-lineno"> 554</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_last_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">14</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L555"></a><tt class="py-lineno"> 555</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_last_gridpoint</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">15</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L556"></a><tt class="py-lineno"> 556</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">reggrid</tt><tt class="py-op">:</tt> </tt>
+<a name="L557"></a><tt class="py-lineno"> 557</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">16</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L558"></a><tt class="py-lineno"> 558</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_first_gridpoint</tt> <tt class="py-op">></tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_last_gridpoint</tt><tt class="py-op">:</tt> </tt>
+<a name="L559"></a><tt class="py-lineno"> 559</tt>  <tt class="py-line">                    <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> <tt class="py-op">=</tt> <tt class="py-op">-</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> </tt>
+<a name="L560"></a><tt class="py-lineno"> 560</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">18</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</t [...]
+<a name="L561"></a><tt class="py-lineno"> 561</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">41</tt><tt class="py-op">:</tt> </tt>
+<a name="L562"></a><tt class="py-lineno"> 562</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_of_southern_pole</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">19</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L563"></a><tt class="py-lineno"> 563</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_of_southern_pole</tt> <tt class="py-op">=</tt> <tt class="py-name">scalefact</tt><tt class="py-op">*</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">20</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-name">divisor</tt> </tt>
+<a name="L564"></a><tt class="py-lineno"> 564</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">angle_of_pole_rotation</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">21</tt><tt class="py-op">]</tt> </tt>
+<a name="L565"></a><tt class="py-lineno"> 565</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">50</tt><tt class="py-op">:</tt> <tt class="py-comment"># spectral coefficients.</tt> </tt>
+<a name="L566"></a><tt class="py-lineno"> 566</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">spectral_truncation_parameters</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="p [...]
+<a name="L567"></a><tt class="py-lineno"> 567</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">,</tt><tt class="py-name">None</tt><tt class="py-op">]</tt> <tt class="py-comment"># doesn't apply</tt> </tt>
+<a name="L568"></a><tt class="py-lineno"> 568</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">90</tt><tt class="py-op">:</tt> <tt class="py-comment"># near-sided vertical perspective satellite projection</tt> </tt>
+<a name="L569"></a><tt class="py-lineno"> 569</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_0</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">9</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L570"></a><tt class="py-lineno"> 570</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lon_0</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">10</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L571"></a><tt class="py-lineno"> 571</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_h</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRmajor</tt> <tt class="py-op">*</tt> <tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">18</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6 [...]
+<a name="L572"></a><tt class="py-lineno"> 572</tt>  <tt class="py-line">            <tt class="py-name">dx</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">12</tt><tt class="py-op">]</tt> </tt>
+<a name="L573"></a><tt class="py-lineno"> 573</tt>  <tt class="py-line">            <tt class="py-name">dy</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">13</tt><tt class="py-op">]</tt> </tt>
+<a name="L574"></a><tt class="py-lineno"> 574</tt>  <tt class="py-line">            <tt class="py-comment"># if lat_0 is equator, it's a geostationary view.</tt> </tt>
+<a name="L575"></a><tt class="py-lineno"> 575</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_0</tt> <tt class="py-op">==</tt> <tt class="py-number">0.</tt><tt class="py-op">:</tt> <tt class="py-comment"># if lat_0 is equator, it's a</tt> </tt>
+<a name="L576"></a><tt class="py-lineno"> 576</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_proj</tt> <tt class="py-op">=</tt> <tt class="py-string">'geos'</tt> </tt>
+<a name="L577"></a><tt class="py-lineno"> 577</tt>  <tt class="py-line">            <tt class="py-comment"># general case of 'near-side perspective projection' (untested)</tt> </tt>
+<a name="L578"></a><tt class="py-lineno"> 578</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L579"></a><tt class="py-lineno"> 579</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_proj</tt> <tt class="py-op">=</tt> <tt class="py-string">'nsper'</tt> </tt>
+<a name="L580"></a><tt class="py-lineno"> 580</tt>  <tt class="py-line">                <tt class="py-name">msg</tt> <tt class="py-op">=</tt> <tt class="py-string">"""</tt> </tt>
+<a name="L581"></a><tt class="py-lineno"> 581</tt>  <tt class="py-line"><tt class="py-string">only geostationary perspective is supported.</tt> </tt>
+<a name="L582"></a><tt class="py-lineno"> 582</tt>  <tt class="py-line"><tt class="py-string">lat/lon values returned by grid method may be incorrect."""</tt> </tt>
+<a name="L583"></a><tt class="py-lineno"> 583</tt>  <tt class="py-line">                <tt class="py-name">warnings</tt><tt class="py-op">.</tt><tt class="py-name">warn</tt><tt class="py-op">(</tt><tt class="py-name">msg</tt><tt class="py-op">)</tt> </tt>
+<a name="L584"></a><tt class="py-lineno"> 584</tt>  <tt class="py-line">            <tt class="py-comment"># latitude of horizon on central meridian</tt> </tt>
+<a name="L585"></a><tt class="py-lineno"> 585</tt>  <tt class="py-line">            <tt class="py-name">lonmax</tt> <tt class="py-op">=</tt> <tt class="py-number">90.</tt><tt class="py-op">-</tt><tt class="py-op">(</tt><tt class="py-number">180.</tt><tt class="py-op">/</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">pi</tt><tt class="py-op">)</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">arcsin</tt><tt class= [...]
+<a name="L586"></a><tt class="py-lineno"> 586</tt>  <tt class="py-line">            <tt class="py-comment"># longitude of horizon on equator</tt> </tt>
+<a name="L587"></a><tt class="py-lineno"> 587</tt>  <tt class="py-line">            <tt class="py-name">latmax</tt> <tt class="py-op">=</tt> <tt class="py-number">90.</tt><tt class="py-op">-</tt><tt class="py-op">(</tt><tt class="py-number">180.</tt><tt class="py-op">/</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">pi</tt><tt class="py-op">)</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">arcsin</tt><tt class= [...]
+<a name="L588"></a><tt class="py-lineno"> 588</tt>  <tt class="py-line">            <tt class="py-comment"># truncate to nearest thousandth of a degree (to make sure</tt> </tt>
+<a name="L589"></a><tt class="py-lineno"> 589</tt>  <tt class="py-line">            <tt class="py-comment"># they aren't slightly over the horizon)</tt> </tt>
+<a name="L590"></a><tt class="py-lineno"> 590</tt>  <tt class="py-line">            <tt class="py-name">latmax</tt> <tt class="py-op">=</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-number">1000</tt><tt class="py-op">*</tt><tt class="py-name">latmax</tt><tt class="py-op">)</tt><tt class="py-op">/</tt><tt class="py-number">1000.</tt> </tt>
+<a name="L591"></a><tt class="py-lineno"> 591</tt>  <tt class="py-line">            <tt class="py-name">lonmax</tt> <tt class="py-op">=</tt> <tt class="py-name">int</tt><tt class="py-op">(</tt><tt class="py-number">1000</tt><tt class="py-op">*</tt><tt class="py-name">lonmax</tt><tt class="py-op">)</tt><tt class="py-op">/</tt><tt class="py-number">1000.</tt> </tt>
+<a name="L592"></a><tt class="py-lineno"> 592</tt>  <tt class="py-line">            <tt class="py-comment"># h is measured from surface of earth at equator.</tt> </tt>
+<a name="L593"></a><tt class="py-lineno"> 593</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_h</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_h</tt> <tt class="py-op">-</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRmajor</tt> </tt>
+<a name="L594"></a><tt class="py-lineno"> 594</tt>  <tt class="py-line">            <tt class="py-comment"># width and height of visible projection</tt> </tt>
+<a name="L595"></a><tt class="py-lineno"> 595</tt>  <tt class="py-line">            <tt class="py-name">P</tt> <tt class="py-op">=</tt> <tt class="py-name">pyproj</tt><tt class="py-op">.</tt><tt class="py-name">Proj</tt><tt class="py-op">(</tt><tt class="py-name">proj</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_proj</tt><tt class="py-op">,</tt>\ </tt>
+<a name="L596"></a><tt class="py-lineno"> 596</tt>  <tt class="py-line">                            <tt class="py-name">a</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRmajor</tt><tt class="py-op">,</tt><tt class="py-name">b</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRminor</tt><tt class="py-op">,</tt>\ </tt>
+<a name="L597"></a><tt class="py-lineno"> 597</tt>  <tt class="py-line">                            <tt class="py-name">lat_0</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">,</tt><tt class="py-name">lon_0</tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">,</tt><tt class="py-name">h</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_h</tt><tt class="py-op">)</tt> </tt>
+<a name="L598"></a><tt class="py-lineno"> 598</tt>  <tt class="py-line">            <tt class="py-name">x1</tt><tt class="py-op">,</tt><tt class="py-name">y1</tt> <tt class="py-op">=</tt> <tt class="py-name">P</tt><tt class="py-op">(</tt><tt class="py-number">0.</tt><tt class="py-op">,</tt><tt class="py-name">latmax</tt><tt class="py-op">)</tt><tt class="py-op">;</tt> <tt class="py-name">x2</tt><tt class="py-op">,</tt><tt class="py-name">y2</tt> <tt class="py-op">=</tt> <tt class="py-nam [...]
+<a name="L599"></a><tt class="py-lineno"> 599</tt>  <tt class="py-line">            <tt class="py-name">width</tt> <tt class="py-op">=</tt> <tt class="py-number">2</tt><tt class="py-op">*</tt><tt class="py-name">x2</tt><tt class="py-op">;</tt> <tt class="py-name">height</tt> <tt class="py-op">=</tt> <tt class="py-number">2</tt><tt class="py-op">*</tt><tt class="py-name">y1</tt> </tt>
+<a name="L600"></a><tt class="py-lineno"> 600</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">width</tt><tt class="py-op">/</tt><tt class="py-name">dx</tt> </tt>
+<a name="L601"></a><tt class="py-lineno"> 601</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_y_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">height</tt><tt class="py-op">/</tt><tt class="py-name">dy</tt> </tt>
+<a name="L602"></a><tt class="py-lineno"> 602</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">16</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</t [...]
+<a name="L603"></a><tt class="py-lineno"> 603</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">110</tt><tt class="py-op">:</tt> <tt class="py-comment"># azimuthal equidistant.</tt> </tt>
+<a name="L604"></a><tt class="py-lineno"> 604</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_0</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">9</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L605"></a><tt class="py-lineno"> 605</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lon_0</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">10</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1.e6</tt> </tt>
+<a name="L606"></a><tt class="py-lineno"> 606</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">12</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1000.</tt> </tt>
+<a name="L607"></a><tt class="py-lineno"> 607</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_y_direction</tt> <tt class="py-op">=</tt> <tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">13</tt><tt class="py-op">]</tt><tt class="py-op">/</tt><tt class="py-number">1000.</tt> </tt>
+<a name="L608"></a><tt class="py-lineno"> 608</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_proj</tt> <tt class="py-op">=</tt> <tt class="py-string">'aeqd'</tt> </tt>
+<a name="L609"></a><tt class="py-lineno"> 609</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">15</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</t [...]
+<a name="L610"></a><tt class="py-lineno"> 610</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">204</tt><tt class="py-op">:</tt> <tt class="py-comment"># curvilinear orthogonal</tt> </tt>
+<a name="L611"></a><tt class="py-lineno"> 611</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">18</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</t [...]
+<a name="L612"></a><tt class="py-lineno"> 612</tt>  <tt class="py-line">        <tt class="py-comment"># missing value.</tt> </tt>
+<a name="L613"></a><tt class="py-lineno"> 613</tt>  <tt class="py-line">        <tt class="py-name">drtnum</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">data_representation_template_number</tt> </tt>
+<a name="L614"></a><tt class="py-lineno"> 614</tt>  <tt class="py-line">        <tt class="py-name">drtmpl</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">data_representation_template</tt> </tt>
+<a name="L615"></a><tt class="py-lineno"> 615</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-op">(</tt><tt class="py-name">drtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">2</tt> <tt class="py-keyword">or</tt> <tt class="py-name">drtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">3</tt><tt class="py-op">)</tt> <tt class="py-keyword">and</tt> <tt class="py-name">drtmpl</tt><tt class="py-op">[</tt><tt class="py-number">6</tt><tt class="py [...]
+<a name="L616"></a><tt class="py-lineno"> 616</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">missing_value</tt> <tt class="py-op">=</tt> <tt class="py-name">_getieeeint</tt><tt class="py-op">(</tt><tt class="py-name">drtmpl</tt><tt class="py-op">[</tt><tt class="py-number">7</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
+<a name="L617"></a><tt class="py-lineno"> 617</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">drtmpl</tt><tt class="py-op">[</tt><tt class="py-number">6</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-number">2</tt><tt class="py-op">:</tt> </tt>
+<a name="L618"></a><tt class="py-lineno"> 618</tt>  <tt class="py-line">                <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">missing_value2</tt> <tt class="py-op">=</tt> <tt class="py-name">_getieeeint</tt><tt class="py-op">(</tt><tt class="py-name">drtmpl</tt><tt class="py-op">[</tt><tt class="py-number">8</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
+</div><a name="L619"></a><tt class="py-lineno"> 619</tt>  <tt class="py-line"> </tt>
+<a name="Grib2Message.__repr__"></a><div id="Grib2Message.__repr__-def"><a name="L620"></a><tt class="py-lineno"> 620</tt> <a class="py-toggle" href="#" id="Grib2Message.__repr__-toggle" onclick="return toggle('Grib2Message.__repr__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2.Grib2Message-class.html#__repr__">__repr__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+</div><div id="Grib2Message.__repr__-collapsed" style="display:none;" pad="++++" indent="++++++++"></div><div id="Grib2Message.__repr__-expanded"><a name="L621"></a><tt class="py-lineno"> 621</tt>  <tt class="py-line">        <tt class="py-name">strings</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L622"></a><tt class="py-lineno"> 622</tt>  <tt class="py-line">        <tt class="py-name">keys</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__dict__</tt><tt class="py-op">.</tt><tt class="py-name">keys</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
+<a name="L623"></a><tt class="py-lineno"> 623</tt>  <tt class="py-line">        <tt class="py-name">keys</tt><tt class="py-op">.</tt><tt class="py-name">sort</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
+<a name="L624"></a><tt class="py-lineno"> 624</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">k</tt> <tt class="py-keyword">in</tt> <tt class="py-name">keys</tt><tt class="py-op">:</tt> </tt>
+<a name="L625"></a><tt class="py-lineno"> 625</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">k</tt><tt class="py-op">.</tt><tt class="py-name">startswith</tt><tt class="py-op">(</tt><tt class="py-string">'_'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L626"></a><tt class="py-lineno"> 626</tt>  <tt class="py-line">                <tt class="py-name">strings</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-string">'%s = %s\n'</tt><tt class="py-op">%</tt><tt class="py-op">(</tt><tt class="py-name">k</tt><tt class="py-op">,</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__dict__</tt><tt class="py-op">[</tt><tt class="py-name">k</tt><tt class="py-op">]</ [...]
+<a name="L627"></a><tt class="py-lineno"> 627</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-string">''</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">strings</tt><tt class="py-op">)</tt> </tt>
+</div><a name="L628"></a><tt class="py-lineno"> 628</tt>  <tt class="py-line"> </tt>
+<a name="Grib2Message.data"></a><div id="Grib2Message.data-def"><a name="L629"></a><tt class="py-lineno"> 629</tt> <a class="py-toggle" href="#" id="Grib2Message.data-toggle" onclick="return toggle('Grib2Message.data');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2.Grib2Message-class.html#data">data</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">fill_value</tt><tt class="py-op">= [...]
+</div><div id="Grib2Message.data-collapsed" style="display:none;" pad="++++" indent="++++++++"></div><div id="Grib2Message.data-expanded"><a name="L630"></a><tt class="py-lineno"> 630</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
+<a name="L631"></a><tt class="py-lineno"> 631</tt>  <tt class="py-line"><tt class="py-docstring"> returns an unpacked data grid.  Can also be accomplished with L{values}</tt> </tt>
+<a name="L632"></a><tt class="py-lineno"> 632</tt>  <tt class="py-line"><tt class="py-docstring"> property.</tt> </tt>
+<a name="L633"></a><tt class="py-lineno"> 633</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L634"></a><tt class="py-lineno"> 634</tt>  <tt class="py-line"><tt class="py-docstring"> @keyword fill_value: missing or masked data is filled with this value</tt> </tt>
+<a name="L635"></a><tt class="py-lineno"> 635</tt>  <tt class="py-line"><tt class="py-docstring"> (default 9.9692099683868690e+36).</tt> </tt>
+<a name="L636"></a><tt class="py-lineno"> 636</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L637"></a><tt class="py-lineno"> 637</tt>  <tt class="py-line"><tt class="py-docstring"> @keyword masked_array: if True, return masked array if there is bitmap</tt> </tt>
+<a name="L638"></a><tt class="py-lineno"> 638</tt>  <tt class="py-line"><tt class="py-docstring"> for missing or masked data (default True).</tt> </tt>
+<a name="L639"></a><tt class="py-lineno"> 639</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L640"></a><tt class="py-lineno"> 640</tt>  <tt class="py-line"><tt class="py-docstring"> @keyword expand:  if True (default), ECMWF 'reduced' gaussian grids are</tt> </tt>
+<a name="L641"></a><tt class="py-lineno"> 641</tt>  <tt class="py-line"><tt class="py-docstring"> expanded to regular gaussian grids.</tt> </tt>
+<a name="L642"></a><tt class="py-lineno"> 642</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L643"></a><tt class="py-lineno"> 643</tt>  <tt class="py-line"><tt class="py-docstring"> @keyword order: if 1, linear interpolation is used for expanding reduced</tt> </tt>
+<a name="L644"></a><tt class="py-lineno"> 644</tt>  <tt class="py-line"><tt class="py-docstring"> gaussian grids.  if 0, nearest neighbor interpolation is used. Default</tt> </tt>
+<a name="L645"></a><tt class="py-lineno"> 645</tt>  <tt class="py-line"><tt class="py-docstring"> is 0 if grid has missing or bitmapped values, 1 otherwise.</tt> </tt>
+<a name="L646"></a><tt class="py-lineno"> 646</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L647"></a><tt class="py-lineno"> 647</tt>  <tt class="py-line"><tt class="py-docstring"> @return: C{B{data}}, a float32 numpy regular or masked array</tt> </tt>
+<a name="L648"></a><tt class="py-lineno"> 648</tt>  <tt class="py-line"><tt class="py-docstring"> with shape (nlats,lons) containing the requested grid.</tt> </tt>
+<a name="L649"></a><tt class="py-lineno"> 649</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
+<a name="L650"></a><tt class="py-lineno"> 650</tt>  <tt class="py-line">        <tt class="py-comment"># make sure scan mode is supported.</tt> </tt>
+<a name="L651"></a><tt class="py-lineno"> 651</tt>  <tt class="py-line">        <tt class="py-comment"># if there is no 'scanmodeflags', then grid is not supported.</tt> </tt>
+<a name="L652"></a><tt class="py-lineno"> 652</tt>  <tt class="py-line">        <tt class="py-keyword">from</tt> <tt class="py-name">redtoreg</tt> <tt class="py-keyword">import</tt> <tt class="py-name">_redtoreg</tt> </tt>
+<a name="L653"></a><tt class="py-lineno"> 653</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt><tt class="py-string">'scanmodeflags'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L654"></a><tt class="py-lineno"> 654</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'unsupported grid definition template number %s'</tt><tt class="py-op">%</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">grid_definition_template_number</tt><tt class="py-op">)</tt> </tt>
+<a name="L655"></a><tt class="py-lineno"> 655</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L656"></a><tt class="py-lineno"> 656</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L657"></a><tt class="py-lineno"> 657</tt>  <tt class="py-line">                <tt class="py-name">storageorder</tt><tt class="py-op">=</tt><tt class="py-string">'F'</tt> </tt>
+<a name="L658"></a><tt class="py-lineno"> 658</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L659"></a><tt class="py-lineno"> 659</tt>  <tt class="py-line">                <tt class="py-name">storageorder</tt><tt class="py-op">=</tt><tt class="py-string">'C'</tt> </tt>
+<a name="L660"></a><tt class="py-lineno"> 660</tt>  <tt class="py-line">        <tt class="py-name">bitmapflag</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">bitmap_indicator_flag</tt> </tt>
+<a name="L661"></a><tt class="py-lineno"> 661</tt>  <tt class="py-line">        <tt class="py-name">drtnum</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">data_representation_template_number</tt> </tt>
+<a name="L662"></a><tt class="py-lineno"> 662</tt>  <tt class="py-line">        <tt class="py-name">drtmpl</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">data_representation_template</tt> </tt>
+<a name="L663"></a><tt class="py-lineno"> 663</tt>  <tt class="py-line">        <tt class="py-comment"># default order=0 is missing values or bitmap exists.</tt> </tt>
+<a name="L664"></a><tt class="py-lineno"> 664</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">order</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
+<a name="L665"></a><tt class="py-lineno"> 665</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">drtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">3</tt> <tt class="py-keyword">or</tt> <tt class="py-name">drtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">2</tt><tt class="py-op">)</tt> <tt class="py-keyword">and</tt> <tt class="py-name">drtmpl</tt><tt class="py-op">[</tt><tt class="py [...]
+<a name="L666"></a><tt class="py-lineno"> 666</tt>  <tt class="py-line">                <tt class="py-name">order</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
+<a name="L667"></a><tt class="py-lineno"> 667</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L668"></a><tt class="py-lineno"> 668</tt>  <tt class="py-line">                <tt class="py-name">order</tt> <tt class="py-op">=</tt> <tt class="py-number">1</tt> </tt>
+<a name="L669"></a><tt class="py-lineno"> 669</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
+<a name="L670"></a><tt class="py-lineno"> 670</tt>  <tt class="py-line">            <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_grib_filename</tt><tt class="py-op">,</tt><tt class="py-string">'rb'</tt><tt class="py-op">)</tt> </tt>
+<a name="L671"></a><tt class="py-lineno"> 671</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-op">(</tt><tt class="py-name">TypeError</tt><tt class="py-op">,</tt><tt class="py-name">IOError</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L672"></a><tt class="py-lineno"> 672</tt>  <tt class="py-line">            <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">StringIO</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_grib_filename</tt><tt class="py-op">)</tt> </tt>
+<a name="L673"></a><tt class="py-lineno"> 673</tt>  <tt class="py-line">        <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">seek</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_grib_message_byteoffset</tt><tt class="py-op">)</tt> </tt>
+<a name="L674"></a><tt class="py-lineno"> 674</tt>  <tt class="py-line">        <tt class="py-name">gribmsg</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_grib_message_length</tt><tt class="py-op">)</tt> </tt>
+<a name="L675"></a><tt class="py-lineno"> 675</tt>  <tt class="py-line">        <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">close</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
+<a name="L676"></a><tt class="py-lineno"> 676</tt>  <tt class="py-line">        <tt class="py-name">gdtnum</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">grid_definition_template_number</tt> </tt>
+<a name="L677"></a><tt class="py-lineno"> 677</tt>  <tt class="py-line">        <tt class="py-name">gdtmpl</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">grid_definition_template</tt> </tt>
+<a name="L678"></a><tt class="py-lineno"> 678</tt>  <tt class="py-line">        <tt class="py-name">ndpts</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">number_of_data_points_to_unpack</tt> </tt>
+<a name="L679"></a><tt class="py-lineno"> 679</tt>  <tt class="py-line">        <tt class="py-name">gdsinfo</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">grid_definition_info</tt> </tt>
+<a name="L680"></a><tt class="py-lineno"> 680</tt>  <tt class="py-line">        <tt class="py-name">ngrdpts</tt> <tt class="py-op">=</tt> <tt class="py-name">gdsinfo</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
+<a name="L681"></a><tt class="py-lineno"> 681</tt>  <tt class="py-line">        <tt class="py-name">ipos</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_section7_byte_offset</tt> </tt>
+<a name="L682"></a><tt class="py-lineno"> 682</tt>  <tt class="py-line">        <tt class="py-name">fld1</tt><tt class="py-op">=</tt><tt class="py-name">g2clib</tt><tt class="py-op">.</tt><tt class="py-name">unpack7</tt><tt class="py-op">(</tt><tt class="py-name">gribmsg</tt><tt class="py-op">,</tt><tt class="py-name">gdtnum</tt><tt class="py-op">,</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">,</tt><tt class="py-name">drtnum</tt><tt class="py-op">,</tt><tt class="py-name">drtmpl< [...]
+<a name="L683"></a><tt class="py-lineno"> 683</tt>  <tt class="py-line">        <tt class="py-comment"># apply bitmap.</tt> </tt>
+<a name="L684"></a><tt class="py-lineno"> 684</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">bitmapflag</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
+<a name="L685"></a><tt class="py-lineno"> 685</tt>  <tt class="py-line">            <tt class="py-name">bitmap</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_bitmap</tt> </tt>
+<a name="L686"></a><tt class="py-lineno"> 686</tt>  <tt class="py-line">            <tt class="py-name">fld</tt> <tt class="py-op">=</tt> <tt class="py-name">fill_value</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">ones</tt><tt class="py-op">(</tt><tt class="py-name">ngrdpts</tt><tt class="py-op">,</tt><tt class="py-string">'f'</tt><tt class="py-op">)</tt> </tt>
+<a name="L687"></a><tt class="py-lineno"> 687</tt>  <tt class="py-line">            <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">put</tt><tt class="py-op">(</tt><tt class="py-name">fld</tt><tt class="py-op">,</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">nonzero</tt><tt class="py-op">(</tt><tt class="py-name">bitmap</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-name">fld1</tt><tt class="py-op">)</tt> </tt>
+<a name="L688"></a><tt class="py-lineno"> 688</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">masked_array</tt><tt class="py-op">:</tt> </tt>
+<a name="L689"></a><tt class="py-lineno"> 689</tt>  <tt class="py-line">                <tt class="py-name">fld</tt> <tt class="py-op">=</tt> <tt class="py-name">ma</tt><tt class="py-op">.</tt><tt class="py-name">masked_values</tt><tt class="py-op">(</tt><tt class="py-name">fld</tt><tt class="py-op">,</tt><tt class="py-name">fill_value</tt><tt class="py-op">)</tt> </tt>
+<a name="L690"></a><tt class="py-lineno"> 690</tt>  <tt class="py-line">        <tt class="py-comment"># missing values instead of bitmap</tt> </tt>
+<a name="L691"></a><tt class="py-lineno"> 691</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">masked_array</tt> <tt class="py-keyword">and</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt><tt class="py-string">'missing_value'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L692"></a><tt class="py-lineno"> 692</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-string">'missing_value2'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L693"></a><tt class="py-lineno"> 693</tt>  <tt class="py-line">                <tt class="py-name">mask</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">logical_or</tt><tt class="py-op">(</tt><tt class="py-name">fld1</tt> <tt class="py-op">==</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">missing_value</tt><tt class="py-op">,</tt> <tt class="py-name">fld1</tt> <tt class="py-op">==</tt> <tt class=" [...]
+<a name="L694"></a><tt class="py-lineno"> 694</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L695"></a><tt class="py-lineno"> 695</tt>  <tt class="py-line">                <tt class="py-name">mask</tt> <tt class="py-op">=</tt> <tt class="py-name">fld1</tt> <tt class="py-op">==</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">missing_value</tt> </tt>
+<a name="L696"></a><tt class="py-lineno"> 696</tt>  <tt class="py-line">            <tt class="py-name">fld</tt> <tt class="py-op">=</tt> <tt class="py-name">ma</tt><tt class="py-op">.</tt><tt class="py-name">array</tt><tt class="py-op">(</tt><tt class="py-name">fld1</tt><tt class="py-op">,</tt><tt class="py-name">mask</tt><tt class="py-op">=</tt><tt class="py-name">mask</tt><tt class="py-op">)</tt> </tt>
+<a name="L697"></a><tt class="py-lineno"> 697</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L698"></a><tt class="py-lineno"> 698</tt>  <tt class="py-line">            <tt class="py-name">fld</tt> <tt class="py-op">=</tt> <tt class="py-name">fld1</tt> </tt>
+<a name="L699"></a><tt class="py-lineno"> 699</tt>  <tt class="py-line">        <tt class="py-name">nx</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt><tt class="py-op">;</tt> <tt class="py-name">ny</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
+<a name="L700"></a><tt class="py-lineno"> 700</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt><tt class="py-string">'points_in_x_direction'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L701"></a><tt class="py-lineno"> 701</tt>  <tt class="py-line">            <tt class="py-name">nx</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">points_in_x_direction</tt> </tt>
+<a name="L702"></a><tt class="py-lineno"> 702</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt><tt class="py-string">'points_in_y_direction'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L703"></a><tt class="py-lineno"> 703</tt>  <tt class="py-line">            <tt class="py-name">ny</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">points_in_y_direction</tt> </tt>
+<a name="L704"></a><tt class="py-lineno"> 704</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">nx</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt> <tt class="py-keyword">and</tt> <tt class="py-name">ny</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> <tt class="py-comment"># rectangular grid.</tt> </tt>
+<a name="L705"></a><tt class="py-lineno"> 705</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">ma</tt><tt class="py-op">.</tt><tt class="py-name">isMA</tt><tt class="py-op">(</tt><tt class="py-name">fld</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L706"></a><tt class="py-lineno"> 706</tt>  <tt class="py-line">                <tt class="py-name">fld</tt> <tt class="py-op">=</tt> <tt class="py-name">ma</tt><tt class="py-op">.</tt><tt class="py-name">reshape</tt><tt class="py-op">(</tt><tt class="py-name">fld</tt><tt class="py-op">,</tt><tt class="py-op">(</tt><tt class="py-name">ny</tt><tt class="py-op">,</tt><tt class="py-name">nx</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L707"></a><tt class="py-lineno"> 707</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L708"></a><tt class="py-lineno"> 708</tt>  <tt class="py-line">                <tt class="py-name">fld</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">reshape</tt><tt class="py-op">(</tt><tt class="py-name">fld</tt><tt class="py-op">,</tt><tt class="py-op">(</tt><tt class="py-name">ny</tt><tt class="py-op">,</tt><tt class="py-name">nx</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L709"></a><tt class="py-lineno"> 709</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L710"></a><tt class="py-lineno"> 710</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">gdsinfo</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> <tt class="py-keyword">and</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">40</tt><tt class="py-op">:</tt> <tt class="py-comment"># ECMWF 'reduced' global gaussian grid.</tt> </tt>
+<a name="L711"></a><tt class="py-lineno"> 711</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">expand</tt><tt class="py-op">:</tt> </tt>
+<a name="L712"></a><tt class="py-lineno"> 712</tt>  <tt class="py-line">                    <tt class="py-name">nx</tt> <tt class="py-op">=</tt> <tt class="py-number">2</tt><tt class="py-op">*</tt><tt class="py-name">ny</tt> </tt>
+<a name="L713"></a><tt class="py-lineno"> 713</tt>  <tt class="py-line">                    <tt class="py-name">lonsperlat</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">grid_definition_list</tt> </tt>
+<a name="L714"></a><tt class="py-lineno"> 714</tt>  <tt class="py-line">                    <tt class="py-keyword">if</tt> <tt class="py-name">ma</tt><tt class="py-op">.</tt><tt class="py-name">isMA</tt><tt class="py-op">(</tt><tt class="py-name">fld</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L715"></a><tt class="py-lineno"> 715</tt>  <tt class="py-line">                        <tt class="py-name">fld</tt> <tt class="py-op">=</tt> <tt class="py-name">ma</tt><tt class="py-op">.</tt><tt class="py-name">filled</tt><tt class="py-op">(</tt><tt class="py-name">fld</tt><tt class="py-op">)</tt> </tt>
+<a name="L716"></a><tt class="py-lineno"> 716</tt>  <tt class="py-line">                        <tt class="py-keyword">print</tt> <tt class="py-name">fld</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">,</tt> <tt class="py-name">lonsperlat</tt><tt class="py-op">.</tt><tt class="py-name">dtype</tt><tt class="py-op">,</tt> <tt class="py-name">lonsperlat</tt><tt class="py-op">.</tt><tt class="py-name">shape</tt><tt class="py-op">,</tt> <tt class="py-name">lonsper [...]
+<a name="L717"></a><tt class="py-lineno"> 717</tt>  <tt class="py-line">                        <tt class="py-name">fld</tt> <tt class="py-op">=</tt> <tt class="py-name">_redtoreg</tt><tt class="py-op">(</tt><tt class="py-name">nx</tt><tt class="py-op">,</tt> <tt class="py-name">lonsperlat</tt><tt class="py-op">.</tt><tt class="py-name">astype</tt><tt class="py-op">(</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">long</tt><tt class="py-op">)</tt><tt class="py- [...]
+<a name="L718"></a><tt class="py-lineno"> 718</tt>  <tt class="py-line">                                <tt class="py-name">fld</tt><tt class="py-op">.</tt><tt class="py-name">astype</tt><tt class="py-op">(</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">double</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">fill_value</tt><tt class="py-op">)</tt> </tt>
+<a name="L719"></a><tt class="py-lineno"> 719</tt>  <tt class="py-line">                        <tt class="py-name">fld</tt> <tt class="py-op">=</tt> <tt class="py-name">ma</tt><tt class="py-op">.</tt><tt class="py-name">masked_values</tt><tt class="py-op">(</tt><tt class="py-name">fld</tt><tt class="py-op">,</tt><tt class="py-name">fill_value</tt><tt class="py-op">)</tt> </tt>
+<a name="L720"></a><tt class="py-lineno"> 720</tt>  <tt class="py-line">                    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L721"></a><tt class="py-lineno"> 721</tt>  <tt class="py-line">                        <tt class="py-name">fld</tt> <tt class="py-op">=</tt> <tt class="py-name">_redtoreg</tt><tt class="py-op">(</tt><tt class="py-name">nx</tt><tt class="py-op">,</tt> <tt class="py-name">lonsperlat</tt><tt class="py-op">,</tt> <tt class="py-name">fld</tt><tt class="py-op">.</tt><tt class="py-name">astype</tt><tt class="py-op">(</tt><tt class="py-string">'f8'</tt><tt class="py-op">)</tt><tt class= [...]
+<a name="L722"></a><tt class="py-lineno"> 722</tt>  <tt class="py-line">                                <tt class="py-name">fill_value</tt><tt class="py-op">)</tt> </tt>
+<a name="L723"></a><tt class="py-lineno"> 723</tt>  <tt class="py-line">        <tt class="py-comment"># check scan modes for rect grids.</tt> </tt>
+<a name="L724"></a><tt class="py-lineno"> 724</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">nx</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt> <tt class="py-keyword">and</tt> <tt class="py-name">ny</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
+<a name="L725"></a><tt class="py-lineno"> 725</tt>  <tt class="py-line">            <tt class="py-comment"># rows scan in the -x direction (so flip)</tt> </tt>
+<a name="L726"></a><tt class="py-lineno"> 726</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L727"></a><tt class="py-lineno"> 727</tt>  <tt class="py-line">                <tt class="py-name">fldsave</tt> <tt class="py-op">=</tt> <tt class="py-name">fld</tt><tt class="py-op">.</tt><tt class="py-name">astype</tt><tt class="py-op">(</tt><tt class="py-string">'f'</tt><tt class="py-op">)</tt> <tt class="py-comment"># casting makes a copy</tt> </tt>
+<a name="L728"></a><tt class="py-lineno"> 728</tt>  <tt class="py-line">                <tt class="py-name">fld</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">,</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">fldsave</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">,</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
+<a name="L729"></a><tt class="py-lineno"> 729</tt>  <tt class="py-line">            <tt class="py-comment"># columns scan in the -y direction (so flip)</tt> </tt>
+<a name="L730"></a><tt class="py-lineno"> 730</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L731"></a><tt class="py-lineno"> 731</tt>  <tt class="py-line">                <tt class="py-name">fldsave</tt> <tt class="py-op">=</tt> <tt class="py-name">fld</tt><tt class="py-op">.</tt><tt class="py-name">astype</tt><tt class="py-op">(</tt><tt class="py-string">'f'</tt><tt class="py-op">)</tt> <tt class="py-comment"># casting makes a copy</tt> </tt>
+<a name="L732"></a><tt class="py-lineno"> 732</tt>  <tt class="py-line">                <tt class="py-name">fld</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">,</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">fldsave</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">,</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
+<a name="L733"></a><tt class="py-lineno"> 733</tt>  <tt class="py-line">            <tt class="py-comment"># adjacent rows scan in opposite direction.</tt> </tt>
+<a name="L734"></a><tt class="py-lineno"> 734</tt>  <tt class="py-line">            <tt class="py-comment"># (flip every other row)</tt> </tt>
+<a name="L735"></a><tt class="py-lineno"> 735</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt><tt class="py-op">[</tt><tt class="py-number">3</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L736"></a><tt class="py-lineno"> 736</tt>  <tt class="py-line">                <tt class="py-name">fldsave</tt> <tt class="py-op">=</tt> <tt class="py-name">fld</tt><tt class="py-op">.</tt><tt class="py-name">astype</tt><tt class="py-op">(</tt><tt class="py-string">'f'</tt><tt class="py-op">)</tt> <tt class="py-comment"># casting makes a copy</tt> </tt>
+<a name="L737"></a><tt class="py-lineno"> 737</tt>  <tt class="py-line">                <tt class="py-name">fld</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py-number">2</tt><tt class="py-op">,</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">fldsave</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py-numb [...]
+<a name="L738"></a><tt class="py-lineno"> 738</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">fld</tt> </tt>
+</div><a name="L739"></a><tt class="py-lineno"> 739</tt>  <tt class="py-line"> </tt>
+<a name="L740"></a><tt class="py-lineno"> 740</tt>  <tt class="py-line">    <tt id="link-11" class="py-name" targets="Variable ncepgrib2.Grib2Message.values=ncepgrib2.Grib2Message-class.html#values"><a title="ncepgrib2.Grib2Message.values" class="py-name" href="#" onclick="return doclink('link-11', 'values', 'link-11');">values</a></tt> <tt class="py-op">=</tt> <tt class="py-name">property</tt><tt class="py-op">(</tt><tt id="link-12" class="py-name" targets="Method ncepgrib2.Grib2Message [...]
+<a name="L741"></a><tt class="py-lineno"> 741</tt>  <tt class="py-line"> </tt>
+<a name="Grib2Message.latlons"></a><div id="Grib2Message.latlons-def"><a name="L742"></a><tt class="py-lineno"> 742</tt> <a class="py-toggle" href="#" id="Grib2Message.latlons-toggle" onclick="return toggle('Grib2Message.latlons');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2.Grib2Message-class.html#latlons">latlons</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+</div><div id="Grib2Message.latlons-collapsed" style="display:none;" pad="++++" indent="++++++++"></div><div id="Grib2Message.latlons-expanded"><a name="L743"></a><tt class="py-lineno"> 743</tt>  <tt class="py-line">        <tt class="py-docstring">"""alias for L{grid}"""</tt> </tt>
+<a name="L744"></a><tt class="py-lineno"> 744</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name" targets="Method ncepgrib2.Grib2Message.grid()=ncepgrib2.Grib2Message-class.html#grid"><a title="ncepgrib2.Grib2Message.grid" class="py-name" href="#" onclick="return doclink('link-13', 'grid', 'link-13');">grid</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
+</div><a name="L745"></a><tt class="py-lineno"> 745</tt>  <tt class="py-line"> </tt>
+<a name="Grib2Message.grid"></a><div id="Grib2Message.grid-def"><a name="L746"></a><tt class="py-lineno"> 746</tt> <a class="py-toggle" href="#" id="Grib2Message.grid-toggle" onclick="return toggle('Grib2Message.grid');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2.Grib2Message-class.html#grid">grid</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+</div><div id="Grib2Message.grid-collapsed" style="display:none;" pad="++++" indent="++++++++"></div><div id="Grib2Message.grid-expanded"><a name="L747"></a><tt class="py-lineno"> 747</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
+<a name="L748"></a><tt class="py-lineno"> 748</tt>  <tt class="py-line"><tt class="py-docstring"> return lats,lons (in degrees) of grid.</tt> </tt>
+<a name="L749"></a><tt class="py-lineno"> 749</tt>  <tt class="py-line"><tt class="py-docstring"> currently can handle reg. lat/lon, global gaussian, mercator, stereographic,</tt> </tt>
+<a name="L750"></a><tt class="py-lineno"> 750</tt>  <tt class="py-line"><tt class="py-docstring"> lambert conformal, albers equal-area, space-view and azimuthal</tt> </tt>
+<a name="L751"></a><tt class="py-lineno"> 751</tt>  <tt class="py-line"><tt class="py-docstring"> equidistant grids.  L{latlons} method does the same thing.</tt> </tt>
+<a name="L752"></a><tt class="py-lineno"> 752</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L753"></a><tt class="py-lineno"> 753</tt>  <tt class="py-line"><tt class="py-docstring"> @return: C{B{lats},B{lons}}, float32 numpy arrays</tt> </tt>
+<a name="L754"></a><tt class="py-lineno"> 754</tt>  <tt class="py-line"><tt class="py-docstring"> containing latitudes and longitudes of grid (in degrees).</tt> </tt>
+<a name="L755"></a><tt class="py-lineno"> 755</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
+<a name="L756"></a><tt class="py-lineno"> 756</tt>  <tt class="py-line">        <tt class="py-keyword">from</tt> <tt class="py-name">pygrib</tt> <tt class="py-keyword">import</tt> <tt class="py-name">gaulats</tt> </tt>
+<a name="L757"></a><tt class="py-lineno"> 757</tt>  <tt class="py-line">        <tt class="py-name">gdsinfo</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">grid_definition_info</tt> </tt>
+<a name="L758"></a><tt class="py-lineno"> 758</tt>  <tt class="py-line">        <tt class="py-name">gdtnum</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">grid_definition_template_number</tt> </tt>
+<a name="L759"></a><tt class="py-lineno"> 759</tt>  <tt class="py-line">        <tt class="py-name">gdtmpl</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">grid_definition_template</tt> </tt>
+<a name="L760"></a><tt class="py-lineno"> 760</tt>  <tt class="py-line">        <tt class="py-name">reggrid</tt> <tt class="py-op">=</tt> <tt class="py-name">gdsinfo</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt> <tt class="py-comment"># gdsinfo[2]=0 means regular 2-d grid</tt> </tt>
+<a name="L761"></a><tt class="py-lineno"> 761</tt>  <tt class="py-line">        <tt class="py-name">projparams</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
+<a name="L762"></a><tt class="py-lineno"> 762</tt>  <tt class="py-line">        <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'a'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRmajor</tt> </tt>
+<a name="L763"></a><tt class="py-lineno"> 763</tt>  <tt class="py-line">        <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'b'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">earthRminor</tt> </tt>
+<a name="L764"></a><tt class="py-lineno"> 764</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> <tt class="py-comment"># regular lat/lon grid</tt> </tt>
+<a name="L765"></a><tt class="py-lineno"> 765</tt>  <tt class="py-line">            <tt class="py-name">lon1</tt><tt class="py-op">,</tt> <tt class="py-name">lat1</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_first_gridpoint</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_first_gridpoint</tt> </tt>
+<a name="L766"></a><tt class="py-lineno"> 766</tt>  <tt class="py-line">            <tt class="py-name">lon2</tt><tt class="py-op">,</tt> <tt class="py-name">lat2</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_last_gridpoint</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_last_gridpoint</tt> </tt>
+<a name="L767"></a><tt class="py-lineno"> 767</tt>  <tt class="py-line">            <tt class="py-name">delon</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> </tt>
+<a name="L768"></a><tt class="py-lineno"> 768</tt>  <tt class="py-line">            <tt class="py-name">delat</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_y_direction</tt> </tt>
+<a name="L769"></a><tt class="py-lineno"> 769</tt>  <tt class="py-line">            <tt class="py-name">lats</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">arange</tt><tt class="py-op">(</tt><tt class="py-name">lat1</tt><tt class="py-op">,</tt><tt class="py-name">lat2</tt><tt class="py-op">+</tt><tt class="py-name">delat</tt><tt class="py-op">,</tt><tt class="py-name">delat</tt><tt class="py-op">)</tt> </tt>
+<a name="L770"></a><tt class="py-lineno"> 770</tt>  <tt class="py-line">            <tt class="py-name">lons</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">arange</tt><tt class="py-op">(</tt><tt class="py-name">lon1</tt><tt class="py-op">,</tt><tt class="py-name">lon2</tt><tt class="py-op">+</tt><tt class="py-name">delon</tt><tt class="py-op">,</tt><tt class="py-name">delon</tt><tt class="py-op">)</tt> </tt>
+<a name="L771"></a><tt class="py-lineno"> 771</tt>  <tt class="py-line">            <tt class="py-comment"># flip if scan mode says to.</tt> </tt>
+<a name="L772"></a><tt class="py-lineno"> 772</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L773"></a><tt class="py-lineno"> 773</tt>  <tt class="py-line">                <tt class="py-name">lons</tt> <tt class="py-op">=</tt> <tt class="py-name">lons</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
+<a name="L774"></a><tt class="py-lineno"> 774</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L775"></a><tt class="py-lineno"> 775</tt>  <tt class="py-line">                <tt class="py-name">lats</tt> <tt class="py-op">=</tt> <tt class="py-name">lats</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
+<a name="L776"></a><tt class="py-lineno"> 776</tt>  <tt class="py-line">            <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'proj'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-string">'cyl'</tt> </tt>
+<a name="L777"></a><tt class="py-lineno"> 777</tt>  <tt class="py-line">            <tt class="py-name">lons</tt><tt class="py-op">,</tt><tt class="py-name">lats</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">meshgrid</tt><tt class="py-op">(</tt><tt class="py-name">lons</tt><tt class="py-op">,</tt><tt class="py-name">lats</tt><tt class="py-op">)</tt> <tt class="py-comment"># make 2-d arrays.</tt> </tt>
+<a name="L778"></a><tt class="py-lineno"> 778</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">40</tt><tt class="py-op">:</tt> <tt class="py-comment"># gaussian grid (only works for global!)</tt> </tt>
+<a name="L779"></a><tt class="py-lineno"> 779</tt>  <tt class="py-line">            <tt class="py-name">lon1</tt><tt class="py-op">,</tt> <tt class="py-name">lat1</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_first_gridpoint</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_first_gridpoint</tt> </tt>
+<a name="L780"></a><tt class="py-lineno"> 780</tt>  <tt class="py-line">            <tt class="py-name">lon2</tt><tt class="py-op">,</tt> <tt class="py-name">lat2</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_last_gridpoint</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_last_gridpoint</tt> </tt>
+<a name="L781"></a><tt class="py-lineno"> 781</tt>  <tt class="py-line">            <tt class="py-name">nlats</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">points_in_y_direction</tt> </tt>
+<a name="L782"></a><tt class="py-lineno"> 782</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">reggrid</tt><tt class="py-op">:</tt> <tt class="py-comment"># ECMWF 'reduced' gaussian grid.</tt> </tt>
+<a name="L783"></a><tt class="py-lineno"> 783</tt>  <tt class="py-line">                <tt class="py-name">nlons</tt> <tt class="py-op">=</tt> <tt class="py-number">2</tt><tt class="py-op">*</tt><tt class="py-name">nlats</tt> </tt>
+<a name="L784"></a><tt class="py-lineno"> 784</tt>  <tt class="py-line">                <tt class="py-name">delon</tt> <tt class="py-op">=</tt> <tt class="py-number">360.</tt><tt class="py-op">/</tt><tt class="py-name">nlons</tt> </tt>
+<a name="L785"></a><tt class="py-lineno"> 785</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L786"></a><tt class="py-lineno"> 786</tt>  <tt class="py-line">                <tt class="py-name">nlons</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">points_in_x_direction</tt> </tt>
+<a name="L787"></a><tt class="py-lineno"> 787</tt>  <tt class="py-line">                <tt class="py-name">delon</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> </tt>
+<a name="L788"></a><tt class="py-lineno"> 788</tt>  <tt class="py-line">            <tt class="py-name">lons</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">arange</tt><tt class="py-op">(</tt><tt class="py-name">lon1</tt><tt class="py-op">,</tt><tt class="py-name">lon2</tt><tt class="py-op">+</tt><tt class="py-name">delon</tt><tt class="py-op">,</tt><tt class="py-name">delon</tt><tt class="py-op">)</tt> </tt>
+<a name="L789"></a><tt class="py-lineno"> 789</tt>  <tt class="py-line">            <tt class="py-comment"># compute gaussian lats (north to south)</tt> </tt>
+<a name="L790"></a><tt class="py-lineno"> 790</tt>  <tt class="py-line">            <tt class="py-name">lats</tt> <tt class="py-op">=</tt> <tt class="py-name">gaulats</tt><tt class="py-op">(</tt><tt class="py-name">nlats</tt><tt class="py-op">)</tt> </tt>
+<a name="L791"></a><tt class="py-lineno"> 791</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">lat1</tt> <tt class="py-op"><</tt> <tt class="py-name">lat2</tt><tt class="py-op">:</tt>  <tt class="py-comment"># reverse them if necessary</tt> </tt>
+<a name="L792"></a><tt class="py-lineno"> 792</tt>  <tt class="py-line">                <tt class="py-name">lats</tt> <tt class="py-op">=</tt> <tt class="py-name">lats</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
+<a name="L793"></a><tt class="py-lineno"> 793</tt>  <tt class="py-line">            <tt class="py-comment"># flip if scan mode says to.</tt> </tt>
+<a name="L794"></a><tt class="py-lineno"> 794</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L795"></a><tt class="py-lineno"> 795</tt>  <tt class="py-line">                <tt class="py-name">lons</tt> <tt class="py-op">=</tt> <tt class="py-name">lons</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
+<a name="L796"></a><tt class="py-lineno"> 796</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L797"></a><tt class="py-lineno"> 797</tt>  <tt class="py-line">                <tt class="py-name">lats</tt> <tt class="py-op">=</tt> <tt class="py-name">lats</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
+<a name="L798"></a><tt class="py-lineno"> 798</tt>  <tt class="py-line">            <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'proj'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-string">'cyl'</tt> </tt>
+<a name="L799"></a><tt class="py-lineno"> 799</tt>  <tt class="py-line">            <tt class="py-name">lons</tt><tt class="py-op">,</tt><tt class="py-name">lats</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">meshgrid</tt><tt class="py-op">(</tt><tt class="py-name">lons</tt><tt class="py-op">,</tt><tt class="py-name">lats</tt><tt class="py-op">)</tt> <tt class="py-comment"># make 2-d arrays</tt> </tt>
+<a name="L800"></a><tt class="py-lineno"> 800</tt>  <tt class="py-line">        <tt class="py-comment"># mercator, lambert conformal, stereographic, albers equal area, azimuthal equidistant</tt> </tt>
+<a name="L801"></a><tt class="py-lineno"> 801</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-keyword">in</tt> <tt class="py-op">[</tt><tt class="py-number">10</tt><tt class="py-op">,</tt><tt class="py-number">20</tt><tt class="py-op">,</tt><tt class="py-number">30</tt><tt class="py-op">,</tt><tt class="py-number">31</tt><tt class="py-op">,</tt><tt class="py-number">110</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L802"></a><tt class="py-lineno"> 802</tt>  <tt class="py-line">            <tt class="py-name">nx</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">points_in_x_direction</tt> </tt>
+<a name="L803"></a><tt class="py-lineno"> 803</tt>  <tt class="py-line">            <tt class="py-name">ny</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">points_in_y_direction</tt> </tt>
+<a name="L804"></a><tt class="py-lineno"> 804</tt>  <tt class="py-line">            <tt class="py-name">dx</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> </tt>
+<a name="L805"></a><tt class="py-lineno"> 805</tt>  <tt class="py-line">            <tt class="py-name">dy</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_y_direction</tt> </tt>
+<a name="L806"></a><tt class="py-lineno"> 806</tt>  <tt class="py-line">            <tt class="py-name">lon1</tt><tt class="py-op">,</tt> <tt class="py-name">lat1</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">longitude_first_gridpoint</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">latitude_first_gridpoint</tt> </tt>
+<a name="L807"></a><tt class="py-lineno"> 807</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">10</tt><tt class="py-op">:</tt> <tt class="py-comment"># mercator.</tt> </tt>
+<a name="L808"></a><tt class="py-lineno"> 808</tt>  <tt class="py-line">                <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'lat_ts'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_ts</tt> </tt>
+<a name="L809"></a><tt class="py-lineno"> 809</tt>  <tt class="py-line">                <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'proj'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_proj</tt> </tt>
+<a name="L810"></a><tt class="py-lineno"> 810</tt>  <tt class="py-line">                <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'lon_0'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lon_0</tt> </tt>
+<a name="L811"></a><tt class="py-lineno"> 811</tt>  <tt class="py-line">                <tt class="py-name">pj</tt> <tt class="py-op">=</tt> <tt class="py-name">pyproj</tt><tt class="py-op">.</tt><tt class="py-name">Proj</tt><tt class="py-op">(</tt><tt class="py-name">projparams</tt><tt class="py-op">)</tt> </tt>
+<a name="L812"></a><tt class="py-lineno"> 812</tt>  <tt class="py-line">                <tt class="py-name">llcrnrx</tt><tt class="py-op">,</tt> <tt class="py-name">llcrnry</tt> <tt class="py-op">=</tt> <tt class="py-name">pj</tt><tt class="py-op">(</tt><tt class="py-name">lon1</tt><tt class="py-op">,</tt><tt class="py-name">lat1</tt><tt class="py-op">)</tt> </tt>
+<a name="L813"></a><tt class="py-lineno"> 813</tt>  <tt class="py-line">                <tt class="py-name">x</tt> <tt class="py-op">=</tt> <tt class="py-name">llcrnrx</tt><tt class="py-op">+</tt><tt class="py-name">dx</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">arange</tt><tt class="py-op">(</tt><tt class="py-name">nx</tt><tt class="py-op">)</tt> </tt>
+<a name="L814"></a><tt class="py-lineno"> 814</tt>  <tt class="py-line">                <tt class="py-name">y</tt> <tt class="py-op">=</tt> <tt class="py-name">llcrnry</tt><tt class="py-op">+</tt><tt class="py-name">dy</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">arange</tt><tt class="py-op">(</tt><tt class="py-name">ny</tt><tt class="py-op">)</tt> </tt>
+<a name="L815"></a><tt class="py-lineno"> 815</tt>  <tt class="py-line">                <tt class="py-name">x</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">meshgrid</tt><tt class="py-op">(</tt><tt class="py-name">x</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt><tt class="py-op">)</tt> </tt>
+<a name="L816"></a><tt class="py-lineno"> 816</tt>  <tt class="py-line">                <tt class="py-name">lons</tt><tt class="py-op">,</tt> <tt class="py-name">lats</tt> <tt class="py-op">=</tt> <tt class="py-name">pj</tt><tt class="py-op">(</tt><tt class="py-name">x</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt><tt class="py-op">,</tt> <tt class="py-name">inverse</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt> </tt>
+<a name="L817"></a><tt class="py-lineno"> 817</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">20</tt><tt class="py-op">:</tt>  <tt class="py-comment"># stereographic</tt> </tt>
+<a name="L818"></a><tt class="py-lineno"> 818</tt>  <tt class="py-line">                <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'lat_ts'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_ts</tt> </tt>
+<a name="L819"></a><tt class="py-lineno"> 819</tt>  <tt class="py-line">                <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'proj'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_proj</tt> </tt>
+<a name="L820"></a><tt class="py-lineno"> 820</tt>  <tt class="py-line">                <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'lat_0'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_0</tt> </tt>
+<a name="L821"></a><tt class="py-lineno"> 821</tt>  <tt class="py-line">                <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'lon_0'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lon_0</tt> </tt>
+<a name="L822"></a><tt class="py-lineno"> 822</tt>  <tt class="py-line">                <tt class="py-name">pj</tt> <tt class="py-op">=</tt> <tt class="py-name">pyproj</tt><tt class="py-op">.</tt><tt class="py-name">Proj</tt><tt class="py-op">(</tt><tt class="py-name">projparams</tt><tt class="py-op">)</tt> </tt>
+<a name="L823"></a><tt class="py-lineno"> 823</tt>  <tt class="py-line">                <tt class="py-name">llcrnrx</tt><tt class="py-op">,</tt> <tt class="py-name">llcrnry</tt> <tt class="py-op">=</tt> <tt class="py-name">pj</tt><tt class="py-op">(</tt><tt class="py-name">lon1</tt><tt class="py-op">,</tt><tt class="py-name">lat1</tt><tt class="py-op">)</tt> </tt>
+<a name="L824"></a><tt class="py-lineno"> 824</tt>  <tt class="py-line">                <tt class="py-name">x</tt> <tt class="py-op">=</tt> <tt class="py-name">llcrnrx</tt><tt class="py-op">+</tt><tt class="py-name">dx</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">arange</tt><tt class="py-op">(</tt><tt class="py-name">nx</tt><tt class="py-op">)</tt> </tt>
+<a name="L825"></a><tt class="py-lineno"> 825</tt>  <tt class="py-line">                <tt class="py-name">y</tt> <tt class="py-op">=</tt> <tt class="py-name">llcrnry</tt><tt class="py-op">+</tt><tt class="py-name">dy</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">arange</tt><tt class="py-op">(</tt><tt class="py-name">ny</tt><tt class="py-op">)</tt> </tt>
+<a name="L826"></a><tt class="py-lineno"> 826</tt>  <tt class="py-line">                <tt class="py-name">x</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">meshgrid</tt><tt class="py-op">(</tt><tt class="py-name">x</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt><tt class="py-op">)</tt> </tt>
+<a name="L827"></a><tt class="py-lineno"> 827</tt>  <tt class="py-line">                <tt class="py-name">lons</tt><tt class="py-op">,</tt> <tt class="py-name">lats</tt> <tt class="py-op">=</tt> <tt class="py-name">pj</tt><tt class="py-op">(</tt><tt class="py-name">x</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt><tt class="py-op">,</tt> <tt class="py-name">inverse</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt> </tt>
+<a name="L828"></a><tt class="py-lineno"> 828</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-keyword">in</tt> <tt class="py-op">[</tt><tt class="py-number">30</tt><tt class="py-op">,</tt><tt class="py-number">31</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> <tt class="py-comment"># lambert, albers</tt> </tt>
+<a name="L829"></a><tt class="py-lineno"> 829</tt>  <tt class="py-line">                <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'lat_1'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_1</tt> </tt>
+<a name="L830"></a><tt class="py-lineno"> 830</tt>  <tt class="py-line">                <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'lat_2'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_2</tt> </tt>
+<a name="L831"></a><tt class="py-lineno"> 831</tt>  <tt class="py-line">                <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'proj'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_proj</tt> </tt>
+<a name="L832"></a><tt class="py-lineno"> 832</tt>  <tt class="py-line">                <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'lon_0'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lon_0</tt> </tt>
+<a name="L833"></a><tt class="py-lineno"> 833</tt>  <tt class="py-line">                <tt class="py-name">pj</tt> <tt class="py-op">=</tt> <tt class="py-name">pyproj</tt><tt class="py-op">.</tt><tt class="py-name">Proj</tt><tt class="py-op">(</tt><tt class="py-name">projparams</tt><tt class="py-op">)</tt> </tt>
+<a name="L834"></a><tt class="py-lineno"> 834</tt>  <tt class="py-line">                <tt class="py-name">llcrnrx</tt><tt class="py-op">,</tt> <tt class="py-name">llcrnry</tt> <tt class="py-op">=</tt> <tt class="py-name">pj</tt><tt class="py-op">(</tt><tt class="py-name">lon1</tt><tt class="py-op">,</tt><tt class="py-name">lat1</tt><tt class="py-op">)</tt> </tt>
+<a name="L835"></a><tt class="py-lineno"> 835</tt>  <tt class="py-line">                <tt class="py-name">x</tt> <tt class="py-op">=</tt> <tt class="py-name">llcrnrx</tt><tt class="py-op">+</tt><tt class="py-name">dx</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">arange</tt><tt class="py-op">(</tt><tt class="py-name">nx</tt><tt class="py-op">)</tt> </tt>
+<a name="L836"></a><tt class="py-lineno"> 836</tt>  <tt class="py-line">                <tt class="py-name">y</tt> <tt class="py-op">=</tt> <tt class="py-name">llcrnry</tt><tt class="py-op">+</tt><tt class="py-name">dy</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">arange</tt><tt class="py-op">(</tt><tt class="py-name">ny</tt><tt class="py-op">)</tt> </tt>
+<a name="L837"></a><tt class="py-lineno"> 837</tt>  <tt class="py-line">                <tt class="py-name">x</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">meshgrid</tt><tt class="py-op">(</tt><tt class="py-name">x</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt><tt class="py-op">)</tt> </tt>
+<a name="L838"></a><tt class="py-lineno"> 838</tt>  <tt class="py-line">                <tt class="py-name">lons</tt><tt class="py-op">,</tt> <tt class="py-name">lats</tt> <tt class="py-op">=</tt> <tt class="py-name">pj</tt><tt class="py-op">(</tt><tt class="py-name">x</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt><tt class="py-op">,</tt> <tt class="py-name">inverse</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt> </tt>
+<a name="L839"></a><tt class="py-lineno"> 839</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">110</tt><tt class="py-op">:</tt> <tt class="py-comment"># azimuthal equidistant</tt> </tt>
+<a name="L840"></a><tt class="py-lineno"> 840</tt>  <tt class="py-line">                <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'proj'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_proj</tt> </tt>
+<a name="L841"></a><tt class="py-lineno"> 841</tt>  <tt class="py-line">                <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'lat_0'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_0</tt> </tt>
+<a name="L842"></a><tt class="py-lineno"> 842</tt>  <tt class="py-line">                <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'lon_0'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lon_0</tt> </tt>
+<a name="L843"></a><tt class="py-lineno"> 843</tt>  <tt class="py-line">                <tt class="py-name">pj</tt> <tt class="py-op">=</tt> <tt class="py-name">pyproj</tt><tt class="py-op">.</tt><tt class="py-name">Proj</tt><tt class="py-op">(</tt><tt class="py-name">projparams</tt><tt class="py-op">)</tt> </tt>
+<a name="L844"></a><tt class="py-lineno"> 844</tt>  <tt class="py-line">                <tt class="py-name">llcrnrx</tt><tt class="py-op">,</tt> <tt class="py-name">llcrnry</tt> <tt class="py-op">=</tt> <tt class="py-name">pj</tt><tt class="py-op">(</tt><tt class="py-name">lon1</tt><tt class="py-op">,</tt><tt class="py-name">lat1</tt><tt class="py-op">)</tt> </tt>
+<a name="L845"></a><tt class="py-lineno"> 845</tt>  <tt class="py-line">                <tt class="py-name">x</tt> <tt class="py-op">=</tt> <tt class="py-name">llcrnrx</tt><tt class="py-op">+</tt><tt class="py-name">dx</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">arange</tt><tt class="py-op">(</tt><tt class="py-name">nx</tt><tt class="py-op">)</tt> </tt>
+<a name="L846"></a><tt class="py-lineno"> 846</tt>  <tt class="py-line">                <tt class="py-name">y</tt> <tt class="py-op">=</tt> <tt class="py-name">llcrnry</tt><tt class="py-op">+</tt><tt class="py-name">dy</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">arange</tt><tt class="py-op">(</tt><tt class="py-name">ny</tt><tt class="py-op">)</tt> </tt>
+<a name="L847"></a><tt class="py-lineno"> 847</tt>  <tt class="py-line">                <tt class="py-name">x</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">meshgrid</tt><tt class="py-op">(</tt><tt class="py-name">x</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt><tt class="py-op">)</tt> </tt>
+<a name="L848"></a><tt class="py-lineno"> 848</tt>  <tt class="py-line">                <tt class="py-name">lons</tt><tt class="py-op">,</tt> <tt class="py-name">lats</tt> <tt class="py-op">=</tt> <tt class="py-name">pj</tt><tt class="py-op">(</tt><tt class="py-name">x</tt><tt class="py-op">,</tt> <tt class="py-name">y</tt><tt class="py-op">,</tt> <tt class="py-name">inverse</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt> </tt>
+<a name="L849"></a><tt class="py-lineno"> 849</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">90</tt><tt class="py-op">:</tt> <tt class="py-comment"># satellite projection.</tt> </tt>
+<a name="L850"></a><tt class="py-lineno"> 850</tt>  <tt class="py-line">            <tt class="py-name">nx</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">points_in_x_direction</tt> </tt>
+<a name="L851"></a><tt class="py-lineno"> 851</tt>  <tt class="py-line">            <tt class="py-name">ny</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">points_in_y_direction</tt> </tt>
+<a name="L852"></a><tt class="py-lineno"> 852</tt>  <tt class="py-line">            <tt class="py-name">dx</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_x_direction</tt> </tt>
+<a name="L853"></a><tt class="py-lineno"> 853</tt>  <tt class="py-line">            <tt class="py-name">dy</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">gridlength_in_y_direction</tt> </tt>
+<a name="L854"></a><tt class="py-lineno"> 854</tt>  <tt class="py-line">            <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'proj'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_proj</tt> </tt>
+<a name="L855"></a><tt class="py-lineno"> 855</tt>  <tt class="py-line">            <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'lon_0'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lon_0</tt> </tt>
+<a name="L856"></a><tt class="py-lineno"> 856</tt>  <tt class="py-line">            <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'lat_0'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_lat_0</tt> </tt>
+<a name="L857"></a><tt class="py-lineno"> 857</tt>  <tt class="py-line">            <tt class="py-name">projparams</tt><tt class="py-op">[</tt><tt class="py-string">'h'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">proj4_h</tt> </tt>
+<a name="L858"></a><tt class="py-lineno"> 858</tt>  <tt class="py-line">            <tt class="py-name">pj</tt> <tt class="py-op">=</tt> <tt class="py-name">pyproj</tt><tt class="py-op">.</tt><tt class="py-name">Proj</tt><tt class="py-op">(</tt><tt class="py-name">projparams</tt><tt class="py-op">)</tt> </tt>
+<a name="L859"></a><tt class="py-lineno"> 859</tt>  <tt class="py-line">            <tt class="py-name">x</tt> <tt class="py-op">=</tt> <tt class="py-name">dx</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">indices</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">ny</tt><tt class="py-op">,</tt><tt class="py-name">nx</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-string">'f'</tt><tt class="py-op"> [...]
+<a name="L860"></a><tt class="py-lineno"> 860</tt>  <tt class="py-line">            <tt class="py-name">x</tt> <tt class="py-op">=</tt> <tt class="py-name">x</tt> <tt class="py-op">-</tt> <tt class="py-number">0.5</tt><tt class="py-op">*</tt><tt class="py-name">x</tt><tt class="py-op">.</tt><tt class="py-name">max</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
+<a name="L861"></a><tt class="py-lineno"> 861</tt>  <tt class="py-line">            <tt class="py-name">y</tt> <tt class="py-op">=</tt> <tt class="py-name">dy</tt><tt class="py-op">*</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">indices</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">ny</tt><tt class="py-op">,</tt><tt class="py-name">nx</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-string">'f'</tt><tt class="py-op"> [...]
+<a name="L862"></a><tt class="py-lineno"> 862</tt>  <tt class="py-line">            <tt class="py-name">y</tt> <tt class="py-op">=</tt> <tt class="py-name">y</tt> <tt class="py-op">-</tt> <tt class="py-number">0.5</tt><tt class="py-op">*</tt><tt class="py-name">y</tt><tt class="py-op">.</tt><tt class="py-name">max</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
+<a name="L863"></a><tt class="py-lineno"> 863</tt>  <tt class="py-line">            <tt class="py-name">lons</tt><tt class="py-op">,</tt> <tt class="py-name">lats</tt> <tt class="py-op">=</tt> <tt class="py-name">pj</tt><tt class="py-op">(</tt><tt class="py-name">x</tt><tt class="py-op">,</tt><tt class="py-name">y</tt><tt class="py-op">,</tt><tt class="py-name">inverse</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt> </tt>
+<a name="L864"></a><tt class="py-lineno"> 864</tt>  <tt class="py-line">            <tt class="py-comment"># set lons,lats to 1.e30 where undefined</tt> </tt>
+<a name="L865"></a><tt class="py-lineno"> 865</tt>  <tt class="py-line">            <tt class="py-name">abslons</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">fabs</tt><tt class="py-op">(</tt><tt class="py-name">lons</tt><tt class="py-op">)</tt><tt class="py-op">;</tt> <tt class="py-name">abslats</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">fabs</tt><tt class="py-op">(</tt><tt cl [...]
+<a name="L866"></a><tt class="py-lineno"> 866</tt>  <tt class="py-line">            <tt class="py-name">lons</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">where</tt><tt class="py-op">(</tt><tt class="py-name">abslons</tt> <tt class="py-op"><</tt> <tt class="py-number">1.e20</tt><tt class="py-op">,</tt> <tt class="py-name">lons</tt><tt class="py-op">,</tt> <tt class="py-number">1.e30</tt><tt class="py-op">)</tt> </tt>
+<a name="L867"></a><tt class="py-lineno"> 867</tt>  <tt class="py-line">            <tt class="py-name">lats</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">where</tt><tt class="py-op">(</tt><tt class="py-name">abslats</tt> <tt class="py-op"><</tt> <tt class="py-number">1.e20</tt><tt class="py-op">,</tt> <tt class="py-name">lats</tt><tt class="py-op">,</tt> <tt class="py-number">1.e30</tt><tt class="py-op">)</tt> </tt>
+<a name="L868"></a><tt class="py-lineno"> 868</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L869"></a><tt class="py-lineno"> 869</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'unsupported grid'</tt><tt class="py-op">)</tt> </tt>
+<a name="L870"></a><tt class="py-lineno"> 870</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">projparams</tt> <tt class="py-op">=</tt> <tt class="py-name">projparams</tt> </tt>
+<a name="L871"></a><tt class="py-lineno"> 871</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">lats</tt><tt class="py-op">.</tt><tt class="py-name">astype</tt><tt class="py-op">(</tt><tt class="py-string">'f'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">lons</tt><tt class="py-op">.</tt><tt class="py-name">astype</tt><tt class="py-op">(</tt><tt class="py-string">'f'</tt><tt class="py-op">)</tt> </tt>
+</div></div><a name="L872"></a><tt class="py-lineno"> 872</tt>  <tt class="py-line"> </tt>
+<a name="Grib2Decode"></a><div id="Grib2Decode-def"><a name="L873"></a><tt class="py-lineno"> 873</tt> <a class="py-toggle" href="#" id="Grib2Decode-toggle" onclick="return toggle('Grib2Decode');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2-module.html#Grib2Decode">Grib2Decode</a><tt class="py-op">(</tt><tt class="py-param">filename</tt><tt class="py-op">,</tt><tt class="py-param">gribmsg</tt><tt class="py-op">=</tt><tt class="py-name"> [...]
+</div><div id="Grib2Decode-collapsed" style="display:none;" pad="++++" indent="++++"></div><div id="Grib2Decode-expanded"><a name="L874"></a><tt class="py-lineno"> 874</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
+<a name="L875"></a><tt class="py-lineno"> 875</tt>  <tt class="py-line"><tt class="py-docstring"> Read the contents of a GRIB2 file.</tt> </tt>
+<a name="L876"></a><tt class="py-lineno"> 876</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L877"></a><tt class="py-lineno"> 877</tt>  <tt class="py-line"><tt class="py-docstring"> @param filename: name of GRIB2 file (default, gribmsg=False) or binary string</tt> </tt>
+<a name="L878"></a><tt class="py-lineno"> 878</tt>  <tt class="py-line"><tt class="py-docstring"> representing a grib message (if gribmsg=True).</tt> </tt>
+<a name="L879"></a><tt class="py-lineno"> 879</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L880"></a><tt class="py-lineno"> 880</tt>  <tt class="py-line"><tt class="py-docstring"> @return:  a list of L{Grib2Message} instances representing all of the</tt> </tt>
+<a name="L881"></a><tt class="py-lineno"> 881</tt>  <tt class="py-line"><tt class="py-docstring"> grib messages in the file.  Messages with multiple fields are split</tt> </tt>
+<a name="L882"></a><tt class="py-lineno"> 882</tt>  <tt class="py-line"><tt class="py-docstring"> into separate messages (so that each L{Grib2Message} instance contains</tt> </tt>
+<a name="L883"></a><tt class="py-lineno"> 883</tt>  <tt class="py-line"><tt class="py-docstring"> just one data field). The metadata in each GRIB2 message can be</tt> </tt>
+<a name="L884"></a><tt class="py-lineno"> 884</tt>  <tt class="py-line"><tt class="py-docstring"> accessed via L{Grib2Message} instance variables, the actual data</tt> </tt>
+<a name="L885"></a><tt class="py-lineno"> 885</tt>  <tt class="py-line"><tt class="py-docstring"> can be read using L{Grib2Message.data}, and the lat/lon values of the grid</tt> </tt>
+<a name="L886"></a><tt class="py-lineno"> 886</tt>  <tt class="py-line"><tt class="py-docstring"> can be accesses using L{Grib2Message.grid}. If there is only one grib</tt> </tt>
+<a name="L887"></a><tt class="py-lineno"> 887</tt>  <tt class="py-line"><tt class="py-docstring"> message, just the L{Grib2Message} instance is returned, instead of a list</tt> </tt>
+<a name="L888"></a><tt class="py-lineno"> 888</tt>  <tt class="py-line"><tt class="py-docstring"> with one element.</tt> </tt>
+<a name="L889"></a><tt class="py-lineno"> 889</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
+<a name="L890"></a><tt class="py-lineno"> 890</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">gribmsg</tt><tt class="py-op">:</tt> </tt>
+<a name="L891"></a><tt class="py-lineno"> 891</tt>  <tt class="py-line">        <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">StringIO</tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">)</tt> </tt>
+<a name="L892"></a><tt class="py-lineno"> 892</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L893"></a><tt class="py-lineno"> 893</tt>  <tt class="py-line">        <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">,</tt><tt class="py-string">'rb'</tt><tt class="py-op">)</tt> </tt>
+<a name="L894"></a><tt class="py-lineno"> 894</tt>  <tt class="py-line">    <tt class="py-name">nmsg</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
+<a name="L895"></a><tt class="py-lineno"> 895</tt>  <tt class="py-line">    <tt class="py-comment"># loop over grib messages, read section 0, get entire grib message.</tt> </tt>
+<a name="L896"></a><tt class="py-lineno"> 896</tt>  <tt class="py-line">    <tt class="py-name">disciplines</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L897"></a><tt class="py-lineno"> 897</tt>  <tt class="py-line">    <tt class="py-name">startingpos</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L898"></a><tt class="py-lineno"> 898</tt>  <tt class="py-line">    <tt class="py-name">msglen</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L899"></a><tt class="py-lineno"> 899</tt>  <tt class="py-line">    <tt class="py-keyword">while</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt> </tt>
+<a name="L900"></a><tt class="py-lineno"> 900</tt>  <tt class="py-line">        <tt class="py-comment"># find next occurence of string 'GRIB' (or EOF).</tt> </tt>
+<a name="L901"></a><tt class="py-lineno"> 901</tt>  <tt class="py-line">        <tt class="py-name">nbyte</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">tell</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
+<a name="L902"></a><tt class="py-lineno"> 902</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt> </tt>
+<a name="L903"></a><tt class="py-lineno"> 903</tt>  <tt class="py-line">            <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">seek</tt><tt class="py-op">(</tt><tt class="py-name">nbyte</tt><tt class="py-op">)</tt> </tt>
+<a name="L904"></a><tt class="py-lineno"> 904</tt>  <tt class="py-line">            <tt class="py-name">start</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-number">4</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">decode</tt><tt class="py-op">(</tt><tt class="py-string">'ascii'</tt><tt class="py-op">,</tt><tt class="py-string">'ignore'</tt><tt class="py-op">)</tt> </tt>
+<a name="L905"></a><tt class="py-lineno"> 905</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">start</tt> <tt class="py-op">==</tt> <tt class="py-string">''</tt> <tt class="py-keyword">or</tt> <tt class="py-name">start</tt> <tt class="py-op">==</tt> <tt class="py-string">'GRIB'</tt><tt class="py-op">:</tt> <tt class="py-keyword">break</tt> </tt>
+<a name="L906"></a><tt class="py-lineno"> 906</tt>  <tt class="py-line">            <tt class="py-name">nbyte</tt> <tt class="py-op">=</tt> <tt class="py-name">nbyte</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> </tt>
+<a name="L907"></a><tt class="py-lineno"> 907</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">start</tt> <tt class="py-op">==</tt> <tt class="py-string">''</tt><tt class="py-op">:</tt> <tt class="py-keyword">break</tt> <tt class="py-comment"># at EOF</tt> </tt>
+<a name="L908"></a><tt class="py-lineno"> 908</tt>  <tt class="py-line">        <tt class="py-comment"># otherwise, start (='GRIB') contains indicator message (section 0)</tt> </tt>
+<a name="L909"></a><tt class="py-lineno"> 909</tt>  <tt class="py-line">        <tt class="py-name">startpos</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">tell</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">-</tt><tt class="py-number">4</tt> </tt>
+<a name="L910"></a><tt class="py-lineno"> 910</tt>  <tt class="py-line">        <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">seek</tt><tt class="py-op">(</tt><tt class="py-number">2</tt><tt class="py-op">,</tt><tt class="py-number">1</tt><tt class="py-op">)</tt>  <tt class="py-comment"># next two octets are reserved</tt> </tt>
+<a name="L911"></a><tt class="py-lineno"> 911</tt>  <tt class="py-line">        <tt class="py-comment"># get discipline info.</tt> </tt>
+<a name="L912"></a><tt class="py-lineno"> 912</tt>  <tt class="py-line">        <tt class="py-name">disciplines</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>B'</tt><tt class="py-op">,</tt><tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-number">1</t [...]
+<a name="L913"></a><tt class="py-lineno"> 913</tt>  <tt class="py-line">        <tt class="py-comment"># check to see it's a grib edition 2 file.</tt> </tt>
+<a name="L914"></a><tt class="py-lineno"> 914</tt>  <tt class="py-line">        <tt class="py-name">vers</tt> <tt class="py-op">=</tt> <tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>B'</tt><tt class="py-op">,</tt><tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class= [...]
+<a name="L915"></a><tt class="py-lineno"> 915</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">vers</tt> <tt class="py-op">!=</tt> <tt class="py-number">2</tt><tt class="py-op">:</tt> </tt>
+<a name="L916"></a><tt class="py-lineno"> 916</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">IOError</tt><tt class="py-op">(</tt><tt class="py-string">'not a GRIB2 file (version number %d)'</tt> <tt class="py-op">%</tt> <tt class="py-name">vers</tt><tt class="py-op">)</tt> </tt>
+<a name="L917"></a><tt class="py-lineno"> 917</tt>  <tt class="py-line">        <tt class="py-name">lengrib</tt> <tt class="py-op">=</tt> <tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>q'</tt><tt class="py-op">,</tt><tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-number">8</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt cla [...]
+<a name="L918"></a><tt class="py-lineno"> 918</tt>  <tt class="py-line">        <tt class="py-name">msglen</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">lengrib</tt><tt class="py-op">)</tt> </tt>
+<a name="L919"></a><tt class="py-lineno"> 919</tt>  <tt class="py-line">        <tt class="py-name">startingpos</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">startpos</tt><tt class="py-op">)</tt> </tt>
+<a name="L920"></a><tt class="py-lineno"> 920</tt>  <tt class="py-line">        <tt class="py-comment"># read in entire grib message.</tt> </tt>
+<a name="L921"></a><tt class="py-lineno"> 921</tt>  <tt class="py-line">        <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">seek</tt><tt class="py-op">(</tt><tt class="py-name">startpos</tt><tt class="py-op">)</tt> </tt>
+<a name="L922"></a><tt class="py-lineno"> 922</tt>  <tt class="py-line">        <tt class="py-name">gribmsg</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-name">lengrib</tt><tt class="py-op">)</tt> </tt>
+<a name="L923"></a><tt class="py-lineno"> 923</tt>  <tt class="py-line">        <tt class="py-comment"># make sure the message ends with '7777'</tt> </tt>
+<a name="L924"></a><tt class="py-lineno"> 924</tt>  <tt class="py-line">        <tt id="link-14" class="py-name" targets="Method ncepgrib2.Grib2Encode.end()=ncepgrib2.Grib2Encode-class.html#end"><a title="ncepgrib2.Grib2Encode.end" class="py-name" href="#" onclick="return doclink('link-14', 'end', 'link-14');">end</a></tt> <tt class="py-op">=</tt> <tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">4</tt><tt class="py-op">:</tt><tt class= [...]
+<a name="L925"></a><tt class="py-lineno"> 925</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-15" class="py-name"><a title="ncepgrib2.Grib2Encode.end" class="py-name" href="#" onclick="return doclink('link-15', 'end', 'link-14');">end</a></tt> <tt class="py-op">!=</tt> <tt class="py-string">'7777'</tt><tt class="py-op">:</tt> </tt>
+<a name="L926"></a><tt class="py-lineno"> 926</tt>  <tt class="py-line">           <tt class="py-keyword">raise</tt> <tt class="py-name">IOError</tt><tt class="py-op">(</tt><tt class="py-string">'partial GRIB message (no "7777" at end)'</tt><tt class="py-op">)</tt> </tt>
+<a name="L927"></a><tt class="py-lineno"> 927</tt>  <tt class="py-line">        <tt class="py-comment"># do next message.</tt> </tt>
+<a name="L928"></a><tt class="py-lineno"> 928</tt>  <tt class="py-line">        <tt class="py-name">nmsg</tt><tt class="py-op">=</tt><tt class="py-name">nmsg</tt><tt class="py-op">+</tt><tt class="py-number">1</tt> </tt>
+<a name="L929"></a><tt class="py-lineno"> 929</tt>  <tt class="py-line">    <tt class="py-comment"># if no grib messages found, nmsg is still 0 and it's not GRIB.</tt> </tt>
+<a name="L930"></a><tt class="py-lineno"> 930</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">nmsg</tt><tt class="py-op">==</tt><tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
+<a name="L931"></a><tt class="py-lineno"> 931</tt>  <tt class="py-line">       <tt class="py-keyword">raise</tt> <tt class="py-name">IOError</tt><tt class="py-op">(</tt><tt class="py-string">'not a GRIB file'</tt><tt class="py-op">)</tt> </tt>
+<a name="L932"></a><tt class="py-lineno"> 932</tt>  <tt class="py-line">    <tt class="py-comment"># now for each grib message, find number of fields.</tt> </tt>
+<a name="L933"></a><tt class="py-lineno"> 933</tt>  <tt class="py-line">    <tt class="py-name">numfields</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L934"></a><tt class="py-lineno"> 934</tt>  <tt class="py-line">    <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">seek</tt><tt class="py-op">(</tt><tt class="py-number">0</tt><tt class="py-op">)</tt> <tt class="py-comment"># rewind file.</tt> </tt>
+<a name="L935"></a><tt class="py-lineno"> 935</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">n</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">nmsg</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L936"></a><tt class="py-lineno"> 936</tt>  <tt class="py-line">        <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">seek</tt><tt class="py-op">(</tt><tt class="py-name">startingpos</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
+<a name="L937"></a><tt class="py-lineno"> 937</tt>  <tt class="py-line">        <tt class="py-name">gribmsg</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-name">msglen</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
+<a name="L938"></a><tt class="py-lineno"> 938</tt>  <tt class="py-line">        <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
+<a name="L939"></a><tt class="py-lineno"> 939</tt>  <tt class="py-line">        <tt class="py-name">numflds</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
+<a name="L940"></a><tt class="py-lineno"> 940</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt> </tt>
+<a name="L941"></a><tt class="py-lineno"> 941</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt><tt class="py-op">+</tt><tt class="py-number">4</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">decode</tt><tt class="py-op">(</tt><tt class="py-string">'ascii'</tt><tt class="py-op">,</tt><tt class="py-string">'ignor [...]
+<a name="L942"></a><tt class="py-lineno"> 942</tt>  <tt class="py-line">                <tt class="py-name">sectnum</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
+<a name="L943"></a><tt class="py-lineno"> 943</tt>  <tt class="py-line">                <tt class="py-name">lensect</tt> <tt class="py-op">=</tt> <tt class="py-number">16</tt> </tt>
+<a name="L944"></a><tt class="py-lineno"> 944</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt><tt class="py-op">+</tt><tt class="py-number">4</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">decode</tt><tt class="py-op">(</tt><tt class="py-string">'ascii'</tt><tt class="py-op">,</tt><tt class="py-string">'ign [...]
+<a name="L945"></a><tt class="py-lineno"> 945</tt>  <tt class="py-line">                <tt class="py-keyword">break</tt> </tt>
+<a name="L946"></a><tt class="py-lineno"> 946</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L947"></a><tt class="py-lineno"> 947</tt>  <tt class="py-line">                <tt class="py-name">lensect</tt> <tt class="py-op">=</tt> <tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>i'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt><tt class="py-op">+</tt><tt class="py-numb [...]
+<a name="L948"></a><tt class="py-lineno"> 948</tt>  <tt class="py-line">                <tt class="py-name">sectnum</tt> <tt class="py-op">=</tt> <tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>B'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">+</tt><tt class="py-number">4</tt><tt class="py-op">:</tt><tt class="py-name [...]
+<a name="L949"></a><tt class="py-lineno"> 949</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">sectnum</tt> <tt class="py-op">==</tt> <tt class="py-number">4</tt><tt class="py-op">:</tt> <tt class="py-name">numflds</tt><tt class="py-op">=</tt><tt class="py-name">numflds</tt><tt class="py-op">+</tt><tt class="py-number">1</tt> </tt>
+<a name="L950"></a><tt class="py-lineno"> 950</tt>  <tt class="py-line">                <tt class="py-comment">#if sectnum == 2: numlocal=numlocal+1</tt> </tt>
+<a name="L951"></a><tt class="py-lineno"> 951</tt>  <tt class="py-line">            <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-name">lensect</tt> </tt>
+<a name="L952"></a><tt class="py-lineno"> 952</tt>  <tt class="py-line">            <tt class="py-comment">#print sectnum,lensect,pos</tt> </tt>
+<a name="L953"></a><tt class="py-lineno"> 953</tt>  <tt class="py-line">        <tt class="py-comment">#print n+1,len(gribmsg),numfields,numlocal</tt> </tt>
+<a name="L954"></a><tt class="py-lineno"> 954</tt>  <tt class="py-line">        <tt class="py-name">numfields</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">numflds</tt><tt class="py-op">)</tt> </tt>
+<a name="L955"></a><tt class="py-lineno"> 955</tt>  <tt class="py-line">    <tt class="py-comment"># decode each section in grib message (sections 1 and above).</tt> </tt>
+<a name="L956"></a><tt class="py-lineno"> 956</tt>  <tt class="py-line">    <tt class="py-name">gdtnum</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># grid defn template number from sxn 3</tt> </tt>
+<a name="L957"></a><tt class="py-lineno"> 957</tt>  <tt class="py-line">    <tt class="py-name">gdtmpl</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># grid defn template from sxn 3</tt> </tt>
+<a name="L958"></a><tt class="py-lineno"> 958</tt>  <tt class="py-line">    <tt class="py-name">gdeflist</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># optional grid definition list from sxn 3</tt> </tt>
+<a name="L959"></a><tt class="py-lineno"> 959</tt>  <tt class="py-line">    <tt class="py-name">gdsinfo</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># grid definition section info from sxn3</tt> </tt>
+<a name="L960"></a><tt class="py-lineno"> 960</tt>  <tt class="py-line">    <tt class="py-name">pdtmpl</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># product defn template from sxn 4</tt> </tt>
+<a name="L961"></a><tt class="py-lineno"> 961</tt>  <tt class="py-line">    <tt class="py-name">pdtnum</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># product defn template number from sxn 4</tt> </tt>
+<a name="L962"></a><tt class="py-lineno"> 962</tt>  <tt class="py-line">    <tt class="py-name">coordlist</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># vertical coordinate info from sxn 4</tt> </tt>
+<a name="L963"></a><tt class="py-lineno"> 963</tt>  <tt class="py-line">    <tt class="py-name">drtmpl</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># data representation template from sxn 5</tt> </tt>
+<a name="L964"></a><tt class="py-lineno"> 964</tt>  <tt class="py-line">    <tt class="py-name">drtnum</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># data representation template number from sxn 5</tt> </tt>
+<a name="L965"></a><tt class="py-lineno"> 965</tt>  <tt class="py-line">    <tt class="py-name">ndpts</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># number of data points to be unpacked (from sxn 5)</tt> </tt>
+<a name="L966"></a><tt class="py-lineno"> 966</tt>  <tt class="py-line">    <tt class="py-name">bitmapflag</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># bit-map indicator flag from sxn 6</tt> </tt>
+<a name="L967"></a><tt class="py-lineno"> 967</tt>  <tt class="py-line">    <tt class="py-name">bitmap</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># bitmap from sxn 6.</tt> </tt>
+<a name="L968"></a><tt class="py-lineno"> 968</tt>  <tt class="py-line">    <tt class="py-name">pos7</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># byte offset for section 7.</tt> </tt>
+<a name="L969"></a><tt class="py-lineno"> 969</tt>  <tt class="py-line">    <tt class="py-name">localsxn</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># local use sections.</tt> </tt>
+<a name="L970"></a><tt class="py-lineno"> 970</tt>  <tt class="py-line">    <tt class="py-name">msgstart</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># byte offset in file for message start.</tt> </tt>
+<a name="L971"></a><tt class="py-lineno"> 971</tt>  <tt class="py-line">    <tt class="py-name">msglength</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># length of the message in bytes.</tt> </tt>
+<a name="L972"></a><tt class="py-lineno"> 972</tt>  <tt class="py-line">    <tt class="py-name">message</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># the actual grib message.</tt> </tt>
+<a name="L973"></a><tt class="py-lineno"> 973</tt>  <tt class="py-line">    <tt class="py-name">identsect</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># identification section (section 1).</tt> </tt>
+<a name="L974"></a><tt class="py-lineno"> 974</tt>  <tt class="py-line">    <tt class="py-name">discipline</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> <tt class="py-comment"># discipline code.</tt> </tt>
+<a name="L975"></a><tt class="py-lineno"> 975</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">n</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">nmsg</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L976"></a><tt class="py-lineno"> 976</tt>  <tt class="py-line">        <tt class="py-name">spos</tt> <tt class="py-op">=</tt> <tt class="py-name">startingpos</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L977"></a><tt class="py-lineno"> 977</tt>  <tt class="py-line">        <tt class="py-name">lengrib</tt> <tt class="py-op">=</tt> <tt class="py-name">msglen</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L978"></a><tt class="py-lineno"> 978</tt>  <tt class="py-line">        <tt class="py-comment">#gribmsg = gribmsgs[n]</tt> </tt>
+<a name="L979"></a><tt class="py-lineno"> 979</tt>  <tt class="py-line">        <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">seek</tt><tt class="py-op">(</tt><tt class="py-name">spos</tt><tt class="py-op">)</tt> </tt>
+<a name="L980"></a><tt class="py-lineno"> 980</tt>  <tt class="py-line">        <tt class="py-name">gribmsg</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-name">lengrib</tt><tt class="py-op">)</tt> </tt>
+<a name="L981"></a><tt class="py-lineno"> 981</tt>  <tt class="py-line">        <tt class="py-name">discipl</tt> <tt class="py-op">=</tt> <tt class="py-name">disciplines</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L982"></a><tt class="py-lineno"> 982</tt>  <tt class="py-line">        <tt class="py-name">lensect0</tt> <tt class="py-op">=</tt> <tt class="py-number">16</tt> </tt>
+<a name="L983"></a><tt class="py-lineno"> 983</tt>  <tt class="py-line">        <tt class="py-comment"># get length of section 1 and section number.</tt> </tt>
+<a name="L984"></a><tt class="py-lineno"> 984</tt>  <tt class="py-line">        <tt class="py-comment">#lensect1 = struct.unpack('>i',gribmsg[lensect0:lensect0+4])[0]</tt> </tt>
+<a name="L985"></a><tt class="py-lineno"> 985</tt>  <tt class="py-line">        <tt class="py-comment">#sectnum1 = struct.unpack('>B',gribmsg[lensect0+4])[0]</tt> </tt>
+<a name="L986"></a><tt class="py-lineno"> 986</tt>  <tt class="py-line">        <tt class="py-comment">#print 'sectnum1, lensect1 = ',sectnum1,lensect1</tt> </tt>
+<a name="L987"></a><tt class="py-lineno"> 987</tt>  <tt class="py-line">        <tt class="py-comment"># unpack section 1, octets 1-21 (13 parameters).  This section</tt> </tt>
+<a name="L988"></a><tt class="py-lineno"> 988</tt>  <tt class="py-line">        <tt class="py-comment"># can occur only once per grib message.</tt> </tt>
+<a name="L989"></a><tt class="py-lineno"> 989</tt>  <tt class="py-line">        <tt class="py-comment">#idsect,pos = _unpack1(gribmsg,lensect0) # python version</tt> </tt>
+<a name="L990"></a><tt class="py-lineno"> 990</tt>  <tt class="py-line">        <tt class="py-name">idsect</tt><tt class="py-op">,</tt><tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">g2clib</tt><tt class="py-op">.</tt><tt class="py-name">unpack1</tt><tt class="py-op">(</tt><tt class="py-name">gribmsg</tt><tt class="py-op">,</tt><tt class="py-name">lensect0</tt><tt class="py-op">,</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">empty</t [...]
+<a name="L991"></a><tt class="py-lineno"> 991</tt>  <tt class="py-line">        <tt class="py-comment"># loop over rest of sections in message.</tt> </tt>
+<a name="L992"></a><tt class="py-lineno"> 992</tt>  <tt class="py-line">        <tt class="py-name">gdtnums</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L993"></a><tt class="py-lineno"> 993</tt>  <tt class="py-line">        <tt class="py-name">gdtmpls</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L994"></a><tt class="py-lineno"> 994</tt>  <tt class="py-line">        <tt class="py-name">gdeflists</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L995"></a><tt class="py-lineno"> 995</tt>  <tt class="py-line">        <tt class="py-name">gdsinfos</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L996"></a><tt class="py-lineno"> 996</tt>  <tt class="py-line">        <tt class="py-name">pdtmpls</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L997"></a><tt class="py-lineno"> 997</tt>  <tt class="py-line">        <tt class="py-name">coordlists</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L998"></a><tt class="py-lineno"> 998</tt>  <tt class="py-line">        <tt class="py-name">pdtnums</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L999"></a><tt class="py-lineno"> 999</tt>  <tt class="py-line">        <tt class="py-name">drtmpls</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L1000"></a><tt class="py-lineno">1000</tt>  <tt class="py-line">        <tt class="py-name">drtnums</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L1001"></a><tt class="py-lineno">1001</tt>  <tt class="py-line">        <tt class="py-name">ndptslist</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L1002"></a><tt class="py-lineno">1002</tt>  <tt class="py-line">        <tt class="py-name">bitmapflags</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L1003"></a><tt class="py-lineno">1003</tt>  <tt class="py-line">        <tt class="py-name">bitmaps</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L1004"></a><tt class="py-lineno">1004</tt>  <tt class="py-line">        <tt class="py-name">sxn7pos</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L1005"></a><tt class="py-lineno">1005</tt>  <tt class="py-line">        <tt class="py-name">localsxns</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L1006"></a><tt class="py-lineno">1006</tt>  <tt class="py-line">        <tt class="py-keyword">while</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt> </tt>
+<a name="L1007"></a><tt class="py-lineno">1007</tt>  <tt class="py-line">            <tt class="py-comment"># check to see if this is the end of the message.</tt> </tt>
+<a name="L1008"></a><tt class="py-lineno">1008</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt><tt class="py-op">+</tt><tt class="py-number">4</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt class="py-name">decode</tt><tt class="py-op">(</tt><tt class="py-string">'ascii'</tt><tt class="py-op">,</tt><tt class="py-string">'igno [...]
+<a name="L1009"></a><tt class="py-lineno">1009</tt>  <tt class="py-line">            <tt class="py-name">lensect</tt> <tt class="py-op">=</tt> <tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>i'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt><tt class="py-op">+</tt><tt class="py-number" [...]
+<a name="L1010"></a><tt class="py-lineno">1010</tt>  <tt class="py-line">            <tt class="py-name">sectnum</tt> <tt class="py-op">=</tt> <tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>B'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">+</tt><tt class="py-number">4</tt><tt class="py-op">:</tt><tt class="py-name">p [...]
+<a name="L1011"></a><tt class="py-lineno">1011</tt>  <tt class="py-line">            <tt class="py-comment"># section 2, local use section.</tt> </tt>
+<a name="L1012"></a><tt class="py-lineno">1012</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">sectnum</tt> <tt class="py-op">==</tt> <tt class="py-number">2</tt><tt class="py-op">:</tt> </tt>
+<a name="L1013"></a><tt class="py-lineno">1013</tt>  <tt class="py-line">                <tt class="py-comment"># "local use section", used by NDFD to store WX</tt> </tt>
+<a name="L1014"></a><tt class="py-lineno">1014</tt>  <tt class="py-line">                <tt class="py-comment"># strings.  This section is returned as a raw</tt> </tt>
+<a name="L1015"></a><tt class="py-lineno">1015</tt>  <tt class="py-line">                <tt class="py-comment"># bytestring for further dataset-specific parsing,</tt> </tt>
+<a name="L1016"></a><tt class="py-lineno">1016</tt>  <tt class="py-line">                <tt class="py-comment"># not as a numpy array.</tt> </tt>
+<a name="L1017"></a><tt class="py-lineno">1017</tt>  <tt class="py-line">                <tt class="py-name">localsxns</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">+</tt><tt class="py-number">5</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt><tt class="py-op">+</tt><tt class="py-name">lensect</tt><tt class="py-op">]</tt><tt class="py-op">)</t [...]
+<a name="L1018"></a><tt class="py-lineno">1018</tt>  <tt class="py-line">                <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-name">lensect</tt> </tt>
+<a name="L1019"></a><tt class="py-lineno">1019</tt>  <tt class="py-line">            <tt class="py-comment"># section 3, grid definition section.</tt> </tt>
+<a name="L1020"></a><tt class="py-lineno">1020</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">sectnum</tt> <tt class="py-op">==</tt> <tt class="py-number">3</tt><tt class="py-op">:</tt> </tt>
+<a name="L1021"></a><tt class="py-lineno">1021</tt>  <tt class="py-line">                <tt class="py-name">gds</tt><tt class="py-op">,</tt><tt class="py-name">gdtempl</tt><tt class="py-op">,</tt><tt class="py-name">deflist</tt><tt class="py-op">,</tt><tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">g2clib</tt><tt class="py-op">.</tt><tt class="py-name">unpack3</tt><tt class="py-op">(</tt><tt class="py-name">gribmsg</tt><tt class="py-op">,</tt><tt class="py-name [...]
+<a name="L1022"></a><tt class="py-lineno">1022</tt>  <tt class="py-line">                <tt class="py-name">gdtnums</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">gds</tt><tt class="py-op">[</tt><tt class="py-number">4</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
+<a name="L1023"></a><tt class="py-lineno">1023</tt>  <tt class="py-line">                <tt class="py-name">gdtmpls</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">gdtempl</tt><tt class="py-op">)</tt> </tt>
+<a name="L1024"></a><tt class="py-lineno">1024</tt>  <tt class="py-line">                <tt class="py-name">gdeflists</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">deflist</tt><tt class="py-op">)</tt> </tt>
+<a name="L1025"></a><tt class="py-lineno">1025</tt>  <tt class="py-line">                <tt class="py-name">gdsinfos</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">gds</tt><tt class="py-op">)</tt> </tt>
+<a name="L1026"></a><tt class="py-lineno">1026</tt>  <tt class="py-line">            <tt class="py-comment"># section, product definition section.</tt> </tt>
+<a name="L1027"></a><tt class="py-lineno">1027</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">sectnum</tt> <tt class="py-op">==</tt> <tt class="py-number">4</tt><tt class="py-op">:</tt> </tt>
+<a name="L1028"></a><tt class="py-lineno">1028</tt>  <tt class="py-line">                <tt class="py-name">pdtempl</tt><tt class="py-op">,</tt><tt class="py-name">pdtn</tt><tt class="py-op">,</tt><tt class="py-name">coordlst</tt><tt class="py-op">,</tt><tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">g2clib</tt><tt class="py-op">.</tt><tt class="py-name">unpack4</tt><tt class="py-op">(</tt><tt class="py-name">gribmsg</tt><tt class="py-op">,</tt><tt class="py-na [...]
+<a name="L1029"></a><tt class="py-lineno">1029</tt>  <tt class="py-line">                <tt class="py-name">pdtmpls</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">pdtempl</tt><tt class="py-op">)</tt> </tt>
+<a name="L1030"></a><tt class="py-lineno">1030</tt>  <tt class="py-line">                <tt class="py-name">coordlists</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">coordlst</tt><tt class="py-op">)</tt> </tt>
+<a name="L1031"></a><tt class="py-lineno">1031</tt>  <tt class="py-line">                <tt class="py-name">pdtnums</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">pdtn</tt><tt class="py-op">)</tt> </tt>
+<a name="L1032"></a><tt class="py-lineno">1032</tt>  <tt class="py-line">            <tt class="py-comment"># section 5, data representation section.</tt> </tt>
+<a name="L1033"></a><tt class="py-lineno">1033</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">sectnum</tt> <tt class="py-op">==</tt> <tt class="py-number">5</tt><tt class="py-op">:</tt> </tt>
+<a name="L1034"></a><tt class="py-lineno">1034</tt>  <tt class="py-line">                <tt class="py-name">drtempl</tt><tt class="py-op">,</tt><tt class="py-name">drtn</tt><tt class="py-op">,</tt><tt class="py-name">npts</tt><tt class="py-op">,</tt><tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">g2clib</tt><tt class="py-op">.</tt><tt class="py-name">unpack5</tt><tt class="py-op">(</tt><tt class="py-name">gribmsg</tt><tt class="py-op">,</tt><tt class="py-name"> [...]
+<a name="L1035"></a><tt class="py-lineno">1035</tt>  <tt class="py-line">                <tt class="py-name">drtmpls</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">drtempl</tt><tt class="py-op">)</tt> </tt>
+<a name="L1036"></a><tt class="py-lineno">1036</tt>  <tt class="py-line">                <tt class="py-name">drtnums</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">drtn</tt><tt class="py-op">)</tt> </tt>
+<a name="L1037"></a><tt class="py-lineno">1037</tt>  <tt class="py-line">                <tt class="py-name">ndptslist</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">npts</tt><tt class="py-op">)</tt> </tt>
+<a name="L1038"></a><tt class="py-lineno">1038</tt>  <tt class="py-line">            <tt class="py-comment"># section 6, bit-map section.</tt> </tt>
+<a name="L1039"></a><tt class="py-lineno">1039</tt>  <tt class="py-line">            <tt class="py-keyword">elif</tt> <tt class="py-name">sectnum</tt> <tt class="py-op">==</tt> <tt class="py-number">6</tt><tt class="py-op">:</tt> </tt>
+<a name="L1040"></a><tt class="py-lineno">1040</tt>  <tt class="py-line">                <tt class="py-name">bmap</tt><tt class="py-op">,</tt><tt class="py-name">bmapflag</tt> <tt class="py-op">=</tt> <tt class="py-name">g2clib</tt><tt class="py-op">.</tt><tt class="py-name">unpack6</tt><tt class="py-op">(</tt><tt class="py-name">gribmsg</tt><tt class="py-op">,</tt><tt class="py-name">gds</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">,< [...]
+<a name="L1041"></a><tt class="py-lineno">1041</tt>  <tt class="py-line">                <tt class="py-comment">#bitmapflag = struct.unpack('>B',gribmsg[pos+5])[0]</tt> </tt>
+<a name="L1042"></a><tt class="py-lineno">1042</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">bmapflag</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
+<a name="L1043"></a><tt class="py-lineno">1043</tt>  <tt class="py-line">                    <tt class="py-name">bitmaps</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">bmap</tt><tt class="py-op">.</tt><tt class="py-name">astype</tt><tt class="py-op">(</tt><tt class="py-string">'b'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1044"></a><tt class="py-lineno">1044</tt>  <tt class="py-line">                <tt class="py-comment"># use last defined bitmap.</tt> </tt>
+<a name="L1045"></a><tt class="py-lineno">1045</tt>  <tt class="py-line">                <tt class="py-keyword">elif</tt> <tt class="py-name">bmapflag</tt> <tt class="py-op">==</tt> <tt class="py-number">254</tt><tt class="py-op">:</tt> </tt>
+<a name="L1046"></a><tt class="py-lineno">1046</tt>  <tt class="py-line">                    <tt class="py-name">bmapflag</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
+<a name="L1047"></a><tt class="py-lineno">1047</tt>  <tt class="py-line">                    <tt class="py-keyword">for</tt> <tt class="py-name">bmp</tt> <tt class="py-keyword">in</tt> <tt class="py-name">bitmaps</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L1048"></a><tt class="py-lineno">1048</tt>  <tt class="py-line">                        <tt class="py-keyword">if</tt> <tt class="py-name">bmp</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> <tt class="py-name">bitmaps</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">bmp</tt><tt class="py-op">)</tt> </tt>
+<a name="L1049"></a><tt class="py-lineno">1049</tt>  <tt class="py-line">                <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L1050"></a><tt class="py-lineno">1050</tt>  <tt class="py-line">                    <tt class="py-name">bitmaps</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
+<a name="L1051"></a><tt class="py-lineno">1051</tt>  <tt class="py-line">                <tt class="py-name">bitmapflags</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">bmapflag</tt><tt class="py-op">)</tt> </tt>
+<a name="L1052"></a><tt class="py-lineno">1052</tt>  <tt class="py-line">                <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-name">lensect</tt> </tt>
+<a name="L1053"></a><tt class="py-lineno">1053</tt>  <tt class="py-line">            <tt class="py-comment"># section 7, data section (nothing done here,</tt> </tt>
+<a name="L1054"></a><tt class="py-lineno">1054</tt>  <tt class="py-line">            <tt class="py-comment"># data unpacked when getfld method is invoked).</tt> </tt>
+<a name="L1055"></a><tt class="py-lineno">1055</tt>  <tt class="py-line">            <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L1056"></a><tt class="py-lineno">1056</tt>  <tt class="py-line">                <tt class="py-keyword">if</tt> <tt class="py-name">sectnum</tt> <tt class="py-op">!=</tt> <tt class="py-number">7</tt><tt class="py-op">:</tt> </tt>
+<a name="L1057"></a><tt class="py-lineno">1057</tt>  <tt class="py-line">                   <tt class="py-name">msg</tt> <tt class="py-op">=</tt> <tt class="py-string">'unknown section = %i'</tt> <tt class="py-op">%</tt> <tt class="py-name">sectnum</tt> </tt>
+<a name="L1058"></a><tt class="py-lineno">1058</tt>  <tt class="py-line">                   <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-name">msg</tt><tt class="py-op">)</tt> </tt>
+<a name="L1059"></a><tt class="py-lineno">1059</tt>  <tt class="py-line">                <tt class="py-name">sxn7pos</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">pos</tt><tt class="py-op">)</tt> </tt>
+<a name="L1060"></a><tt class="py-lineno">1060</tt>  <tt class="py-line">                <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-name">lensect</tt> </tt>
+<a name="L1061"></a><tt class="py-lineno">1061</tt>  <tt class="py-line">        <tt class="py-comment"># extend by repeating last value for all remaining fields.</tt> </tt>
+<a name="L1062"></a><tt class="py-lineno">1062</tt>  <tt class="py-line">        <tt class="py-name">gdtnum</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">gdtnums</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1063"></a><tt class="py-lineno">1063</tt>  <tt class="py-line">        <tt class="py-name">gdtmpl</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">gdtmpls</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1064"></a><tt class="py-lineno">1064</tt>  <tt class="py-line">        <tt class="py-name">gdeflist</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">gdeflists</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1065"></a><tt class="py-lineno">1065</tt>  <tt class="py-line">        <tt class="py-name">gdsinfo</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">gdsinfos</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1066"></a><tt class="py-lineno">1066</tt>  <tt class="py-line">        <tt class="py-name">pdtmpl</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">pdtmpls</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1067"></a><tt class="py-lineno">1067</tt>  <tt class="py-line">        <tt class="py-name">pdtnum</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">pdtnums</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1068"></a><tt class="py-lineno">1068</tt>  <tt class="py-line">        <tt class="py-name">coordlist</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">coordlists</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1069"></a><tt class="py-lineno">1069</tt>  <tt class="py-line">        <tt class="py-name">drtmpl</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">drtmpls</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1070"></a><tt class="py-lineno">1070</tt>  <tt class="py-line">        <tt class="py-name">drtnum</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">drtnums</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1071"></a><tt class="py-lineno">1071</tt>  <tt class="py-line">        <tt class="py-name">ndpts</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">ndptslist</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1072"></a><tt class="py-lineno">1072</tt>  <tt class="py-line">        <tt class="py-name">bitmapflag</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">bitmapflags</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1073"></a><tt class="py-lineno">1073</tt>  <tt class="py-line">        <tt class="py-name">bitmap</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">bitmaps</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1074"></a><tt class="py-lineno">1074</tt>  <tt class="py-line">        <tt class="py-name">pos7</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">sxn7pos</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1075"></a><tt class="py-lineno">1075</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">localsxns</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
+<a name="L1076"></a><tt class="py-lineno">1076</tt>  <tt class="py-line">            <tt class="py-name">localsxns</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-name">None</tt><tt class="py-op">]</tt> </tt>
+<a name="L1077"></a><tt class="py-lineno">1077</tt>  <tt class="py-line">        <tt class="py-name">localsxn</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-name">localsxns</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
+<a name="L1078"></a><tt class="py-lineno">1078</tt>  <tt class="py-line">        <tt class="py-name">msgstart</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-op">[</tt><tt class="py-name">spos</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt cl [...]
+<a name="L1079"></a><tt class="py-lineno">1079</tt>  <tt class="py-line">        <tt class="py-name">msglength</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-op">[</tt><tt class="py-name">lengrib</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><t [...]
+<a name="L1080"></a><tt class="py-lineno">1080</tt>  <tt class="py-line">        <tt class="py-name">identsect</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-op">[</tt><tt class="py-name">idsect</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt [...]
+<a name="L1081"></a><tt class="py-lineno">1081</tt>  <tt class="py-line">        <tt class="py-name">discipline</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">_repeatlast</tt><tt class="py-op">(</tt><tt class="py-name">numfields</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">,</tt><tt class="py-op">[</tt><tt class="py-name">discipl</tt><tt class="py-op">]</tt><tt class="py-op">)</tt>< [...]
+<a name="L1082"></a><tt class="py-lineno">1082</tt>  <tt class="py-line"> </tt>
+<a name="L1083"></a><tt class="py-lineno">1083</tt>  <tt class="py-line">    <tt class="py-name">gdtnum</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">gdtnum</tt><tt class="py-op">)</tt> </tt>
+<a name="L1084"></a><tt class="py-lineno">1084</tt>  <tt class="py-line">    <tt class="py-name">gdtmpl</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">)</tt> </tt>
+<a name="L1085"></a><tt class="py-lineno">1085</tt>  <tt class="py-line">    <tt class="py-name">gdeflist</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">gdeflist</tt><tt class="py-op">)</tt> </tt>
+<a name="L1086"></a><tt class="py-lineno">1086</tt>  <tt class="py-line">    <tt class="py-name">gdsinfo</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">gdsinfo</tt><tt class="py-op">)</tt> </tt>
+<a name="L1087"></a><tt class="py-lineno">1087</tt>  <tt class="py-line">    <tt class="py-name">pdtmpl</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">pdtmpl</tt><tt class="py-op">)</tt> </tt>
+<a name="L1088"></a><tt class="py-lineno">1088</tt>  <tt class="py-line">    <tt class="py-name">pdtnum</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">pdtnum</tt><tt class="py-op">)</tt> </tt>
+<a name="L1089"></a><tt class="py-lineno">1089</tt>  <tt class="py-line">    <tt class="py-name">coordlist</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">coordlist</tt><tt class="py-op">)</tt> </tt>
+<a name="L1090"></a><tt class="py-lineno">1090</tt>  <tt class="py-line">    <tt class="py-name">drtmpl</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">drtmpl</tt><tt class="py-op">)</tt> </tt>
+<a name="L1091"></a><tt class="py-lineno">1091</tt>  <tt class="py-line">    <tt class="py-name">drtnum</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">drtnum</tt><tt class="py-op">)</tt> </tt>
+<a name="L1092"></a><tt class="py-lineno">1092</tt>  <tt class="py-line">    <tt class="py-name">ndpts</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">ndpts</tt><tt class="py-op">)</tt> </tt>
+<a name="L1093"></a><tt class="py-lineno">1093</tt>  <tt class="py-line">    <tt class="py-name">bitmapflag</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">bitmapflag</tt><tt class="py-op">)</tt> </tt>
+<a name="L1094"></a><tt class="py-lineno">1094</tt>  <tt class="py-line">    <tt class="py-name">bitmap</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">bitmap</tt><tt class="py-op">)</tt> </tt>
+<a name="L1095"></a><tt class="py-lineno">1095</tt>  <tt class="py-line">    <tt class="py-name">pos7</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">pos7</tt><tt class="py-op">)</tt> </tt>
+<a name="L1096"></a><tt class="py-lineno">1096</tt>  <tt class="py-line">    <tt class="py-name">localsxn</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">localsxn</tt><tt class="py-op">)</tt> </tt>
+<a name="L1097"></a><tt class="py-lineno">1097</tt>  <tt class="py-line">    <tt class="py-name">msgstart</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">msgstart</tt><tt class="py-op">)</tt> </tt>
+<a name="L1098"></a><tt class="py-lineno">1098</tt>  <tt class="py-line">    <tt class="py-name">msglength</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">msglength</tt><tt class="py-op">)</tt> </tt>
+<a name="L1099"></a><tt class="py-lineno">1099</tt>  <tt class="py-line">    <tt class="py-name">identsect</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">identsect</tt><tt class="py-op">)</tt> </tt>
+<a name="L1100"></a><tt class="py-lineno">1100</tt>  <tt class="py-line">    <tt class="py-name">discipline</tt> <tt class="py-op">=</tt> <tt class="py-name">_flatten</tt><tt class="py-op">(</tt><tt class="py-name">discipline</tt><tt class="py-op">)</tt> </tt>
+<a name="L1101"></a><tt class="py-lineno">1101</tt>  <tt class="py-line"> </tt>
+<a name="L1102"></a><tt class="py-lineno">1102</tt>  <tt class="py-line">    <tt class="py-name">gribs</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L1103"></a><tt class="py-lineno">1103</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">n</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">msgstart</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L1104"></a><tt class="py-lineno">1104</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
+<a name="L1105"></a><tt class="py-lineno">1105</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'originating_center'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt id="link-16" class="py-name"><a title="ncepgrib2._table0" class="py-name" href="#" onclick="return doclink('link-16', '_table0', 'link-9');">_table0</a></tt><tt class="py-op">[</tt><tt class="py-name">identsect</tt><tt class="py-op">[</tt><tt class="py-name [...]
+<a name="L1106"></a><tt class="py-lineno">1106</tt>  <tt class="py-line">        <tt class="py-name">wmo_code</tt> <tt class="py-op">=</tt> <tt id="link-17" class="py-name"><a title="ncepgrib2._table0" class="py-name" href="#" onclick="return doclink('link-17', '_table0', 'link-9');">_table0</a></tt><tt class="py-op">[</tt><tt class="py-name">identsect</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt cla [...]
+<a name="L1107"></a><tt class="py-lineno">1107</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">wmo_code</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
+<a name="L1108"></a><tt class="py-lineno">1108</tt>  <tt class="py-line">            <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'center_wmo_code'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">wmo_code</tt> </tt>
+<a name="L1109"></a><tt class="py-lineno">1109</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'grid_definition_template_number'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">gdtnum</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1110"></a><tt class="py-lineno">1110</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'grid_definition_template'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1111"></a><tt class="py-lineno">1111</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">gdeflist</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> <tt class="py-op">!=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L1112"></a><tt class="py-lineno">1112</tt>  <tt class="py-line">            <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'grid_definition_list'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">gdeflist</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1113"></a><tt class="py-lineno">1113</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'grid_definition_info'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">gdsinfo</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1114"></a><tt class="py-lineno">1114</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'discipline_code'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">discipline</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1115"></a><tt class="py-lineno">1115</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'product_definition_template_number'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">pdtnum</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1116"></a><tt class="py-lineno">1116</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'product_definition_template'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">pdtmpl</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1117"></a><tt class="py-lineno">1117</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'data_representation_template_number'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">drtnum</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1118"></a><tt class="py-lineno">1118</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'data_representation_template'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">drtmpl</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1119"></a><tt class="py-lineno">1119</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">coordlist</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> <tt class="py-op">!=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L1120"></a><tt class="py-lineno">1120</tt>  <tt class="py-line">            <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'extra_vertical_coordinate_info'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">coordlist</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1121"></a><tt class="py-lineno">1121</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'number_of_data_points_to_unpack'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">ndpts</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1122"></a><tt class="py-lineno">1122</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'bitmap_indicator_flag'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">bitmapflag</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1123"></a><tt class="py-lineno">1123</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">bitmap</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L1124"></a><tt class="py-lineno">1124</tt>  <tt class="py-line">            <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'_bitmap'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">bitmap</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1125"></a><tt class="py-lineno">1125</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'_section7_byte_offset'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">pos7</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1126"></a><tt class="py-lineno">1126</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'_grib_message_byteoffset'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">msgstart</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1127"></a><tt class="py-lineno">1127</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'_grib_message_length'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">msglength</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1128"></a><tt class="py-lineno">1128</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'_grib_filename'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">filename</tt> </tt>
+<a name="L1129"></a><tt class="py-lineno">1129</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'identification_section'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">identsect</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1130"></a><tt class="py-lineno">1130</tt>  <tt class="py-line">        <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'_grib_message_number'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">n</tt><tt class="py-op">+</tt><tt class="py-number">1</tt> </tt>
+<a name="L1131"></a><tt class="py-lineno">1131</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">localsxn</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
+<a name="L1132"></a><tt class="py-lineno">1132</tt>  <tt class="py-line">            <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'has_local_use_section'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">True</tt> </tt>
+<a name="L1133"></a><tt class="py-lineno">1133</tt>  <tt class="py-line">            <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'_local_use_section'</tt><tt class="py-op">]</tt><tt class="py-op">=</tt><tt class="py-name">localsxn</tt><tt class="py-op">[</tt><tt class="py-name">n</tt><tt class="py-op">]</tt> </tt>
+<a name="L1134"></a><tt class="py-lineno">1134</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L1135"></a><tt class="py-lineno">1135</tt>  <tt class="py-line">            <tt class="py-name">kwargs</tt><tt class="py-op">[</tt><tt class="py-string">'has_local_use_section'</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
+<a name="L1136"></a><tt class="py-lineno">1136</tt>  <tt class="py-line">        <tt class="py-name">gribs</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt id="link-18" class="py-name" targets="Class ncepgrib2.Grib2Message=ncepgrib2.Grib2Message-class.html"><a title="ncepgrib2.Grib2Message" class="py-name" href="#" onclick="return doclink('link-18', 'Grib2Message', 'link-18');">Grib2Message</a></tt><tt class="py-op">(</tt><tt class="py-op">**</tt><tt [...]
+<a name="L1137"></a><tt class="py-lineno">1137</tt>  <tt class="py-line">    <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">close</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
+<a name="L1138"></a><tt class="py-lineno">1138</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">gribs</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt> </tt>
+<a name="L1139"></a><tt class="py-lineno">1139</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">gribs</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
+<a name="L1140"></a><tt class="py-lineno">1140</tt>  <tt class="py-line">    <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L1141"></a><tt class="py-lineno">1141</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">gribs</tt> </tt>
+</div><a name="L1142"></a><tt class="py-lineno">1142</tt>  <tt class="py-line"> </tt>
+<a name="dump"></a><div id="dump-def"><a name="L1143"></a><tt class="py-lineno">1143</tt> <a class="py-toggle" href="#" id="dump-toggle" onclick="return toggle('dump');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2-module.html#dump">dump</a><tt class="py-op">(</tt><tt class="py-param">filename</tt><tt class="py-op">,</tt> <tt class="py-param">grbs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+</div><div id="dump-collapsed" style="display:none;" pad="++++" indent="++++"></div><div id="dump-expanded"><a name="L1144"></a><tt class="py-lineno">1144</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
+<a name="L1145"></a><tt class="py-lineno">1145</tt>  <tt class="py-line"><tt class="py-docstring"> write the given L{Grib2Message} instances to a grib file.</tt> </tt>
+<a name="L1146"></a><tt class="py-lineno">1146</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1147"></a><tt class="py-lineno">1147</tt>  <tt class="py-line"><tt class="py-docstring"> @param filename: file to write grib data to.</tt> </tt>
+<a name="L1148"></a><tt class="py-lineno">1148</tt>  <tt class="py-line"><tt class="py-docstring"> @param grbs: a list of L{Grib2Message} instances.</tt> </tt>
+<a name="L1149"></a><tt class="py-lineno">1149</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
+<a name="L1150"></a><tt class="py-lineno">1150</tt>  <tt class="py-line">    <tt class="py-name">gribfile</tt> <tt class="py-op">=</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">filename</tt><tt class="py-op">,</tt><tt class="py-string">'wb'</tt><tt class="py-op">)</tt> </tt>
+<a name="L1151"></a><tt class="py-lineno">1151</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">grb</tt> <tt class="py-keyword">in</tt> <tt class="py-name">grbs</tt><tt class="py-op">:</tt> </tt>
+<a name="L1152"></a><tt class="py-lineno">1152</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
+<a name="L1153"></a><tt class="py-lineno">1153</tt>  <tt class="py-line">            <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">grb</tt><tt class="py-op">.</tt><tt class="py-name">_grib_filename</tt><tt class="py-op">,</tt><tt class="py-string">'rb'</tt><tt class="py-op">)</tt> </tt>
+<a name="L1154"></a><tt class="py-lineno">1154</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">TypeError</tt><tt class="py-op">:</tt> </tt>
+<a name="L1155"></a><tt class="py-lineno">1155</tt>  <tt class="py-line">            <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">StringIO</tt><tt class="py-op">(</tt><tt class="py-name">grb</tt><tt class="py-op">.</tt><tt class="py-name">_grib_filename</tt><tt class="py-op">)</tt> </tt>
+<a name="L1156"></a><tt class="py-lineno">1156</tt>  <tt class="py-line">        <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">seek</tt><tt class="py-op">(</tt><tt class="py-name">grb</tt><tt class="py-op">.</tt><tt class="py-name">_grib_message_byteoffset</tt><tt class="py-op">)</tt> </tt>
+<a name="L1157"></a><tt class="py-lineno">1157</tt>  <tt class="py-line">        <tt class="py-name">gribmsg</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-name">grb</tt><tt class="py-op">.</tt><tt class="py-name">_grib_message_length</tt><tt class="py-op">)</tt> </tt>
+<a name="L1158"></a><tt class="py-lineno">1158</tt>  <tt class="py-line">        <tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">close</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
+<a name="L1159"></a><tt class="py-lineno">1159</tt>  <tt class="py-line">        <tt class="py-name">gribfile</tt><tt class="py-op">.</tt><tt class="py-name">write</tt><tt class="py-op">(</tt><tt class="py-name">gribmsg</tt><tt class="py-op">)</tt> </tt>
+<a name="L1160"></a><tt class="py-lineno">1160</tt>  <tt class="py-line">    <tt class="py-name">gribfile</tt><tt class="py-op">.</tt><tt class="py-name">close</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
+</div><a name="L1161"></a><tt class="py-lineno">1161</tt>  <tt class="py-line"> </tt>
+<a name="L1162"></a><tt class="py-lineno">1162</tt>  <tt class="py-line"><tt class="py-comment"># private methods and functions below here.</tt> </tt>
+<a name="L1163"></a><tt class="py-lineno">1163</tt>  <tt class="py-line"> </tt>
+<a name="_getdate"></a><div id="_getdate-def"><a name="L1164"></a><tt class="py-lineno">1164</tt> <a class="py-toggle" href="#" id="_getdate-toggle" onclick="return toggle('_getdate');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2-module.html#_getdate">_getdate</a><tt class="py-op">(</tt><tt class="py-param">idsect</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+</div><div id="_getdate-collapsed" style="display:none;" pad="++++" indent="++++"></div><div id="_getdate-expanded"><a name="L1165"></a><tt class="py-lineno">1165</tt>  <tt class="py-line">    <tt class="py-docstring">"""return yyyy,mm,dd,min,ss from section 1"""</tt> </tt>
+<a name="L1166"></a><tt class="py-lineno">1166</tt>  <tt class="py-line">    <tt class="py-name">yyyy</tt><tt class="py-op">=</tt><tt class="py-name">idsect</tt><tt class="py-op">[</tt><tt class="py-number">5</tt><tt class="py-op">]</tt> </tt>
+<a name="L1167"></a><tt class="py-lineno">1167</tt>  <tt class="py-line">    <tt class="py-name">mm</tt><tt class="py-op">=</tt><tt class="py-name">idsect</tt><tt class="py-op">[</tt><tt class="py-number">6</tt><tt class="py-op">]</tt> </tt>
+<a name="L1168"></a><tt class="py-lineno">1168</tt>  <tt class="py-line">    <tt class="py-name">dd</tt><tt class="py-op">=</tt><tt class="py-name">idsect</tt><tt class="py-op">[</tt><tt class="py-number">7</tt><tt class="py-op">]</tt> </tt>
+<a name="L1169"></a><tt class="py-lineno">1169</tt>  <tt class="py-line">    <tt class="py-name">hh</tt><tt class="py-op">=</tt><tt class="py-name">idsect</tt><tt class="py-op">[</tt><tt class="py-number">8</tt><tt class="py-op">]</tt> </tt>
+<a name="L1170"></a><tt class="py-lineno">1170</tt>  <tt class="py-line">    <tt class="py-name">min</tt><tt class="py-op">=</tt><tt class="py-name">idsect</tt><tt class="py-op">[</tt><tt class="py-number">9</tt><tt class="py-op">]</tt> </tt>
+<a name="L1171"></a><tt class="py-lineno">1171</tt>  <tt class="py-line">    <tt class="py-name">ss</tt><tt class="py-op">=</tt><tt class="py-name">idsect</tt><tt class="py-op">[</tt><tt class="py-number">10</tt><tt class="py-op">]</tt> </tt>
+<a name="L1172"></a><tt class="py-lineno">1172</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">yyyy</tt><tt class="py-op">,</tt><tt class="py-name">mm</tt><tt class="py-op">,</tt><tt class="py-name">dd</tt><tt class="py-op">,</tt><tt class="py-name">hh</tt><tt class="py-op">,</tt><tt class="py-name">min</tt><tt class="py-op">,</tt><tt class="py-name">ss</tt> </tt>
+</div><a name="L1173"></a><tt class="py-lineno">1173</tt>  <tt class="py-line"> </tt>
+<a name="_unpack1"></a><div id="_unpack1-def"><a name="L1174"></a><tt class="py-lineno">1174</tt> <a class="py-toggle" href="#" id="_unpack1-toggle" onclick="return toggle('_unpack1');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2-module.html#_unpack1">_unpack1</a><tt class="py-op">(</tt><tt class="py-param">gribmsg</tt><tt class="py-op">,</tt><tt class="py-param">pos</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+</div><div id="_unpack1-collapsed" style="display:none;" pad="++++" indent="++++"></div><div id="_unpack1-expanded"><a name="L1175"></a><tt class="py-lineno">1175</tt>  <tt class="py-line">    <tt class="py-docstring">"""unpack section 1 given starting point in bytes</tt> </tt>
+<a name="L1176"></a><tt class="py-lineno">1176</tt>  <tt class="py-line"><tt class="py-docstring">    used to test pyrex interface to g2_unpack1"""</tt> </tt>
+<a name="L1177"></a><tt class="py-lineno">1177</tt>  <tt class="py-line">    <tt class="py-name">idsect</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
+<a name="L1178"></a><tt class="py-lineno">1178</tt>  <tt class="py-line">    <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">5</tt> </tt>
+<a name="L1179"></a><tt class="py-lineno">1179</tt>  <tt class="py-line">    <tt class="py-name">idsect</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>h'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt>< [...]
+<a name="L1180"></a><tt class="py-lineno">1180</tt>  <tt class="py-line">    <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">2</tt> </tt>
+<a name="L1181"></a><tt class="py-lineno">1181</tt>  <tt class="py-line">    <tt class="py-name">idsect</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>h'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt>< [...]
+<a name="L1182"></a><tt class="py-lineno">1182</tt>  <tt class="py-line">    <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">2</tt> </tt>
+<a name="L1183"></a><tt class="py-lineno">1183</tt>  <tt class="py-line">    <tt class="py-name">idsect</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>B'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt>< [...]
+<a name="L1184"></a><tt class="py-lineno">1184</tt>  <tt class="py-line">    <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> </tt>
+<a name="L1185"></a><tt class="py-lineno">1185</tt>  <tt class="py-line">    <tt class="py-name">idsect</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>B'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt>< [...]
+<a name="L1186"></a><tt class="py-lineno">1186</tt>  <tt class="py-line">    <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> </tt>
+<a name="L1187"></a><tt class="py-lineno">1187</tt>  <tt class="py-line">    <tt class="py-name">idsect</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>B'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt>< [...]
+<a name="L1188"></a><tt class="py-lineno">1188</tt>  <tt class="py-line">    <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> </tt>
+<a name="L1189"></a><tt class="py-lineno">1189</tt>  <tt class="py-line">    <tt class="py-name">idsect</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>h'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt>< [...]
+<a name="L1190"></a><tt class="py-lineno">1190</tt>  <tt class="py-line">    <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">2</tt> </tt>
+<a name="L1191"></a><tt class="py-lineno">1191</tt>  <tt class="py-line">    <tt class="py-name">idsect</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>B'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt>< [...]
+<a name="L1192"></a><tt class="py-lineno">1192</tt>  <tt class="py-line">    <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> </tt>
+<a name="L1193"></a><tt class="py-lineno">1193</tt>  <tt class="py-line">    <tt class="py-name">idsect</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>B'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt>< [...]
+<a name="L1194"></a><tt class="py-lineno">1194</tt>  <tt class="py-line">    <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> </tt>
+<a name="L1195"></a><tt class="py-lineno">1195</tt>  <tt class="py-line">    <tt class="py-name">idsect</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>B'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt>< [...]
+<a name="L1196"></a><tt class="py-lineno">1196</tt>  <tt class="py-line">    <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> </tt>
+<a name="L1197"></a><tt class="py-lineno">1197</tt>  <tt class="py-line">    <tt class="py-name">idsect</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>B'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt>< [...]
+<a name="L1198"></a><tt class="py-lineno">1198</tt>  <tt class="py-line">    <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> </tt>
+<a name="L1199"></a><tt class="py-lineno">1199</tt>  <tt class="py-line">    <tt class="py-name">idsect</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>B'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt>< [...]
+<a name="L1200"></a><tt class="py-lineno">1200</tt>  <tt class="py-line">    <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> </tt>
+<a name="L1201"></a><tt class="py-lineno">1201</tt>  <tt class="py-line">    <tt class="py-name">idsect</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>B'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt>< [...]
+<a name="L1202"></a><tt class="py-lineno">1202</tt>  <tt class="py-line">    <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> </tt>
+<a name="L1203"></a><tt class="py-lineno">1203</tt>  <tt class="py-line">    <tt class="py-name">idsect</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">struct</tt><tt class="py-op">.</tt><tt class="py-name">unpack</tt><tt class="py-op">(</tt><tt class="py-string">'>B'</tt><tt class="py-op">,</tt><tt class="py-name">gribmsg</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt>< [...]
+<a name="L1204"></a><tt class="py-lineno">1204</tt>  <tt class="py-line">    <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> </tt>
+<a name="L1205"></a><tt class="py-lineno">1205</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">array</tt><tt class="py-op">(</tt><tt class="py-name">idsect</tt><tt class="py-op">,</tt><tt class="py-string">'i'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-name">pos</tt> </tt>
+</div><a name="L1206"></a><tt class="py-lineno">1206</tt>  <tt class="py-line"> </tt>
+<a name="_repeatlast"></a><div id="_repeatlast-def"><a name="L1207"></a><tt class="py-lineno">1207</tt> <a class="py-toggle" href="#" id="_repeatlast-toggle" onclick="return toggle('_repeatlast');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2-module.html#_repeatlast">_repeatlast</a><tt class="py-op">(</tt><tt class="py-param">numfields</tt><tt class="py-op">,</tt><tt class="py-param">listin</tt><tt class="py-op">)</tt><tt class="py-op">: [...]
+</div><div id="_repeatlast-collapsed" style="display:none;" pad="++++" indent="++++"></div><div id="_repeatlast-expanded"><a name="L1208"></a><tt class="py-lineno">1208</tt>  <tt class="py-line">    <tt class="py-docstring">"""repeat last item in listin, until len(listin) = numfields"""</tt> </tt>
+<a name="L1209"></a><tt class="py-lineno">1209</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">listin</tt><tt class="py-op">)</tt> <tt class="py-op"><</tt> <tt class="py-name">numfields</tt><tt class="py-op">:</tt> </tt>
+<a name="L1210"></a><tt class="py-lineno">1210</tt>  <tt class="py-line">        <tt class="py-name">last</tt> <tt class="py-op">=</tt> <tt class="py-name">listin</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
+<a name="L1211"></a><tt class="py-lineno">1211</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">n</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">listin</tt><tt class="py-op">)</tt><tt class="py-op">,</tt><tt class="py-name">numfields</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L1212"></a><tt class="py-lineno">1212</tt>  <tt class="py-line">            <tt class="py-name">listin</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">last</tt><tt class="py-op">)</tt> </tt>
+<a name="L1213"></a><tt class="py-lineno">1213</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">listin</tt> </tt>
+</div><a name="L1214"></a><tt class="py-lineno">1214</tt>  <tt class="py-line"> </tt>
+<a name="_flatten"></a><div id="_flatten-def"><a name="L1215"></a><tt class="py-lineno">1215</tt> <a class="py-toggle" href="#" id="_flatten-toggle" onclick="return toggle('_flatten');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2-module.html#_flatten">_flatten</a><tt class="py-op">(</tt><tt class="py-param">lst</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+</div><div id="_flatten-collapsed" style="display:none;" pad="++++" indent="++++"></div><div id="_flatten-expanded"><a name="L1216"></a><tt class="py-lineno">1216</tt>  <tt class="py-line">    <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
+<a name="L1217"></a><tt class="py-lineno">1217</tt>  <tt class="py-line">        <tt class="py-name">flist</tt> <tt class="py-op">=</tt> <tt class="py-name">functools</tt><tt class="py-op">.</tt><tt class="py-name">reduce</tt><tt class="py-op">(</tt><tt class="py-name">operator</tt><tt class="py-op">.</tt><tt class="py-name">add</tt><tt class="py-op">,</tt><tt class="py-name">lst</tt><tt class="py-op">)</tt> </tt>
+<a name="L1218"></a><tt class="py-lineno">1218</tt>  <tt class="py-line">    <tt class="py-keyword">except</tt> <tt class="py-name">NameError</tt><tt class="py-op">:</tt> <tt class="py-comment"># no reduce in python 3.</tt> </tt>
+<a name="L1219"></a><tt class="py-lineno">1219</tt>  <tt class="py-line">        <tt class="py-keyword">import</tt> <tt class="py-name">functools</tt> </tt>
+<a name="L1220"></a><tt class="py-lineno">1220</tt>  <tt class="py-line">        <tt class="py-name">flist</tt> <tt class="py-op">=</tt> <tt class="py-name">functools</tt><tt class="py-op">.</tt><tt class="py-name">reduce</tt><tt class="py-op">(</tt><tt class="py-name">operator</tt><tt class="py-op">.</tt><tt class="py-name">add</tt><tt class="py-op">,</tt><tt class="py-name">lst</tt><tt class="py-op">)</tt> </tt>
+<a name="L1221"></a><tt class="py-lineno">1221</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">flist</tt> </tt>
+</div><a name="L1222"></a><tt class="py-lineno">1222</tt>  <tt class="py-line"> </tt>
+<a name="L1223"></a><tt class="py-lineno">1223</tt>  <tt class="py-line"> </tt>
+<a name="Grib2Encode"></a><div id="Grib2Encode-def"><a name="L1224"></a><tt class="py-lineno">1224</tt> <a class="py-toggle" href="#" id="Grib2Encode-toggle" onclick="return toggle('Grib2Encode');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="ncepgrib2.Grib2Encode-class.html">Grib2Encode</a><tt class="py-op">:</tt> </tt>
+</div><div id="Grib2Encode-collapsed" style="display:none;" pad="++++" indent="++++"></div><div id="Grib2Encode-expanded"><a name="L1225"></a><tt class="py-lineno">1225</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
+<a name="L1226"></a><tt class="py-lineno">1226</tt>  <tt class="py-line"><tt class="py-docstring"> Class for encoding data into a GRIB2 message.</tt> </tt>
+<a name="L1227"></a><tt class="py-lineno">1227</tt>  <tt class="py-line"><tt class="py-docstring">  - Creating a class instance (L{__init__}) initializes the message and adds</tt> </tt>
+<a name="L1228"></a><tt class="py-lineno">1228</tt>  <tt class="py-line"><tt class="py-docstring">    sections 0 and 1 (the indicator and identification sections),</tt> </tt>
+<a name="L1229"></a><tt class="py-lineno">1229</tt>  <tt class="py-line"><tt class="py-docstring">  - method L{addgrid} adds a grid definition (section 3) to the messsage.</tt> </tt>
+<a name="L1230"></a><tt class="py-lineno">1230</tt>  <tt class="py-line"><tt class="py-docstring">  - method L{addfield} adds sections 4-7 to the message (the product</tt> </tt>
+<a name="L1231"></a><tt class="py-lineno">1231</tt>  <tt class="py-line"><tt class="py-docstring">    definition, data representation, bitmap and data sections).</tt> </tt>
+<a name="L1232"></a><tt class="py-lineno">1232</tt>  <tt class="py-line"><tt class="py-docstring">  - method L{end} adds the end section (section 8) and terminates the message.</tt> </tt>
+<a name="L1233"></a><tt class="py-lineno">1233</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1234"></a><tt class="py-lineno">1234</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1235"></a><tt class="py-lineno">1235</tt>  <tt class="py-line"><tt class="py-docstring"> A GRIB Edition 2 message is a machine independent format for storing</tt> </tt>
+<a name="L1236"></a><tt class="py-lineno">1236</tt>  <tt class="py-line"><tt class="py-docstring"> one or more gridded data fields.  Each GRIB2 message consists of the</tt> </tt>
+<a name="L1237"></a><tt class="py-lineno">1237</tt>  <tt class="py-line"><tt class="py-docstring"> following sections:</tt> </tt>
+<a name="L1238"></a><tt class="py-lineno">1238</tt>  <tt class="py-line"><tt class="py-docstring">  - SECTION 0: Indicator Section - only one per message</tt> </tt>
+<a name="L1239"></a><tt class="py-lineno">1239</tt>  <tt class="py-line"><tt class="py-docstring">  - SECTION 1: Identification Section - only one per message</tt> </tt>
+<a name="L1240"></a><tt class="py-lineno">1240</tt>  <tt class="py-line"><tt class="py-docstring">  - SECTION 2: (Local Use Section) - optional</tt> </tt>
+<a name="L1241"></a><tt class="py-lineno">1241</tt>  <tt class="py-line"><tt class="py-docstring">  - SECTION 3: Grid Definition Section</tt> </tt>
+<a name="L1242"></a><tt class="py-lineno">1242</tt>  <tt class="py-line"><tt class="py-docstring">  - SECTION 4: Product Definition Section</tt> </tt>
+<a name="L1243"></a><tt class="py-lineno">1243</tt>  <tt class="py-line"><tt class="py-docstring">  - SECTION 5: Data Representation Section</tt> </tt>
+<a name="L1244"></a><tt class="py-lineno">1244</tt>  <tt class="py-line"><tt class="py-docstring">  - SECTION 6: Bit-map Section</tt> </tt>
+<a name="L1245"></a><tt class="py-lineno">1245</tt>  <tt class="py-line"><tt class="py-docstring">  - SECTION 7: Data Section</tt> </tt>
+<a name="L1246"></a><tt class="py-lineno">1246</tt>  <tt class="py-line"><tt class="py-docstring">  - SECTION 8: End Section</tt> </tt>
+<a name="L1247"></a><tt class="py-lineno">1247</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1248"></a><tt class="py-lineno">1248</tt>  <tt class="py-line"><tt class="py-docstring"> Sequences of GRIB sections 2 to 7, 3 to 7, or sections 4 to 7 may be repeated</tt> </tt>
+<a name="L1249"></a><tt class="py-lineno">1249</tt>  <tt class="py-line"><tt class="py-docstring"> within a single GRIB message.  All sections within such repeated sequences</tt> </tt>
+<a name="L1250"></a><tt class="py-lineno">1250</tt>  <tt class="py-line"><tt class="py-docstring"> must be present and shall appear in the numerical order noted above.</tt> </tt>
+<a name="L1251"></a><tt class="py-lineno">1251</tt>  <tt class="py-line"><tt class="py-docstring"> Unrepeated sections remain in effect until redefined.</tt> </tt>
+<a name="L1252"></a><tt class="py-lineno">1252</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1253"></a><tt class="py-lineno">1253</tt>  <tt class="py-line"><tt class="py-docstring"> Note:  Writing section 2 (the 'local use section') is</tt> </tt>
+<a name="L1254"></a><tt class="py-lineno">1254</tt>  <tt class="py-line"><tt class="py-docstring"> not yet supported.</tt> </tt>
+<a name="L1255"></a><tt class="py-lineno">1255</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1256"></a><tt class="py-lineno">1256</tt>  <tt class="py-line"><tt class="py-docstring"> @ivar msg: A binary string containing the GRIB2 message.</tt> </tt>
+<a name="L1257"></a><tt class="py-lineno">1257</tt>  <tt class="py-line"><tt class="py-docstring"> After the message has been terminated by calling</tt> </tt>
+<a name="L1258"></a><tt class="py-lineno">1258</tt>  <tt class="py-line"><tt class="py-docstring"> the L{end} method, this string can be written to a file.</tt> </tt>
+<a name="L1259"></a><tt class="py-lineno">1259</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
+<a name="L1260"></a><tt class="py-lineno">1260</tt>  <tt class="py-line"> </tt>
+<a name="Grib2Encode.__init__"></a><div id="Grib2Encode.__init__-def"><a name="L1261"></a><tt class="py-lineno">1261</tt> <a class="py-toggle" href="#" id="Grib2Encode.__init__-toggle" onclick="return toggle('Grib2Encode.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2.Grib2Encode-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">discipline</t [...]
+</div><div id="Grib2Encode.__init__-collapsed" style="display:none;" pad="++++" indent="++++++++"></div><div id="Grib2Encode.__init__-expanded"><a name="L1262"></a><tt class="py-lineno">1262</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
+<a name="L1263"></a><tt class="py-lineno">1263</tt>  <tt class="py-line"><tt class="py-docstring"> create a Grib2Enecode class instance given the GRIB2 discipline</tt> </tt>
+<a name="L1264"></a><tt class="py-lineno">1264</tt>  <tt class="py-line"><tt class="py-docstring"> parameter and the identification section (sections 0 and 1).</tt> </tt>
+<a name="L1265"></a><tt class="py-lineno">1265</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1266"></a><tt class="py-lineno">1266</tt>  <tt class="py-line"><tt class="py-docstring"> The GRIB2 message is stored as a binary string in instance variable L{msg}.</tt> </tt>
+<a name="L1267"></a><tt class="py-lineno">1267</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1268"></a><tt class="py-lineno">1268</tt>  <tt class="py-line"><tt class="py-docstring"> L{addgrid}, L{addfield} and L{end} class methods must be called to complete</tt> </tt>
+<a name="L1269"></a><tt class="py-lineno">1269</tt>  <tt class="py-line"><tt class="py-docstring"> the GRIB2 message.</tt> </tt>
+<a name="L1270"></a><tt class="py-lineno">1270</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1271"></a><tt class="py-lineno">1271</tt>  <tt class="py-line"><tt class="py-docstring"> @param discipline:  Discipline or GRIB Master Table Number (Code Table 0.0).</tt> </tt>
+<a name="L1272"></a><tt class="py-lineno">1272</tt>  <tt class="py-line"><tt class="py-docstring"> (0 for meteorlogical, 1 for hydrological, 2 for land surface, 3 for space,</tt> </tt>
+<a name="L1273"></a><tt class="py-lineno">1273</tt>  <tt class="py-line"><tt class="py-docstring"> 10 for oceanographic products).</tt> </tt>
+<a name="L1274"></a><tt class="py-lineno">1274</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1275"></a><tt class="py-lineno">1275</tt>  <tt class="py-line"><tt class="py-docstring"> @param idsect:  Sequence containing identification section (section 1).</tt> </tt>
+<a name="L1276"></a><tt class="py-lineno">1276</tt>  <tt class="py-line"><tt class="py-docstring">  - idsect[0]=Id of orginating centre (Common Code</tt> </tt>
+<a name="L1277"></a><tt class="py-lineno">1277</tt>  <tt class="py-line"><tt class="py-docstring">    U{Table C-1<http://www.nws.noaa.gov/tg/GRIB_C1.htm>})</tt> </tt>
+<a name="L1278"></a><tt class="py-lineno">1278</tt>  <tt class="py-line"><tt class="py-docstring">  - idsect[1]=Id of orginating sub-centre (local table)</tt> </tt>
+<a name="L1279"></a><tt class="py-lineno">1279</tt>  <tt class="py-line"><tt class="py-docstring">  - idsect[2]=GRIB Master Tables Version Number (Code</tt> </tt>
+<a name="L1280"></a><tt class="py-lineno">1280</tt>  <tt class="py-line"><tt class="py-docstring">    U{Table 1.0</tt> </tt>
+<a name="L1281"></a><tt class="py-lineno">1281</tt>  <tt class="py-line"><tt class="py-docstring">    <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-0.shtml>})</tt> </tt>
+<a name="L1282"></a><tt class="py-lineno">1282</tt>  <tt class="py-line"><tt class="py-docstring">  - idsect[3]=GRIB Local Tables Version Number (Code</tt> </tt>
+<a name="L1283"></a><tt class="py-lineno">1283</tt>  <tt class="py-line"><tt class="py-docstring">    U{Table 1.1</tt> </tt>
+<a name="L1284"></a><tt class="py-lineno">1284</tt>  <tt class="py-line"><tt class="py-docstring">    <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-1.shtml>})</tt> </tt>
+<a name="L1285"></a><tt class="py-lineno">1285</tt>  <tt class="py-line"><tt class="py-docstring">  - idsect[4]=Significance of Reference Time (Code</tt> </tt>
+<a name="L1286"></a><tt class="py-lineno">1286</tt>  <tt class="py-line"><tt class="py-docstring">    U{Table 1.2</tt> </tt>
+<a name="L1287"></a><tt class="py-lineno">1287</tt>  <tt class="py-line"><tt class="py-docstring">    <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-2.shtml>})</tt> </tt>
+<a name="L1288"></a><tt class="py-lineno">1288</tt>  <tt class="py-line"><tt class="py-docstring">  - idsect[5]=Reference Time - Year (4 digits)</tt> </tt>
+<a name="L1289"></a><tt class="py-lineno">1289</tt>  <tt class="py-line"><tt class="py-docstring">  - idsect[6]=Reference Time - Month</tt> </tt>
+<a name="L1290"></a><tt class="py-lineno">1290</tt>  <tt class="py-line"><tt class="py-docstring">  - idsect[7]=Reference Time - Day</tt> </tt>
+<a name="L1291"></a><tt class="py-lineno">1291</tt>  <tt class="py-line"><tt class="py-docstring">  - idsect[8]=Reference Time - Hour</tt> </tt>
+<a name="L1292"></a><tt class="py-lineno">1292</tt>  <tt class="py-line"><tt class="py-docstring">  - idsect[9]=Reference Time - Minute</tt> </tt>
+<a name="L1293"></a><tt class="py-lineno">1293</tt>  <tt class="py-line"><tt class="py-docstring">  - idsect[10]=Reference Time - Second</tt> </tt>
+<a name="L1294"></a><tt class="py-lineno">1294</tt>  <tt class="py-line"><tt class="py-docstring">  - idsect[11]=Production status of data (Code</tt> </tt>
+<a name="L1295"></a><tt class="py-lineno">1295</tt>  <tt class="py-line"><tt class="py-docstring">    U{Table 1.3</tt> </tt>
+<a name="L1296"></a><tt class="py-lineno">1296</tt>  <tt class="py-line"><tt class="py-docstring">    <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-3.shtml>})</tt> </tt>
+<a name="L1297"></a><tt class="py-lineno">1297</tt>  <tt class="py-line"><tt class="py-docstring">  - idsect[12]=Type of processed data (Code</tt> </tt>
+<a name="L1298"></a><tt class="py-lineno">1298</tt>  <tt class="py-line"><tt class="py-docstring">    U{Table</tt> </tt>
+<a name="L1299"></a><tt class="py-lineno">1299</tt>  <tt class="py-line"><tt class="py-docstring">    1.4<http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-4.shtml>})</tt> </tt>
+<a name="L1300"></a><tt class="py-lineno">1300</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
+<a name="L1301"></a><tt class="py-lineno">1301</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">msg</tt><tt class="py-op">,</tt><tt class="py-name">msglen</tt><tt class="py-op">=</tt><tt class="py-name">g2clib</tt><tt class="py-op">.</tt><tt class="py-name">grib2_create</tt><tt class="py-op">(</tt><tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">array</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt cl [...]
+</div><a name="L1302"></a><tt class="py-lineno">1302</tt>  <tt class="py-line"> </tt>
+<a name="Grib2Encode.addgrid"></a><div id="Grib2Encode.addgrid-def"><a name="L1303"></a><tt class="py-lineno">1303</tt> <a class="py-toggle" href="#" id="Grib2Encode.addgrid-toggle" onclick="return toggle('Grib2Encode.addgrid');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2.Grib2Encode-class.html#addgrid">addgrid</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">gdsinfo</tt><tt clas [...]
+</div><div id="Grib2Encode.addgrid-collapsed" style="display:none;" pad="++++" indent="++++++++"></div><div id="Grib2Encode.addgrid-expanded"><a name="L1304"></a><tt class="py-lineno">1304</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
+<a name="L1305"></a><tt class="py-lineno">1305</tt>  <tt class="py-line"><tt class="py-docstring"> Add a grid definition section (section 3) to the GRIB2 message.</tt> </tt>
+<a name="L1306"></a><tt class="py-lineno">1306</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1307"></a><tt class="py-lineno">1307</tt>  <tt class="py-line"><tt class="py-docstring"> @param gdsinfo: Sequence containing information needed for the grid definition section.</tt> </tt>
+<a name="L1308"></a><tt class="py-lineno">1308</tt>  <tt class="py-line"><tt class="py-docstring">  - gdsinfo[0] = Source of grid definition (see Code</tt> </tt>
+<a name="L1309"></a><tt class="py-lineno">1309</tt>  <tt class="py-line"><tt class="py-docstring">    U{Table 3.0</tt> </tt>
+<a name="L1310"></a><tt class="py-lineno">1310</tt>  <tt class="py-line"><tt class="py-docstring">    <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-0.shtml>})</tt> </tt>
+<a name="L1311"></a><tt class="py-lineno">1311</tt>  <tt class="py-line"><tt class="py-docstring">  - gdsinfo[1] = Number of grid points in the defined grid.</tt> </tt>
+<a name="L1312"></a><tt class="py-lineno">1312</tt>  <tt class="py-line"><tt class="py-docstring">  - gdsinfo[2] = Number of octets needed for each additional grid points defn.</tt> </tt>
+<a name="L1313"></a><tt class="py-lineno">1313</tt>  <tt class="py-line"><tt class="py-docstring">    Used to define number of points in each row for non-reg grids (=0 for</tt> </tt>
+<a name="L1314"></a><tt class="py-lineno">1314</tt>  <tt class="py-line"><tt class="py-docstring">    regular grid).</tt> </tt>
+<a name="L1315"></a><tt class="py-lineno">1315</tt>  <tt class="py-line"><tt class="py-docstring">  - gdsinfo[3] = Interp. of list for optional points defn (Code</tt> </tt>
+<a name="L1316"></a><tt class="py-lineno">1316</tt>  <tt class="py-line"><tt class="py-docstring">    U{Table 3.11</tt> </tt>
+<a name="L1317"></a><tt class="py-lineno">1317</tt>  <tt class="py-line"><tt class="py-docstring">    <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-11.shtml>})</tt> </tt>
+<a name="L1318"></a><tt class="py-lineno">1318</tt>  <tt class="py-line"><tt class="py-docstring">  - gdsinfo[4] = Grid Definition Template Number (Code</tt> </tt>
+<a name="L1319"></a><tt class="py-lineno">1319</tt>  <tt class="py-line"><tt class="py-docstring">    U{Table 3.1</tt> </tt>
+<a name="L1320"></a><tt class="py-lineno">1320</tt>  <tt class="py-line"><tt class="py-docstring">    <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-1.shtml>})</tt> </tt>
+<a name="L1321"></a><tt class="py-lineno">1321</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1322"></a><tt class="py-lineno">1322</tt>  <tt class="py-line"><tt class="py-docstring"> @param gdtmpl: Contains the data values for the specified Grid Definition</tt> </tt>
+<a name="L1323"></a><tt class="py-lineno">1323</tt>  <tt class="py-line"><tt class="py-docstring"> Template ( NN=gdsinfo[4] ).  Each element of this integer</tt> </tt>
+<a name="L1324"></a><tt class="py-lineno">1324</tt>  <tt class="py-line"><tt class="py-docstring"> array contains an entry (in the order specified) of Grid</tt> </tt>
+<a name="L1325"></a><tt class="py-lineno">1325</tt>  <tt class="py-line"><tt class="py-docstring"> Definition Template 3.NN</tt> </tt>
+<a name="L1326"></a><tt class="py-lineno">1326</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1327"></a><tt class="py-lineno">1327</tt>  <tt class="py-line"><tt class="py-docstring"> @param deflist: (Used if gdsinfo[2] != 0)  Sequence containing the</tt> </tt>
+<a name="L1328"></a><tt class="py-lineno">1328</tt>  <tt class="py-line"><tt class="py-docstring"> number of grid points contained in each row (or column)</tt> </tt>
+<a name="L1329"></a><tt class="py-lineno">1329</tt>  <tt class="py-line"><tt class="py-docstring"> of a non-regular grid.</tt> </tt>
+<a name="L1330"></a><tt class="py-lineno">1330</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
+<a name="L1331"></a><tt class="py-lineno">1331</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">deflist</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
+<a name="L1332"></a><tt class="py-lineno">1332</tt>  <tt class="py-line">            <tt class="py-name">dflist</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">array</tt><tt class="py-op">(</tt><tt class="py-name">deflist</tt><tt class="py-op">,</tt><tt class="py-string">'i'</tt><tt class="py-op">)</tt> </tt>
+<a name="L1333"></a><tt class="py-lineno">1333</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L1334"></a><tt class="py-lineno">1334</tt>  <tt class="py-line">            <tt class="py-name">dflist</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
+<a name="L1335"></a><tt class="py-lineno">1335</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
+<a name="L1336"></a><tt class="py-lineno">1336</tt>  <tt class="py-line">        <tt class="py-name">gdtnum</tt> <tt class="py-op">=</tt> <tt class="py-name">gdsinfo</tt><tt class="py-op">[</tt><tt class="py-number">4</tt><tt class="py-op">]</tt> </tt>
+<a name="L1337"></a><tt class="py-lineno">1337</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">gdtnum</tt> <tt class="py-keyword">in</tt> <tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">,</tt><tt class="py-number">1</tt><tt class="py-op">,</tt><tt class="py-number">2</tt><tt class="py-op">,</tt><tt class="py-number">3</tt><tt class="py-op">,</tt><tt class="py-number">40</tt><tt class="py-op">,</tt><tt class="py-number">41</tt><tt [...]
+<a name="L1338"></a><tt class="py-lineno">1338</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">18</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</ [...]
+<a name="L1339"></a><tt class="py-lineno">1339</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">10</tt><tt class="py-op">:</tt> <tt class="py-comment"># mercator</tt> </tt>
+<a name="L1340"></a><tt class="py-lineno">1340</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">15</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</ [...]
+<a name="L1341"></a><tt class="py-lineno">1341</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">20</tt><tt class="py-op">:</tt> <tt class="py-comment"># stereographic</tt> </tt>
+<a name="L1342"></a><tt class="py-lineno">1342</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">17</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</ [...]
+<a name="L1343"></a><tt class="py-lineno">1343</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">30</tt><tt class="py-op">:</tt> <tt class="py-comment"># lambert conformal</tt> </tt>
+<a name="L1344"></a><tt class="py-lineno">1344</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">17</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</ [...]
+<a name="L1345"></a><tt class="py-lineno">1345</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">31</tt><tt class="py-op">:</tt> <tt class="py-comment"># albers equal area.</tt> </tt>
+<a name="L1346"></a><tt class="py-lineno">1346</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">17</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</ [...]
+<a name="L1347"></a><tt class="py-lineno">1347</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">90</tt><tt class="py-op">:</tt> <tt class="py-comment"># near-sided vertical perspective satellite projection</tt> </tt>
+<a name="L1348"></a><tt class="py-lineno">1348</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">16</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</ [...]
+<a name="L1349"></a><tt class="py-lineno">1349</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">110</tt><tt class="py-op">:</tt> <tt class="py-comment"># azimuthal equidistant.</tt> </tt>
+<a name="L1350"></a><tt class="py-lineno">1350</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">15</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</ [...]
+<a name="L1351"></a><tt class="py-lineno">1351</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">120</tt><tt class="py-op">:</tt> </tt>
+<a name="L1352"></a><tt class="py-lineno">1352</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">6</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</t [...]
+<a name="L1353"></a><tt class="py-lineno">1353</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-op">==</tt> <tt class="py-number">204</tt><tt class="py-op">:</tt> <tt class="py-comment"># curvilinear orthogonal</tt> </tt>
+<a name="L1354"></a><tt class="py-lineno">1354</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">18</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</ [...]
+<a name="L1355"></a><tt class="py-lineno">1355</tt>  <tt class="py-line">        <tt class="py-keyword">elif</tt> <tt class="py-name">gdtnum</tt> <tt class="py-keyword">in</tt> <tt class="py-op">[</tt><tt class="py-number">1000</tt><tt class="py-op">,</tt><tt class="py-number">1100</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L1356"></a><tt class="py-lineno">1356</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-op">=</tt> <tt class="py-name">_dec2bin</tt><tt class="py-op">(</tt><tt class="py-name">gdtmpl</tt><tt class="py-op">[</tt><tt class="py-number">12</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">:</tt><tt class="py-number">4</ [...]
+<a name="L1357"></a><tt class="py-lineno">1357</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">msg</tt><tt class="py-op">,</tt><tt class="py-name">msglen</tt><tt class="py-op">=</tt><tt class="py-name">g2clib</tt><tt class="py-op">.</tt><tt class="py-name">grib2_addgrid</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">msg</tt><tt class="py-op">,</tt><tt class="py-name">np</tt><t [...]
+</div><a name="L1358"></a><tt class="py-lineno">1358</tt>  <tt class="py-line"> </tt>
+<a name="Grib2Encode.addfield"></a><div id="Grib2Encode.addfield-def"><a name="L1359"></a><tt class="py-lineno">1359</tt> <a class="py-toggle" href="#" id="Grib2Encode.addfield-toggle" onclick="return toggle('Grib2Encode.addfield');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2.Grib2Encode-class.html#addfield">addfield</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">pdtnum</tt><tt [...]
+</div><div id="Grib2Encode.addfield-collapsed" style="display:none;" pad="++++" indent="++++++++"></div><div id="Grib2Encode.addfield-expanded"><a name="L1360"></a><tt class="py-lineno">1360</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
+<a name="L1361"></a><tt class="py-lineno">1361</tt>  <tt class="py-line"><tt class="py-docstring"> Add a product definition section, data representation section,</tt> </tt>
+<a name="L1362"></a><tt class="py-lineno">1362</tt>  <tt class="py-line"><tt class="py-docstring"> bitmap section and data section to the GRIB2 message (sections 4-7).</tt> </tt>
+<a name="L1363"></a><tt class="py-lineno">1363</tt>  <tt class="py-line"><tt class="py-docstring"> Must be called after grid definition section is created with L{addgrid}.</tt> </tt>
+<a name="L1364"></a><tt class="py-lineno">1364</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1365"></a><tt class="py-lineno">1365</tt>  <tt class="py-line"><tt class="py-docstring"> @param pdtnum: Product Definition Template Number (see Code U{Table</tt> </tt>
+<a name="L1366"></a><tt class="py-lineno">1366</tt>  <tt class="py-line"><tt class="py-docstring"> 4.0<http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table4-0.shtml>})</tt> </tt>
+<a name="L1367"></a><tt class="py-lineno">1367</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1368"></a><tt class="py-lineno">1368</tt>  <tt class="py-line"><tt class="py-docstring"> @param pdtmpl: Sequence with the data values for the specified Product Definition</tt> </tt>
+<a name="L1369"></a><tt class="py-lineno">1369</tt>  <tt class="py-line"><tt class="py-docstring"> Template (N=pdtnum).  Each element of this integer</tt> </tt>
+<a name="L1370"></a><tt class="py-lineno">1370</tt>  <tt class="py-line"><tt class="py-docstring"> array contains an entry (in the order specified) of Product</tt> </tt>
+<a name="L1371"></a><tt class="py-lineno">1371</tt>  <tt class="py-line"><tt class="py-docstring"> Definition Template 4.N</tt> </tt>
+<a name="L1372"></a><tt class="py-lineno">1372</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1373"></a><tt class="py-lineno">1373</tt>  <tt class="py-line"><tt class="py-docstring"> @param drtnum: Data Representation Template Number (see Code</tt> </tt>
+<a name="L1374"></a><tt class="py-lineno">1374</tt>  <tt class="py-line"><tt class="py-docstring"> U{Table 5.0</tt> </tt>
+<a name="L1375"></a><tt class="py-lineno">1375</tt>  <tt class="py-line"><tt class="py-docstring"> <http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table5-0.shtml>})</tt> </tt>
+<a name="L1376"></a><tt class="py-lineno">1376</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1377"></a><tt class="py-lineno">1377</tt>  <tt class="py-line"><tt class="py-docstring"> @param drtmpl: Sequence with the data values for the specified Data Representation</tt> </tt>
+<a name="L1378"></a><tt class="py-lineno">1378</tt>  <tt class="py-line"><tt class="py-docstring"> Template (N=drtnum).  Each element of this integer</tt> </tt>
+<a name="L1379"></a><tt class="py-lineno">1379</tt>  <tt class="py-line"><tt class="py-docstring"> array contains an entry (in the order specified) of Data</tt> </tt>
+<a name="L1380"></a><tt class="py-lineno">1380</tt>  <tt class="py-line"><tt class="py-docstring"> Representation Template 5.N</tt> </tt>
+<a name="L1381"></a><tt class="py-lineno">1381</tt>  <tt class="py-line"><tt class="py-docstring"> Note that some values in this template (eg. reference</tt> </tt>
+<a name="L1382"></a><tt class="py-lineno">1382</tt>  <tt class="py-line"><tt class="py-docstring"> values, number of bits, etc...) may be changed by the</tt> </tt>
+<a name="L1383"></a><tt class="py-lineno">1383</tt>  <tt class="py-line"><tt class="py-docstring"> data packing algorithms.</tt> </tt>
+<a name="L1384"></a><tt class="py-lineno">1384</tt>  <tt class="py-line"><tt class="py-docstring"> Use this to specify scaling factors and order of</tt> </tt>
+<a name="L1385"></a><tt class="py-lineno">1385</tt>  <tt class="py-line"><tt class="py-docstring"> spatial differencing, if desired.</tt> </tt>
+<a name="L1386"></a><tt class="py-lineno">1386</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1387"></a><tt class="py-lineno">1387</tt>  <tt class="py-line"><tt class="py-docstring"> @param field:  numpy array of data points to pack.</tt> </tt>
+<a name="L1388"></a><tt class="py-lineno">1388</tt>  <tt class="py-line"><tt class="py-docstring"> If field is a masked array, then a bitmap is created from</tt> </tt>
+<a name="L1389"></a><tt class="py-lineno">1389</tt>  <tt class="py-line"><tt class="py-docstring"> the mask.</tt> </tt>
+<a name="L1390"></a><tt class="py-lineno">1390</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
+<a name="L1391"></a><tt class="py-lineno">1391</tt>  <tt class="py-line"><tt class="py-docstring"> @param coordlist: Sequence containing floating point values intended to document</tt> </tt>
+<a name="L1392"></a><tt class="py-lineno">1392</tt>  <tt class="py-line"><tt class="py-docstring"> the vertical discretization with model data</tt> </tt>
+<a name="L1393"></a><tt class="py-lineno">1393</tt>  <tt class="py-line"><tt class="py-docstring"> on hybrid coordinate vertical levels. Default None.</tt> </tt>
+<a name="L1394"></a><tt class="py-lineno">1394</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
+<a name="L1395"></a><tt class="py-lineno">1395</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt><tt class="py-string">'scanmodeflags'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L1396"></a><tt class="py-lineno">1396</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'addgrid must be called before addfield'</tt><tt class="py-op">)</tt> </tt>
+<a name="L1397"></a><tt class="py-lineno">1397</tt>  <tt class="py-line">        <tt class="py-comment"># reorder array to be consistent with</tt> </tt>
+<a name="L1398"></a><tt class="py-lineno">1398</tt>  <tt class="py-line">        <tt class="py-comment"># specified scan order.</tt> </tt>
+<a name="L1399"></a><tt class="py-lineno">1399</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
+<a name="L1400"></a><tt class="py-lineno">1400</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L1401"></a><tt class="py-lineno">1401</tt>  <tt class="py-line">            <tt class="py-comment"># rows scan in the -x direction (so flip)</tt> </tt>
+<a name="L1402"></a><tt class="py-lineno">1402</tt>  <tt class="py-line">                <tt class="py-name">fieldsave</tt> <tt class="py-op">=</tt> <tt class="py-name">field</tt><tt class="py-op">.</tt><tt class="py-name">astype</tt><tt class="py-op">(</tt><tt class="py-string">'f'</tt><tt class="py-op">)</tt> <tt class="py-comment"># casting makes a copy</tt> </tt>
+<a name="L1403"></a><tt class="py-lineno">1403</tt>  <tt class="py-line">                <tt class="py-name">field</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">,</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">fieldsave</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">,</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</ [...]
+<a name="L1404"></a><tt class="py-lineno">1404</tt>  <tt class="py-line">            <tt class="py-comment"># columns scan in the -y direction (so flip)</tt> </tt>
+<a name="L1405"></a><tt class="py-lineno">1405</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L1406"></a><tt class="py-lineno">1406</tt>  <tt class="py-line">                <tt class="py-name">fieldsave</tt> <tt class="py-op">=</tt> <tt class="py-name">field</tt><tt class="py-op">.</tt><tt class="py-name">astype</tt><tt class="py-op">(</tt><tt class="py-string">'f'</tt><tt class="py-op">)</tt> <tt class="py-comment"># casting makes a copy</tt> </tt>
+<a name="L1407"></a><tt class="py-lineno">1407</tt>  <tt class="py-line">                <tt class="py-name">field</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">,</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">fieldsave</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">,</tt><tt class="py-op">:</tt><tt class="py-op">]</ [...]
+<a name="L1408"></a><tt class="py-lineno">1408</tt>  <tt class="py-line">            <tt class="py-comment"># adjacent rows scan in opposite direction.</tt> </tt>
+<a name="L1409"></a><tt class="py-lineno">1409</tt>  <tt class="py-line">            <tt class="py-comment"># (flip every other row)</tt> </tt>
+<a name="L1410"></a><tt class="py-lineno">1410</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">scanmodeflags</tt><tt class="py-op">[</tt><tt class="py-number">3</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
+<a name="L1411"></a><tt class="py-lineno">1411</tt>  <tt class="py-line">                <tt class="py-name">fieldsave</tt> <tt class="py-op">=</tt> <tt class="py-name">field</tt><tt class="py-op">.</tt><tt class="py-name">astype</tt><tt class="py-op">(</tt><tt class="py-string">'f'</tt><tt class="py-op">)</tt> <tt class="py-comment"># casting makes a copy</tt> </tt>
+<a name="L1412"></a><tt class="py-lineno">1412</tt>  <tt class="py-line">                <tt class="py-name">field</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py-number">2</tt><tt class="py-op">,</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">fieldsave</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">:</tt><tt class="py [...]
+<a name="L1413"></a><tt class="py-lineno">1413</tt>  <tt class="py-line">        <tt class="py-name">fld</tt> <tt class="py-op">=</tt> <tt class="py-name">field</tt><tt class="py-op">.</tt><tt class="py-name">astype</tt><tt class="py-op">(</tt><tt class="py-string">'f'</tt><tt class="py-op">)</tt> </tt>
+<a name="L1414"></a><tt class="py-lineno">1414</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">ma</tt><tt class="py-op">.</tt><tt class="py-name">isMA</tt><tt class="py-op">(</tt><tt class="py-name">field</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+<a name="L1415"></a><tt class="py-lineno">1415</tt>  <tt class="py-line">            <tt class="py-name">bmap</tt> <tt class="py-op">=</tt> <tt class="py-number">1</tt> <tt class="py-op">-</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">ravel</tt><tt class="py-op">(</tt><tt class="py-name">field</tt><tt class="py-op">.</tt><tt class="py-name">mask</tt><tt class="py-op">.</tt><tt class="py-name">astype</tt><tt class="py-op">(</tt><tt class="py-string">'i'</tt>< [...]
+<a name="L1416"></a><tt class="py-lineno">1416</tt>  <tt class="py-line">            <tt class="py-name">bitmapflag</tt>  <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
+<a name="L1417"></a><tt class="py-lineno">1417</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L1418"></a><tt class="py-lineno">1418</tt>  <tt class="py-line">            <tt class="py-name">bitmapflag</tt> <tt class="py-op">=</tt> <tt class="py-number">255</tt> </tt>
+<a name="L1419"></a><tt class="py-lineno">1419</tt>  <tt class="py-line">            <tt class="py-name">bmap</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
+<a name="L1420"></a><tt class="py-lineno">1420</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">coordlist</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
+<a name="L1421"></a><tt class="py-lineno">1421</tt>  <tt class="py-line">            <tt class="py-name">crdlist</tt> <tt class="py-op">=</tt> <tt class="py-name">np</tt><tt class="py-op">.</tt><tt class="py-name">array</tt><tt class="py-op">(</tt><tt class="py-name">coordlist</tt><tt class="py-op">,</tt><tt class="py-string">'f'</tt><tt class="py-op">)</tt> </tt>
+<a name="L1422"></a><tt class="py-lineno">1422</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
+<a name="L1423"></a><tt class="py-lineno">1423</tt>  <tt class="py-line">            <tt class="py-name">crdlist</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
+<a name="L1424"></a><tt class="py-lineno">1424</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">msg</tt><tt class="py-op">,</tt><tt class="py-name">msglen</tt><tt class="py-op">=</tt><tt class="py-name">g2clib</tt><tt class="py-op">.</tt><tt class="py-name">grib2_addfield</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">msg</tt><tt class="py-op">,</tt><tt class="py-name">pdtnum</ [...]
+</div><a name="L1425"></a><tt class="py-lineno">1425</tt>  <tt class="py-line"> </tt>
+<a name="Grib2Encode.end"></a><div id="Grib2Encode.end-def"><a name="L1426"></a><tt class="py-lineno">1426</tt> <a class="py-toggle" href="#" id="Grib2Encode.end-toggle" onclick="return toggle('Grib2Encode.end');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="ncepgrib2.Grib2Encode-class.html#end">end</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
+</div><div id="Grib2Encode.end-collapsed" style="display:none;" pad="++++" indent="++++++++"></div><div id="Grib2Encode.end-expanded"><a name="L1427"></a><tt class="py-lineno">1427</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
+<a name="L1428"></a><tt class="py-lineno">1428</tt>  <tt class="py-line"><tt class="py-docstring"> Add an end section (section 8) to the GRIB2 message.</tt> </tt>
+<a name="L1429"></a><tt class="py-lineno">1429</tt>  <tt class="py-line"><tt class="py-docstring"> A GRIB2 message is not complete without an end section.</tt> </tt>
+<a name="L1430"></a><tt class="py-lineno">1430</tt>  <tt class="py-line"><tt class="py-docstring"> Once an end section is added, the GRIB2 message can be</tt> </tt>
+<a name="L1431"></a><tt class="py-lineno">1431</tt>  <tt class="py-line"><tt class="py-docstring"> output to a file.</tt> </tt>
+<a name="L1432"></a><tt class="py-lineno">1432</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
+<a name="L1433"></a><tt class="py-lineno">1433</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">msg</tt><tt class="py-op">,</tt><tt class="py-name">msglen</tt><tt class="py-op">=</tt><tt class="py-name">g2clib</tt><tt class="py-op">.</tt><tt class="py-name">grib2_end</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">msg</tt><tt class="py-op">)</tt> </tt>
+</div></div><a name="L1434"></a><tt class="py-lineno">1434</tt>  <tt class="py-line"> </tt><script type="text/javascript">
+<!--
+expandto(location.href);
+// -->
+</script>
+</pre>
+<br />
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th bgcolor="#70b0f0" class="navbar-select"
+          >   Home   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1
+    on Wed Nov 20 14:10:14 2013
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/ncepgrib2_docs/ncepgrib2.Grib2Encode-class.html b/ncepgrib2_docs/ncepgrib2.Grib2Encode-class.html
new file mode 100644
index 0000000..4f7b9dc
--- /dev/null
+++ b/ncepgrib2_docs/ncepgrib2.Grib2Encode-class.html
@@ -0,0 +1,527 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>ncepgrib2.Grib2Encode</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="ncepgrib2-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%">
+      <span class="breadcrumbs">
+        <a href="ncepgrib2-module.html">Module ncepgrib2</a> ::
+        Class Grib2Encode
+      </span>
+    </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<!-- ==================== CLASS DESCRIPTION ==================== -->
+<h1 class="epydoc">Class Grib2Encode</h1><p class="nomargin-top"><span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Encode">source code</a></span></p>
+<p>Class for encoding data into a GRIB2 message.</p>
+  <ul>
+    <li>
+      Creating a class instance (<a 
+      href="ncepgrib2.Grib2Encode-class.html#__init__" 
+      class="link">__init__</a>) initializes the message and adds sections 
+      0 and 1 (the indicator and identification sections),
+    </li>
+    <li>
+      method <a href="ncepgrib2.Grib2Encode-class.html#addgrid" 
+      class="link">addgrid</a> adds a grid definition (section 3) to the 
+      messsage.
+    </li>
+    <li>
+      method <a href="ncepgrib2.Grib2Encode-class.html#addfield" 
+      class="link">addfield</a> adds sections 4-7 to the message (the 
+      product definition, data representation, bitmap and data sections).
+    </li>
+    <li>
+      method <a href="ncepgrib2.Grib2Encode-class.html#end" 
+      class="link">end</a> adds the end section (section 8) and terminates 
+      the message.
+    </li>
+  </ul>
+  <p>A GRIB Edition 2 message is a machine independent format for storing 
+  one or more gridded data fields.  Each GRIB2 message consists of the 
+  following sections:</p>
+  <ul>
+    <li>
+      SECTION 0: Indicator Section - only one per message
+    </li>
+    <li>
+      SECTION 1: Identification Section - only one per message
+    </li>
+    <li>
+      SECTION 2: (Local Use Section) - optional
+    </li>
+    <li>
+      SECTION 3: Grid Definition Section
+    </li>
+    <li>
+      SECTION 4: Product Definition Section
+    </li>
+    <li>
+      SECTION 5: Data Representation Section
+    </li>
+    <li>
+      SECTION 6: Bit-map Section
+    </li>
+    <li>
+      SECTION 7: Data Section
+    </li>
+    <li>
+      SECTION 8: End Section
+    </li>
+  </ul>
+  <p>Sequences of GRIB sections 2 to 7, 3 to 7, or sections 4 to 7 may be 
+  repeated within a single GRIB message.  All sections within such repeated
+  sequences must be present and shall appear in the numerical order noted 
+  above. Unrepeated sections remain in effect until redefined.</p>
+  <p>Note:  Writing section 2 (the 'local use section') is not yet 
+  supported.</p>
+
+<!-- ==================== INSTANCE METHODS ==================== -->
+<a name="section-InstanceMethods"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Instance Methods</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="ncepgrib2.Grib2Encode-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
+        <span class="summary-sig-arg">discipline</span>,
+        <span class="summary-sig-arg">idsect</span>)</span><br />
+      create a Grib2Enecode class instance given the GRIB2 discipline 
+      parameter and the identification section (sections 0 and 1).</td>
+          <td align="right" valign="top">
+            <span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Encode.__init__">source code</a></span>
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="ncepgrib2.Grib2Encode-class.html#addfield" class="summary-sig-name">addfield</a>(<span class="summary-sig-arg">self</span>,
+        <span class="summary-sig-arg">pdtnum</span>,
+        <span class="summary-sig-arg">pdtmpl</span>,
+        <span class="summary-sig-arg">drtnum</span>,
+        <span class="summary-sig-arg">drtmpl</span>,
+        <span class="summary-sig-arg">field</span>,
+        <span class="summary-sig-arg">coordlist</span>=<span class="summary-sig-default">None</span>)</span><br />
+      Add a product definition section, data representation section, bitmap
+      section and data section to the GRIB2 message (sections 4-7).</td>
+          <td align="right" valign="top">
+            <span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Encode.addfield">source code</a></span>
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="ncepgrib2.Grib2Encode-class.html#addgrid" class="summary-sig-name">addgrid</a>(<span class="summary-sig-arg">self</span>,
+        <span class="summary-sig-arg">gdsinfo</span>,
+        <span class="summary-sig-arg">gdtmpl</span>,
+        <span class="summary-sig-arg">deflist</span>=<span class="summary-sig-default">None</span>)</span><br />
+      Add a grid definition section (section 3) to the GRIB2 message.</td>
+          <td align="right" valign="top">
+            <span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Encode.addgrid">source code</a></span>
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="ncepgrib2.Grib2Encode-class.html#end" class="summary-sig-name">end</a>(<span class="summary-sig-arg">self</span>)</span><br />
+      Add an end section (section 8) to the GRIB2 message.</td>
+          <td align="right" valign="top">
+            <span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Encode.end">source code</a></span>
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+</table>
+<!-- ==================== INSTANCE VARIABLES ==================== -->
+<a name="section-InstanceVariables"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Instance Variables</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="ncepgrib2.Grib2Encode-class.html#msg" class="summary-name">msg</a><br />
+      A binary string containing the GRIB2 message.
+    </td>
+  </tr>
+</table>
+<!-- ==================== METHOD DETAILS ==================== -->
+<a name="section-MethodDetails"></a>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Method Details</span></td>
+</tr>
+</table>
+<a name="__init__"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
+        <span class="sig-arg">discipline</span>,
+        <span class="sig-arg">idsect</span>)</span>
+    <br /><em class="fname">(Constructor)</em>
+  </h3>
+  </td><td align="right" valign="top"
+    ><span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Encode.__init__">source code</a></span> 
+    </td>
+  </tr></table>
+  
+  <p>create a Grib2Enecode class instance given the GRIB2 discipline 
+  parameter and the identification section (sections 0 and 1).</p>
+  <p>The GRIB2 message is stored as a binary string in instance variable <a
+  href="ncepgrib2.Grib2Encode-class.html#msg" class="link">msg</a>.</p>
+  <p><a href="ncepgrib2.Grib2Encode-class.html#addgrid" 
+  class="link">addgrid</a>, <a 
+  href="ncepgrib2.Grib2Encode-class.html#addfield" 
+  class="link">addfield</a> and <a 
+  href="ncepgrib2.Grib2Encode-class.html#end" class="link">end</a> class 
+  methods must be called to complete the GRIB2 message.</p>
+  <dl class="fields">
+    <dt>Parameters:</dt>
+    <dd><ul class="nomargin-top">
+        <li><strong class="pname"><code>discipline</code></strong> - Discipline or GRIB Master Table Number (Code Table 0.0). (0 for 
+          meteorlogical, 1 for hydrological, 2 for land surface, 3 for 
+          space, 10 for oceanographic products).</li>
+        <li><strong class="pname"><code>idsect</code></strong> - Sequence containing identification section (section 1).
+          <ul>
+            <li>
+              idsect[0]=Id of orginating centre (Common Code <a 
+              href="http://www.nws.noaa.gov/tg/GRIB_C1.htm" 
+              target="_top">Table C-1</a>)
+            </li>
+            <li>
+              idsect[1]=Id of orginating sub-centre (local table)
+            </li>
+            <li>
+              idsect[2]=GRIB Master Tables Version Number (Code <a 
+              href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-0.shtml"
+              target="_top">Table 1.0</a>)
+            </li>
+            <li>
+              idsect[3]=GRIB Local Tables Version Number (Code <a 
+              href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-1.shtml"
+              target="_top">Table 1.1</a>)
+            </li>
+            <li>
+              idsect[4]=Significance of Reference Time (Code <a 
+              href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-2.shtml"
+              target="_top">Table 1.2</a>)
+            </li>
+            <li>
+              idsect[5]=Reference Time - Year (4 digits)
+            </li>
+            <li>
+              idsect[6]=Reference Time - Month
+            </li>
+            <li>
+              idsect[7]=Reference Time - Day
+            </li>
+            <li>
+              idsect[8]=Reference Time - Hour
+            </li>
+            <li>
+              idsect[9]=Reference Time - Minute
+            </li>
+            <li>
+              idsect[10]=Reference Time - Second
+            </li>
+            <li>
+              idsect[11]=Production status of data (Code <a 
+              href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-3.shtml"
+              target="_top">Table 1.3</a>)
+            </li>
+            <li>
+              idsect[12]=Type of processed data (Code <a 
+              href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table1-4.shtml"
+              target="_top">Table 1.4</a>)
+            </li>
+          </ul></li>
+    </ul></dd>
+  </dl>
+</td></tr></table>
+</div>
+<a name="addfield"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">addfield</span>(<span class="sig-arg">self</span>,
+        <span class="sig-arg">pdtnum</span>,
+        <span class="sig-arg">pdtmpl</span>,
+        <span class="sig-arg">drtnum</span>,
+        <span class="sig-arg">drtmpl</span>,
+        <span class="sig-arg">field</span>,
+        <span class="sig-arg">coordlist</span>=<span class="sig-default">None</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    ><span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Encode.addfield">source code</a></span> 
+    </td>
+  </tr></table>
+  
+  <p>Add a product definition section, data representation section, bitmap 
+  section and data section to the GRIB2 message (sections 4-7). Must be 
+  called after grid definition section is created with <a 
+  href="ncepgrib2.Grib2Encode-class.html#addgrid" 
+  class="link">addgrid</a>.</p>
+  <dl class="fields">
+    <dt>Parameters:</dt>
+    <dd><ul class="nomargin-top">
+        <li><strong class="pname"><code>pdtnum</code></strong> - Product Definition Template Number (see Code <a 
+          href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table4-0.shtml"
+          target="_top">Table 4.0</a>)</li>
+        <li><strong class="pname"><code>pdtmpl</code></strong> - Sequence with the data values for the specified Product 
+          Definition Template (N=pdtnum).  Each element of this integer 
+          array contains an entry (in the order specified) of Product 
+          Definition Template 4.N</li>
+        <li><strong class="pname"><code>drtnum</code></strong> - Data Representation Template Number (see Code <a 
+          href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table5-0.shtml"
+          target="_top">Table 5.0</a>)</li>
+        <li><strong class="pname"><code>drtmpl</code></strong> - Sequence with the data values for the specified Data 
+          Representation Template (N=drtnum).  Each element of this integer
+          array contains an entry (in the order specified) of Data 
+          Representation Template 5.N Note that some values in this 
+          template (eg. reference values, number of bits, etc...) may be 
+          changed by the data packing algorithms. Use this to specify 
+          scaling factors and order of spatial differencing, if desired.</li>
+        <li><strong class="pname"><code>field</code></strong> - numpy array of data points to pack. If field is a masked array, 
+          then a bitmap is created from the mask.</li>
+        <li><strong class="pname"><code>coordlist</code></strong> - Sequence containing floating point values intended to document 
+          the vertical discretization with model data on hybrid coordinate 
+          vertical levels. Default None.</li>
+    </ul></dd>
+  </dl>
+</td></tr></table>
+</div>
+<a name="addgrid"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">addgrid</span>(<span class="sig-arg">self</span>,
+        <span class="sig-arg">gdsinfo</span>,
+        <span class="sig-arg">gdtmpl</span>,
+        <span class="sig-arg">deflist</span>=<span class="sig-default">None</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    ><span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Encode.addgrid">source code</a></span> 
+    </td>
+  </tr></table>
+  
+  <p>Add a grid definition section (section 3) to the GRIB2 message.</p>
+  <dl class="fields">
+    <dt>Parameters:</dt>
+    <dd><ul class="nomargin-top">
+        <li><strong class="pname"><code>gdsinfo</code></strong> - Sequence containing information needed for the grid definition 
+          section.
+          <ul>
+            <li>
+              gdsinfo[0] = Source of grid definition (see Code <a 
+              href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-0.shtml"
+              target="_top">Table 3.0</a>)
+            </li>
+            <li>
+              gdsinfo[1] = Number of grid points in the defined grid.
+            </li>
+            <li>
+              gdsinfo[2] = Number of octets needed for each additional grid
+              points defn. Used to define number of points in each row for 
+              non-reg grids (=0 for regular grid).
+            </li>
+            <li>
+              gdsinfo[3] = Interp. of list for optional points defn (Code 
+              <a 
+              href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-11.shtml"
+              target="_top">Table 3.11</a>)
+            </li>
+            <li>
+              gdsinfo[4] = Grid Definition Template Number (Code <a 
+              href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-1.shtml"
+              target="_top">Table 3.1</a>)
+            </li>
+          </ul></li>
+        <li><strong class="pname"><code>gdtmpl</code></strong> - Contains the data values for the specified Grid Definition 
+          Template ( NN=gdsinfo[4] ).  Each element of this integer array 
+          contains an entry (in the order specified) of Grid Definition 
+          Template 3.NN</li>
+        <li><strong class="pname"><code>deflist</code></strong> - (Used if gdsinfo[2] != 0)  Sequence containing the number of grid
+          points contained in each row (or column) of a non-regular grid.</li>
+    </ul></dd>
+  </dl>
+</td></tr></table>
+</div>
+<a name="end"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">end</span>(<span class="sig-arg">self</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    ><span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Encode.end">source code</a></span> 
+    </td>
+  </tr></table>
+  
+  <p>Add an end section (section 8) to the GRIB2 message. A GRIB2 message 
+  is not complete without an end section. Once an end section is added, the
+  GRIB2 message can be output to a file.</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<br />
+<!-- ==================== INSTANCE VARIABLE DETAILS ==================== -->
+<a name="section-InstanceVariableDetails"></a>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Instance Variable Details</span></td>
+</tr>
+</table>
+<a name="msg"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <h3 class="epydoc">msg</h3>
+  A binary string containing the GRIB2 message. After the message has been 
+  terminated by calling the <a href="ncepgrib2.Grib2Encode-class.html#end" 
+  class="link">end</a> method, this string can be written to a file.
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<br />
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="ncepgrib2-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1
+    on Wed Nov 20 14:10:14 2013
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/ncepgrib2_docs/ncepgrib2.Grib2Message-class.html b/ncepgrib2_docs/ncepgrib2.Grib2Message-class.html
new file mode 100644
index 0000000..0ef344b
--- /dev/null
+++ b/ncepgrib2_docs/ncepgrib2.Grib2Message-class.html
@@ -0,0 +1,774 @@
+<?xml version="1.0" encoding="ascii"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+  <title>ncepgrib2.Grib2Message</title>
+  <link rel="stylesheet" href="epydoc.css" type="text/css" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+
+<body bgcolor="white" text="black" link="blue" vlink="#204080"
+      alink="#204080">
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="ncepgrib2-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table width="100%" cellpadding="0" cellspacing="0">
+  <tr valign="top">
+    <td width="100%">
+      <span class="breadcrumbs">
+        <a href="ncepgrib2-module.html">Module ncepgrib2</a> ::
+        Class Grib2Message
+      </span>
+    </td>
+    <td>
+      <table cellpadding="0" cellspacing="0">
+        <!-- hide/show private -->
+      </table>
+    </td>
+  </tr>
+</table>
+<!-- ==================== CLASS DESCRIPTION ==================== -->
+<h1 class="epydoc">Class Grib2Message</h1><p class="nomargin-top"><span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Message">source code</a></span></p>
+<p>Class for accessing data in a GRIB Edition 2 message.</p>
+  <p>The <a href="ncepgrib2-module.html#Grib2Decode" 
+  class="link">Grib2Decode</a> function returns a list of these class 
+  instances, one for each grib message in the file.</p>
+  <p>When a class instance is created, metadata in the GRIB2 file is 
+  decoded and used to set various instance variables.</p>
+
+<!-- ==================== INSTANCE METHODS ==================== -->
+<a name="section-InstanceMethods"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Instance Methods</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="ncepgrib2.Grib2Message-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
+        <span class="summary-sig-arg">**kwargs</span>)</span><br />
+      create a Grib2Decode class instance given a GRIB Edition 2 filename.</td>
+          <td align="right" valign="top">
+            <span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Message.__init__">source code</a></span>
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="__repr__"></a><span class="summary-sig-name">__repr__</span>(<span class="summary-sig-arg">self</span>)</span></td>
+          <td align="right" valign="top">
+            <span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Message.__repr__">source code</a></span>
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="ncepgrib2.Grib2Message-class.html#data" class="summary-sig-name">data</a>(<span class="summary-sig-arg">self</span>,
+        <span class="summary-sig-arg">fill_value</span>=<span class="summary-sig-default">9.96920996839e+36</span>,
+        <span class="summary-sig-arg">masked_array</span>=<span class="summary-sig-default">True</span>,
+        <span class="summary-sig-arg">expand</span>=<span class="summary-sig-default">True</span>,
+        <span class="summary-sig-arg">order</span>=<span class="summary-sig-default">None</span>)</span><br />
+      returns an unpacked data grid.</td>
+          <td align="right" valign="top">
+            <span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Message.data">source code</a></span>
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a href="ncepgrib2.Grib2Message-class.html#grid" class="summary-sig-name">grid</a>(<span class="summary-sig-arg">self</span>)</span><br />
+      return lats,lons (in degrees) of grid.</td>
+          <td align="right" valign="top">
+            <span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Message.grid">source code</a></span>
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+      <table width="100%" cellpadding="0" cellspacing="0" border="0">
+        <tr>
+          <td><span class="summary-sig"><a name="latlons"></a><span class="summary-sig-name">latlons</span>(<span class="summary-sig-arg">self</span>)</span><br />
+      alias for <a href="ncepgrib2.Grib2Message-class.html#grid" 
+      class="link">grid</a></td>
+          <td align="right" valign="top">
+            <span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Message.latlons">source code</a></span>
+            
+          </td>
+        </tr>
+      </table>
+      
+    </td>
+  </tr>
+</table>
+<!-- ==================== INSTANCE VARIABLES ==================== -->
+<a name="section-InstanceVariables"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Instance Variables</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="ncepgrib2.Grib2Message-class.html#angle_of_pole_rotation" class="summary-name">angle_of_pole_rotation</a><br />
+      The angle of rotation in degrees about the new polar axis (measured 
+      clockwise when looking from the southern to the northern pole) of the
+      coordinate system.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="bitmap_indicator_flag"></a><span class="summary-name">bitmap_indicator_flag</span><br />
+      flag to indicate whether a bit-map is used (0 for yes, 255 for no).
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="center_wmo_code"></a><span class="summary-name">center_wmo_code</span><br />
+      4 character wmo code for originating center.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="data_representation_template"></a><span class="summary-name">data_representation_template</span><br />
+      data representation template from section 5.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="data_representation_template_number"></a><span class="summary-name">data_representation_template_number</span><br />
+      data representation template number from section 5 (<a 
+      href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table5-0.shtml"
+      target="_top">Table 5.0</a>)
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="discipline_code"></a><span class="summary-name">discipline_code</span><br />
+      product discipline code for grib message (<a 
+      href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table0-0.shtml"
+      target="_top">Table 0.0</a>).
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="earthRmajor"></a><span class="summary-name">earthRmajor</span><br />
+      major (equatorial) earth radius.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="earthRminor"></a><span class="summary-name">earthRminor</span><br />
+      minor (polar) earth radius.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="ncepgrib2.Grib2Message-class.html#grid_definition_info" class="summary-name">grid_definition_info</a><br />
+      grid definition section information from section 3.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="grid_definition_template"></a><span class="summary-name">grid_definition_template</span><br />
+      grid definition template from section 3.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="grid_definition_template_number"></a><span class="summary-name">grid_definition_template_number</span><br />
+      grid definition template number from section 3 (<a 
+      href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-1.shtml"
+      target="_top">Table 3.1</a>).
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="gridlength_in_x_direction"></a><span class="summary-name">gridlength_in_x_direction</span><br />
+      x (or longitudinal) direction grid length.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="gridlength_in_y_direction"></a><span class="summary-name">gridlength_in_y_direction</span><br />
+      y (or latitudinal) direction grid length.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="ncepgrib2.Grib2Message-class.html#has_local_use_section" class="summary-name">has_local_use_section</a><br />
+      True if grib message contains a local use section.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="ncepgrib2.Grib2Message-class.html#identification_section" class="summary-name">identification_section</a><br />
+      data from identification section (section 1).
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="latitude_first_gridpoint"></a><span class="summary-name">latitude_first_gridpoint</span><br />
+      latitude of first grid point on grid.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="latitude_last_gridpoint"></a><span class="summary-name">latitude_last_gridpoint</span><br />
+      latitude of last grid point on grid.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="latitude_of_southern_pole"></a><span class="summary-name">latitude_of_southern_pole</span><br />
+      the geographic latitude in degrees of the southern pole of the 
+      coordinate system (for rotated lat/lon or gaussian grids).
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="longitude_first_gridpoint"></a><span class="summary-name">longitude_first_gridpoint</span><br />
+      longitude of first grid point on grid.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="longitude_last_gridpoint"></a><span class="summary-name">longitude_last_gridpoint</span><br />
+      longitude of last grid point on grid.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="longitude_of_southern_pole"></a><span class="summary-name">longitude_of_southern_pole</span><br />
+      the geographic longitude in degrees of the southern pole of the 
+      coordinate system (for rotated lat/lon or gaussian grids).
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="missing_value"></a><span class="summary-name">missing_value</span><br />
+      primary missing value (for data_representation_template_numbers 2 and
+      3).
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="missing_value2"></a><span class="summary-name">missing_value2</span><br />
+      secondary missing value (for data_representation_template_numbers 2 
+      and 3).
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="number_of_data_points_to_unpack"></a><span class="summary-name">number_of_data_points_to_unpack</span><br />
+      total number of data points in grib message.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="originating_center"></a><span class="summary-name">originating_center</span><br />
+      name of national/international originating center.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="points_in_x_direction"></a><span class="summary-name">points_in_x_direction</span><br />
+      number of points in the x (longitudinal) direction.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="points_in_y_direction"></a><span class="summary-name">points_in_y_direction</span><br />
+      number of points in the y (latitudinal) direction.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="product_definition_template"></a><span class="summary-name">product_definition_template</span><br />
+      product definition template from section 4.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="product_definition_template_number"></a><span class="summary-name">product_definition_template_number</span><br />
+      product definition template number from section 4 (<a 
+      href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table4-0.shtml"
+      target="_top">Table 4.0</a>).
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a name="proj4_"></a><span class="summary-name">proj4_</span><br />
+      instance variables with this prefix are used to set the map 
+      projection parameters for <a href="http://proj.maptools.org" 
+      target="_top">PROJ.4</a>.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="ncepgrib2.Grib2Message-class.html#scanmodeflags" class="summary-name">scanmodeflags</a><br />
+      scanning mode flags from Table 3.4 (<a 
+      href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-4.shtml"
+      target="_top">Table 3.4</a>).
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="ncepgrib2.Grib2Message-class.html#shape_of_earth" class="summary-name">shape_of_earth</a><br />
+      string describing the shape of the earth (e.g.
+    </td>
+  </tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="ncepgrib2.Grib2Message-class.html#spectral_truncation_parameters" class="summary-name">spectral_truncation_parameters</a><br />
+      pentagonal truncation parameters that describe the spherical harmonic
+      truncation (only relevant for grid_definition_template_numbers 
+      50-52).
+    </td>
+  </tr>
+</table>
+<!-- ==================== PROPERTIES ==================== -->
+<a name="section-Properties"></a>
+<table class="summary" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Properties</span></td>
+</tr>
+<tr>
+    <td width="15%" align="right" valign="top" class="summary">
+      <span class="summary-type"> </span>
+    </td><td class="summary">
+        <a href="ncepgrib2.Grib2Message-class.html#values" class="summary-name">values</a><br />
+      returns an unpacked data grid.
+    </td>
+  </tr>
+</table>
+<!-- ==================== METHOD DETAILS ==================== -->
+<a name="section-MethodDetails"></a>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Method Details</span></td>
+</tr>
+</table>
+<a name="__init__"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
+        <span class="sig-arg">**kwargs</span>)</span>
+    <br /><em class="fname">(Constructor)</em>
+  </h3>
+  </td><td align="right" valign="top"
+    ><span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Message.__init__">source code</a></span> 
+    </td>
+  </tr></table>
+  
+  <p>create a Grib2Decode class instance given a GRIB Edition 2 
+  filename.</p>
+  <p>(used by <a href="ncepgrib2-module.html#Grib2Decode" 
+  class="link">Grib2Decode</a> function - not directly called by user)</p>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="data"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">data</span>(<span class="sig-arg">self</span>,
+        <span class="sig-arg">fill_value</span>=<span class="sig-default">9.96920996839e+36</span>,
+        <span class="sig-arg">masked_array</span>=<span class="sig-default">True</span>,
+        <span class="sig-arg">expand</span>=<span class="sig-default">True</span>,
+        <span class="sig-arg">order</span>=<span class="sig-default">None</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    ><span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Message.data">source code</a></span> 
+    </td>
+  </tr></table>
+  
+  <p>returns an unpacked data grid.  Can also be accomplished with <a 
+  href="ncepgrib2.Grib2Message-class.html#values" class="link">values</a> 
+  property.</p>
+  <dl class="fields">
+    <dt>Parameters:</dt>
+    <dd><ul class="nomargin-top">
+        <li><strong class="pname"><code>fill_value</code></strong> - missing or masked data is filled with this value (default 
+          9.9692099683868690e+36).</li>
+        <li><strong class="pname"><code>masked_array</code></strong> - if True, return masked array if there is bitmap for missing or 
+          masked data (default True).</li>
+        <li><strong class="pname"><code>expand</code></strong> - if True (default), ECMWF 'reduced' gaussian grids are expanded to
+          regular gaussian grids.</li>
+        <li><strong class="pname"><code>order</code></strong> - if 1, linear interpolation is used for expanding reduced gaussian
+          grids.  if 0, nearest neighbor interpolation is used. Default is 
+          0 if grid has missing or bitmapped values, 1 otherwise.</li>
+    </ul></dd>
+    <dt>Returns:</dt>
+        <dd><code><b>data</b></code>, a float32 numpy regular or masked array
+          with shape (nlats,lons) containing the requested grid.</dd>
+  </dl>
+</td></tr></table>
+</div>
+<a name="grid"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <table width="100%" cellpadding="0" cellspacing="0" border="0">
+  <tr valign="top"><td>
+  <h3 class="epydoc"><span class="sig"><span class="sig-name">grid</span>(<span class="sig-arg">self</span>)</span>
+  </h3>
+  </td><td align="right" valign="top"
+    ><span class="codelink"><a href="ncepgrib2-pysrc.html#Grib2Message.grid">source code</a></span> 
+    </td>
+  </tr></table>
+  
+  <p>return lats,lons (in degrees) of grid. currently can handle reg. 
+  lat/lon, global gaussian, mercator, stereographic, lambert conformal, 
+  albers equal-area, space-view and azimuthal equidistant grids.  <a 
+  href="ncepgrib2.Grib2Message-class.html#latlons" class="link">latlons</a>
+  method does the same thing.</p>
+  <dl class="fields">
+    <dt>Returns:</dt>
+        <dd><code><b>lats</b>,<b>lons</b></code>, float32 numpy arrays 
+          containing latitudes and longitudes of grid (in degrees).</dd>
+  </dl>
+</td></tr></table>
+</div>
+<br />
+<!-- ==================== INSTANCE VARIABLE DETAILS ==================== -->
+<a name="section-InstanceVariableDetails"></a>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Instance Variable Details</span></td>
+</tr>
+</table>
+<a name="angle_of_pole_rotation"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <h3 class="epydoc">angle_of_pole_rotation</h3>
+  The angle of rotation in degrees about the new polar axis (measured 
+  clockwise when looking from the southern to the northern pole) of the 
+  coordinate system. For rotated lat/lon or gaussian grids.
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="grid_definition_info"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <h3 class="epydoc">grid_definition_info</h3>
+  grid definition section information from section 3. See <a 
+  href="ncepgrib2.Grib2Encode-class.html#addgrid" 
+  class="link">Grib2Encode.addgrid</a> for details.
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="has_local_use_section"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <h3 class="epydoc">has_local_use_section</h3>
+  True if grib message contains a local use section. If True the actual 
+  local use section is contained in the <code>_local_use_section</code> 
+  instance variable, as a raw byte string.
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="identification_section"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <h3 class="epydoc">identification_section</h3>
+  data from identification section (section 1). See <a 
+  href="ncepgrib2.Grib2Encode-class.html#__init__" 
+  class="link">Grib2Encode.__init__</a> for details.
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="scanmodeflags"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <h3 class="epydoc">scanmodeflags</h3>
+  scanning mode flags from Table 3.4 (<a 
+  href="http://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_table3-4.shtml" 
+  target="_top">Table 3.4</a>).
+  <ul>
+    <li>
+      bit 1:
+      <p>0 - Points in the first row or column scan in the +i (+x) 
+      direction</p>
+      <p>1 - Points in the first row or column scan in the -i (-x) 
+      direction</p>
+    </li>
+    <li>
+      bit 2:
+      <p>0 - Points in the first row or column scan in the -j (-y) 
+      direction</p>
+      <p>1 - Points in the first row or column scan in the +j (+y) 
+      direction</p>
+    </li>
+    <li>
+      bit 3:
+      <p>0 - Adjacent points in the i (x) direction are consecutive 
+      (row-major order).</p>
+      <p>1 - Adjacent points in the j (y) direction are consecutive 
+      (column-major order).</p>
+    </li>
+    <li>
+      bit 4:
+      <p>0 - All rows scan in the same direction</p>
+      <p>1 - Adjacent rows scan in the opposite direction</p>
+    </li>
+  </ul>
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="shape_of_earth"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <h3 class="epydoc">shape_of_earth</h3>
+  string describing the shape of the earth (e.g. 'Oblate Spheroid', 
+  'Spheroid').
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<a name="spectral_truncation_parameters"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <h3 class="epydoc">spectral_truncation_parameters</h3>
+  pentagonal truncation parameters that describe the spherical harmonic 
+  truncation (only relevant for grid_definition_template_numbers 50-52). 
+  For triangular truncation, all three of these numbers are the same.
+  <dl class="fields">
+  </dl>
+</td></tr></table>
+</div>
+<br />
+<!-- ==================== PROPERTY DETAILS ==================== -->
+<a name="section-PropertyDetails"></a>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr bgcolor="#70b0f0" class="table-header">
+  <td align="left" colspan="2" class="table-header">
+    <span class="table-header">Property Details</span></td>
+</tr>
+</table>
+<a name="values"></a>
+<div>
+<table class="details" border="1" cellpadding="3"
+       cellspacing="0" width="100%" bgcolor="white">
+<tr><td>
+  <h3 class="epydoc">values</h3>
+  <p>returns an unpacked data grid.  Can also be accomplished with <a 
+  href="ncepgrib2.Grib2Message-class.html#values" class="link">values</a> 
+  property.</p>
+  <dl class="fields">
+    <dt>Get Method:</dt>
+    <dd class="value"><span class="summary-sig"><a href="ncepgrib2.Grib2Message-class.html#data" class="summary-sig-name">data</a>(<span class="summary-sig-arg">self</span>,
+        <span class="summary-sig-arg">fill_value</span>=<span class="summary-sig-default">9.96920996839e+36</span>,
+        <span class="summary-sig-arg">masked_array</span>=<span class="summary-sig-default">True</span>,
+        <span class="summary-sig-arg">expand</span>=<span class="summary-sig-default">True</span>,
+        <span class="summary-sig-arg">order</span>=<span class="summary-sig-default">None</span>)</span>
+        - returns an unpacked data grid.
+    </dd>
+  </dl>
+</td></tr></table>
+</div>
+<br />
+<!-- ==================== NAVIGATION BAR ==================== -->
+<table class="navbar" border="0" width="100%" cellpadding="0"
+       bgcolor="#a0c0ff" cellspacing="0">
+  <tr valign="middle">
+  <!-- Home link -->
+      <th>   <a
+        href="ncepgrib2-module.html">Home</a>   </th>
+
+  <!-- Tree link -->
+      <th>   <a
+        href="module-tree.html">Trees</a>   </th>
+
+  <!-- Index link -->
+      <th>   <a
+        href="identifier-index.html">Indices</a>   </th>
+
+  <!-- Help link -->
+      <th>   <a
+        href="help.html">Help</a>   </th>
+
+      <th class="navbar" width="100%"></th>
+  </tr>
+</table>
+<table border="0" cellpadding="0" cellspacing="0" width="100%%">
+  <tr>
+    <td align="left" class="footer">
+    Generated by Epydoc 3.0.1
+    on Wed Nov 20 14:10:14 2013
+    </td>
+    <td align="right" class="footer">
+      <a target="mainFrame" href="http://epydoc.sourceforge.net"
+        >http://epydoc.sourceforge.net</a>
+    </td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+  <!--
+  // Private objects are initially displayed (because if
+  // javascript is turned off then we want them to be
+  // visible); but by default, we want to hide them.  So hide
+  // them unless we have a cookie that says to show them.
+  checkCookie();
+  // -->
+</script>
+</body>
+</html>
diff --git a/ncepgrib2_docs/redirect.html b/ncepgrib2_docs/redirect.html
new file mode 100644
index 0000000..059eeab
--- /dev/null
+++ b/ncepgrib2_docs/redirect.html
@@ -0,0 +1,38 @@
+<html><head><title>Epydoc Redirect Page</title>
+<meta http-equiv="cache-control" content="no-cache" />
+<meta http-equiv="expires" content="0" />
+<meta http-equiv="pragma" content="no-cache" />
+  <script type="text/javascript" src="epydoc.js"></script>
+</head>
+<body>
+<script type="text/javascript">
+<!--
+var pages = ["ncepgrib2.Grib2Message-c", "ncepgrib2.Grib2Encode-c", "ncepgrib2-m"];
+var dottedName = get_anchor();
+if (dottedName) {
+    var target = redirect_url(dottedName);
+    if (target) window.location.replace(target);
+}
+// -->
+</script>
+
+<h3>Epydoc Auto-redirect page</h3>
+
+<p>When javascript is enabled, this page will redirect URLs of
+the form <tt>redirect.html#<i>dotted.name</i></tt> to the
+documentation for the object with the given fully-qualified
+dotted name.</p>
+<p><a id="message">   </a></p>
+
+<script type="text/javascript">
+<!--
+if (dottedName) {
+    var msg = document.getElementById("message");
+    msg.innerHTML = "No documentation found for <tt>"+
+                    dottedName+"</tt>";
+}
+// -->
+</script>
+
+</body>
+</html>
diff --git a/ports/README b/ports/README
new file mode 100644
index 0000000..a9b49b6
--- /dev/null
+++ b/ports/README
@@ -0,0 +1,14 @@
+* copy this directory to your home directory.
+(cd ..; tar -cvf $HOME/ports.tar ports; cd $HOME; tar -xvf ports.tar; rm ports.tar)
+
+* sudo vi /opt/local/etc/macports/sources.conf, add the line
+file:///Users/<myusername>/ports
+  just *before* the line
+rsync://rsync.macports.org/release/ports [default]
+
+* cd /Users/<myusername>/ports; sudo portindex
+
+* sudo port install py-pygrib
+This will install pygrib from svn HEAD. To periodically upgrade, just do
+   - sudo port uninstall py-pygrib
+   - sudo port install py-pygrib (this will re-download and rebuild)
diff --git a/ports/python/py-pygrib/Portfile b/ports/python/py-pygrib/Portfile
new file mode 100644
index 0000000..f928e1c
--- /dev/null
+++ b/ports/python/py-pygrib/Portfile
@@ -0,0 +1,27 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id$
+PortSystem          1.0
+PortGroup           python 1.0
+
+name                py-pygrib
+version             svnhead
+categories-append   science
+platforms           darwin
+maintainers         openmaintainer
+description         Python interface to the Grib API library.
+long_description    ${description}
+homepage            http://code.google.com/p/pygrib/
+master_sites        http://pygrib.googlecode.com/files/
+license             MIT
+
+distname            trunk
+
+fetch.type          svn
+svn.url             http://pygrib.googlecode.com/svn/${distname}
+
+depends_lib-append  port:py${python.version}-pyproj port:py${python.version}-numpy port:grib_api
+
+python.default_version 27
+python.versions        26 27
+
+build.env-append GRIBAPI_DIR=${prefix} PNG_DIR=${prefix} JASPER_DIR=${prefix} OPENJPEG_DIR=${prefix}
diff --git a/pygrib.c b/pygrib.c
new file mode 100644
index 0000000..26db020
--- /dev/null
+++ b/pygrib.c
@@ -0,0 +1,32986 @@
+/* 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\nRe [...]
+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 i [...]
+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 r [...]
+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 [...]
+#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        co [...]
+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')\ [...]
+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 specia [...]
+  __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 [...]
+  __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 [...]
+  __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 */
diff --git a/pygrib.pyx b/pygrib.pyx
new file mode 100644
index 0000000..6c33bc7
--- /dev/null
+++ b/pygrib.pyx
@@ -0,0 +1,2069 @@
+"""
+Introduction
+============
+
+Python module for reading and writing GRIB (editions 1 and 2) files.
+GRIB is the World Meterological Organization
+U{standard<http://www.wmo.ch/pages/prog/www/WMOCodes/GRIB.html>} 
+for distributing gridded data. 
+The module is a python interface to the
+U{GRIB API<https://software.ecmwf.int/wiki/display/GRIB/Home>} C library
+from the European Centre for Medium-Range Weather Forecasts
+(U{ECMWF<http://www.ecmwf.int>}).
+
+Required
+========
+
+- U{Python<http://python.org>} 2.4 or higher.
+- U{numpy<http://sourceforge.net/project/showfiles.php?group_id=1369>}
+  N-dimensional array object for python. Version 1.2.1 or higher (version
+  1.5.1 required for Python 3).
+- U{pyproj<http://code.google.com/p/pyproj/>} Python interface to 
+  U{PROJ.4<http://trac.osgeo.org/proj>} library for cartographic
+  transformations B{or} U{matplotlib<http://matplotlib.sf.net>} and
+  the U{basemap<http://matplotlib.sf.net/basemap/doc/html>} toolkit.
+  Pyproj 1.8.9 is required for Python 3.
+- U{GRIB API<https://software.ecmwf.int/wiki/display/GRIB/Home>} C library
+  for encoding and decoding GRIB messages (edition 1 and edition 2).
+  Version 1.8.0 or higher required.
+  To be fully functional, the GRIB API library requires
+  U{Jasper<http://www.ece.uvic.ca/~mdadams/jasper>} or 
+  U{OpenJPEG<http://www.openjpeg.org>} for JPEG200 encoding,
+  and U{PNG<http://www.libpng.org/pub/png/libpng.html>} for PNG encoding.
+
+These dependencies are available via the package management system of most
+Linux distributions, and on MacOS X using U{macports<http://macports.org/>}. 
+If you build grib_api yourself as a static library on a 64-bit system
+you may need to set C{CFLAGS} to C{'-O2 -fPIC'} before running the C{configure}
+script.  To use pygrib on Windows, you must use the
+U{Cygwin<http://cygwin.com>} environment, since the grib_api library requires a 
+posix environment.  Cygwin installation instructions are available
+U{here<http://code.google.com/p/pygrib/wiki/CygwinWindowsInstall>}.
+
+Installation
+============
+
+ - U{Download<http://code.google.com/p/pygrib/downloads/list>} the source code. 
+ - pygrib installation options can either be set with environment variables,
+ or specified in a text file (setup.cfg).  To use environment variables,
+ set C{$GRIBAPI_DIR}, C{$JASPER_DIR}, C{$OPENJPEG_DIR},
+ C{$PNG_DIR} and C{$ZLIB_DIR} so that the include files and libraries for
+ GRIB API, Jasper, OpenJPEG, PNG and zlib will be found.  
+ For example, the include files for 
+ jasper should be found in C{$JASPER_DIR/include} or
+ C{$JASPER_DIR/include/jasper}, and the jasper
+ library should be found in C{$JASPER_DIR/lib} or C{$JASPER_DIR/lib64}. If any of
+ those environment variables are not set, then it is assumed that GRIB API was
+ not built with support for that library.
+ If the libraries and
+ include files are installed in separate locations, the environment variables
+ C{$GRIBAPI_INCDIR} and C{$GRIBAPI_LIBDIR} can be used to define the locations
+ separately (same goes for C{JASPER}, C{OPENJPEG}, C{PNG} and C{ZLIB}).
+ Note that if both C{$GRIBAPI_DIR} and C{$GRIBAPI_INCDIR}/C{$GRIBAPI_LIBDIR}
+ are specified, C{$GRIBAPI_DIR} takes precedence.
+ To use setup.cfg, copy setup.cfg.template to setup.cfg, open setup.cfg in a 
+ text editor and follow the instructions in the comments for editing.
+ - Run 'python setup.py build' and then 'python setup.py install', as root if necessary.
+ Note that if you are using environment variables to specify the build options,
+ you cannot build and install in one step with 'sudo python setup.py install',
+ since sudo does not pass environment variables.  Instead, run 'python setup.py
+ build' first as a regular user, then run 'sudo python setup.py install' if the
+ install directory requires admin or root privileges.
+ - Run 'python test.py' to test your installation.
+ - Look at examples in C{test} directory (most require 
+ U{matplotlib<http://matplotlib.sf.net>} and
+ U{basemap<http://matplotlib.sourceforge.net/basemap/doc/html/>}).
+ - If you're on MacOS X, see
+ U{README.macosx<http://pygrib.googlecode.com/svn/trunk/README.macosx>}
+ for special instruction on how to install pygrib and all it's
+ dependencies using U{macports<http://macports.org>}.
+
+
+Example usage
+=============
+
+ - from the python interpreter prompt, import the package::
+    >>> import pygrib
+ - open a GRIB file, create a grib message iterator::
+    >>> grbs = pygrib.open('sampledata/flux.grb')  
+ - pygrib open instances behave like regular python file objects, with
+ C{seek}, C{tell}, C{read}, C{readline} and C{close} methods, except that offsets
+ are measured in grib messages instead of bytes::
+    >>> grbs.seek(2)
+    >>> grbs.tell()
+    2
+    >>> grb = grbs.read(1)[0] # read returns a list with the next N (N=1 in this case) messages.
+    >>> grb # printing a grib message object displays summary info
+    3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+    >>> grbs.tell()
+    3
+ - print an inventory of the file::
+    >>> grbs.seek(0)
+    >>> for grb in grbs:
+    >>>     grb 
+    1:Precipitation rate:kg m**-2 s**-1 (avg):regular_gg:surface:level 0:fcst time 108-120 hrs (avg):from 200402291200
+    2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200
+    3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+    4:Minimum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+ - find the first grib message with a matching name::
+    >>> grb = grbs.select(name='Maximum temperature')[0]
+ - extract the data values using the 'values' key
+ (grb.keys() will return a list of the available keys)::
+    # The data is returned as a numpy array, or if missing values or a bitmap
+    # are present, a numpy masked array.  Reduced lat/lon or gaussian grid
+    # data is automatically expanded to a regular grid. Details of the internal
+    # representation of the grib data (such as the scanning mode) are handled
+    # automatically.
+    >>> maxt = grb.values # same as grb['values']
+    >>> maxt.shape, maxt.min(), maxt.max()
+    (94, 192) 223.7 319.9
+ - get the latitudes and longitudes of the grid::
+    >>> lats, lons = grb.latlons()
+    >>> lats.shape, lats.min(), lats.max(), lons.shape, lons.min(), lons.max()
+    (94, 192) -88.5419501373 88.5419501373  0.0 358.125
+ - get the second grib message::
+    >>> grb = grbs.message(2) # same as grbs.seek(1); grb=grbs.readline()
+    >>> grb
+    2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200
+ - extract data and get lat/lon values for a subset over North America::
+    >>> data, lats, lons = grb.data(lat1=20,lat2=70,lon1=220,lon2=320)
+    >>> data.shape, lats.min(), lats.max(), lons.min(), lons.max()
+    (26, 53) 21.904439458 69.5216630593 221.25 318.75
+ - modify the values associated with existing keys (either via attribute or
+ dictionary access)::
+    >>> grb['forecastTime'] = 240
+    >>> grb.dataDate = 20100101
+ - get the binary string associated with the coded message::
+    >>> msg = grb.tostring()
+    >>> grbs.close() # close the grib file.
+ - write the modified message to a new GRIB file::
+    >>> grbout = open('test.grb','wb')
+    >>> grbout.write(msg)
+    >>> grbout.close()
+    >>> pygrib.open('test.grb').readline() 
+    1:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 240 hrs:from 201001011200
+
+Documentation
+=============
+
+ - see below for the full python API documentation.
+  
+Changelog
+=========
+
+ - see U{Changelog<http://pygrib.googlecode.com/svn/trunk/Changelog>} file.
+
+ at author: Jeffrey Whitaker.
+
+ at contact: U{Jeff Whitaker<mailto:jeffrey.s.whitaker at noaa.gov>}
+
+ at version: 1.9.9
+
+ at copyright: copyright 2010 by Jeffrey Whitaker.
+
+ at license: Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation.
+THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+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'
+
+import numpy as np
+import warnings
+from datetime import datetime
+from numpy import ma
+try:
+    import pyproj
+except ImportError:
+    try:
+        from mpl_toolkits.basemap import pyproj
+    except:
+        raise ImportError("either pyproj or basemap required")
+from ncepgrib2 import Grib2Decode
+import_array()
+
+cdef extern from "stdlib.h":
+    ctypedef long size_t
+    void *malloc(size_t size)
+    void free(void *ptr)
+
+cdef extern from "stdio.h":
+    ctypedef struct FILE
+    FILE *fopen(char *path, char *mode)
+    int	fclose(FILE *)
+    size_t fwrite(void *ptr, size_t size, size_t nitems, FILE *stream)
+    void rewind (FILE *)
+
+cdef extern from "Python.h":
+    object PyBytes_FromStringAndSize(char *s, size_t size)
+default_encoding = 'ascii'
+
+cdef extern from "numpy/arrayobject.h":
+    ctypedef int npy_intp 
+    ctypedef extern class numpy.ndarray [object PyArrayObject]:
+        cdef char *data
+        cdef int nd
+        cdef npy_intp *dimensions
+        cdef npy_intp *strides
+        cdef object base
+        cdef int flags
+    npy_intp PyArray_SIZE(ndarray arr)
+    npy_intp PyArray_ISCONTIGUOUS(ndarray arr)
+    npy_intp PyArray_ISALIGNED(ndarray arr)
+    void import_array()
+
+cdef extern from "grib_api.h":
+    ctypedef struct grib_handle
+    ctypedef struct grib_index
+    ctypedef struct grib_keys_iterator
+    ctypedef struct grib_context
+    cdef enum:
+        GRIB_TYPE_UNDEFINED
+        GRIB_TYPE_LONG
+        GRIB_TYPE_DOUBLE
+        GRIB_TYPE_STRING
+        GRIB_TYPE_BYTES 
+        GRIB_TYPE_SECTION 
+        GRIB_TYPE_LABEL 
+        GRIB_TYPE_MISSING 
+        GRIB_KEYS_ITERATOR_ALL_KEYS            
+        GRIB_KEYS_ITERATOR_SKIP_READ_ONLY         
+        GRIB_KEYS_ITERATOR_SKIP_OPTIONAL          
+        GRIB_KEYS_ITERATOR_SKIP_EDITION_SPECIFIC  
+        GRIB_KEYS_ITERATOR_SKIP_CODED             
+        GRIB_KEYS_ITERATOR_SKIP_COMPUTED         
+        GRIB_KEYS_ITERATOR_SKIP_FUNCTION         
+        GRIB_KEYS_ITERATOR_SKIP_DUPLICATES       
+        GRIB_MISSING_LONG 
+        GRIB_MISSING_DOUBLE
+    int grib_get_size(grib_handle *h, char *name, size_t *size)
+    int grib_get_native_type(grib_handle *h, char *name, int *type)
+    int grib_get_long(grib_handle *h, char *name, long *ival)
+    int grib_set_long(grib_handle *h, char *name, long val)
+    int grib_get_long_array(grib_handle *h, char *name, long *ival, size_t *size)
+    int grib_set_long_array(grib_handle *h, char *name, long *ival, size_t size)
+    int grib_get_double(grib_handle *h, char *name, double *dval)
+    int grib_set_double(grib_handle *h, char *name, double dval)
+    int grib_get_double_array(grib_handle *h, char *name, double *dval, size_t *size)
+    int grib_set_double_array(grib_handle *h, char *name, double *dval, size_t size)
+    int grib_get_string(grib_handle *h, char *name, char *mesg, size_t *size)
+    int grib_set_string(grib_handle *h, char *name, char *mesg, size_t *size)
+    grib_keys_iterator* grib_keys_iterator_new(grib_handle* h,unsigned long filter_flags, char* name_space)
+    int grib_keys_iterator_next(grib_keys_iterator *kiter)
+    char* grib_keys_iterator_get_name(grib_keys_iterator *kiter)
+    int grib_handle_delete(grib_handle* h)
+    grib_handle* grib_handle_new_from_file(grib_context* c, FILE* f, int* error)        
+    char* grib_get_error_message(int code)
+    int grib_keys_iterator_delete( grib_keys_iterator* kiter)
+    void grib_multi_support_on(grib_context* c)
+    void grib_multi_support_off(grib_context* c)
+    int grib_get_message(grib_handle* h ,  void** message,size_t *message_length)
+    int grib_get_message_copy(grib_handle* h ,  void* message,size_t *message_length)
+    long grib_get_api_version()
+    grib_handle* grib_handle_clone(grib_handle* h)
+    grib_index* grib_index_new_from_file(grib_context* c,\
+                            char* filename,char* keys,int *err)
+    int grib_index_get_size(grib_index* index,char* key,size_t* size)
+    int grib_index_get_long(grib_index* index,char* key,\
+                        long* values,size_t *size)
+    int grib_index_get_double(grib_index* index,char* key,\
+                              double* values,size_t *size)
+    int grib_index_get_string(grib_index* index,char* key,\
+                          char** values,size_t *size)
+    int grib_index_select_long(grib_index* index,char* key,long value)
+    int grib_index_select_double(grib_index* index,char* key,double value)
+    int grib_index_select_string(grib_index* index,char* key,char* value)
+    grib_handle* grib_handle_new_from_index(grib_index* index,int *err)
+    void grib_index_delete(grib_index* index)
+    int grib_is_missing(grib_handle* h, char* key, int* err)
+    grib_handle* grib_handle_new_from_message(grib_context * c, void * data,\
+                             size_t data_len)
+    grib_handle* grib_handle_new_from_message_copy(grib_context * c, void * data,\
+                             size_t data_len)
+    int grib_julian_to_datetime(double jd, long *year, long *month, long *day, long *hour, long *minute, long *second)
+    int grib_datetime_to_julian(long year, long month, long day, long hour, long minute, long second, double *jd)
+    int grib_get_gaussian_latitudes(long truncation,double* latitudes)
+    int grib_index_write(grib_index *index, char *filename)
+    grib_index* grib_index_read(grib_context* c, char* filename,int *err)
+    int grib_count_in_file(grib_context* c, FILE* f,int* n)
+
+
+missingvalue_int = GRIB_MISSING_LONG
+#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)
+    v = grib_get_api_version()
+    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()
+tolerate_badgrib = False
+
+def tolerate_badgrib_on():
+    """
+    don't raise an exception when a missing or malformed key is encountered.
+    """
+    global tolerate_badgrib
+    tolerate_badgrib = True
+
+def tolerate_badgrib_off():
+    """
+    raise an exception when a missing or malformed key is encountered
+    (default behavior).
+    """
+    global tolerate_badgrib
+    tolerate_badgrib = False
+
+def gaulats(object nlats):
+    """
+    gaulats(nlats)
+
+    Returns nlats gaussian latitudes, in degrees, oriented from
+    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)
+    grib_get_gaussian_latitudes(<long>nlats/2, <double *>lats.data)
+    return lats
+
+# dict for forecast time units (Code Table 4.4).
+_ftimedict = {}
+_ftimedict[0]='mins'
+_ftimedict[1]='hrs'
+_ftimedict[2]='days'
+_ftimedict[3]='months'
+_ftimedict[4]='yrs'
+_ftimedict[5]='decades'
+_ftimedict[6]='30 yr periods'
+_ftimedict[7]='centuries'
+_ftimedict[10]='3 hr periods'
+_ftimedict[11]='6 hr periods'
+_ftimedict[12]='12 hr periods'
+_ftimedict[13]='secs'
+
+# turn on support for multi-field grib messages.
+grib_multi_support_on(NULL)
+
+def multi_support_on():
+    """turn on support for multi-field grib messages (default)"""
+    grib_multi_support_on(NULL)
+
+def multi_support_off():
+    """turn off support for multi-field grib messages"""
+    grib_multi_support_off(NULL)
+
+cdef class open(object):
+    """ 
+    open(filename)
+    
+    returns GRIB file iterator object given GRIB filename. When iterated, returns
+    instances of the L{gribmessage} class. Behaves much like a python file
+    object, with L{seek}, L{tell}, L{read} and L{close} methods, 
+    except that offsets are measured in grib messages instead of bytes.
+    Additional methods include L{rewind} (like C{seek(0)}), L{message}
+    (like C{seek(N-1)}; followed by C{readline()}), and L{select} (filters
+    messages based on specified conditions).  The C{__call__} method forwards
+    to L{select}, and instances can be sliced with C{__getitem__} (returning
+    lists of L{gribmessage} instances).  The position of the iterator is not
+    altered by slicing with C{__getitem__}.
+     
+    @ivar messages: The total number of grib messages in the file.
+
+    @ivar messagenumber: The grib message number that the iterator currently
+    points to (the value returned by L{tell}).
+
+    @ivar name: The GRIB file which the instance represents."""
+    cdef FILE *_fd
+    cdef grib_handle *_gh
+    cdef public object name, messagenumber, messages, closed,\
+                       has_multi_field_msgs
+    def __cinit__(self, filename):
+        # initialize C level objects.
+        cdef grib_handle *gh
+        cdef FILE *_fd
+        bytestr = _strencode(filename)
+        self._fd = fopen(bytestr, "rb") 
+        if self._fd == NULL:
+            raise IOError("could not open %s", filename)
+        self._gh = NULL
+    def __init__(self, filename):
+        cdef int err, ncount
+        cdef grib_handle *gh
+        # initalize Python level objects
+        self.name = filename
+        self.closed = False
+        self.messagenumber = 0
+        # 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)
+            if gh == NULL: break
+            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
+        # 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:
+            self.has_multi_field_msgs=False
+    def __iter__(self):
+        return self
+    def __next__(self):
+        cdef grib_handle* gh 
+        cdef int err
+        if self.messagenumber == self.messages:
+            raise StopIteration
+        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)
+        if err:
+            raise RuntimeError(grib_get_error_message(err))
+        if gh == NULL:
+            raise StopIteration
+        else:
+            self._gh = gh
+            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.
+            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
+        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
+            return grb
+        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)
+    def __enter__(self):
+        return self
+    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)."""
+        return self.messagenumber
+    def seek(self, msg, from_what=0):
+        """
+        seek(N,from_what=0)
+        
+        advance iterator N grib messages from beginning of file 
+        (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:
+            if from_what == 0:
+                self.rewind()
+            elif from_what == 1:
+                return
+            elif from_what == 2:
+                self.message(self.messages)
+        else:
+            if from_what == 0:
+                self.message(msg)
+            elif from_what == 1:
+                self.message(self.messagenumber+msg)
+            elif from_what == 2:
+                self.message(self.messages+msg)
+    def readline(self):
+        """
+        readline()
+
+        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()
+            else:
+                grb = next(self)
+        except StopIteration:
+            grb = None
+        return grb
+    def read(self,msgs=None):
+        """
+        read(N=None)
+        
+        read N messages from current position, returning grib messages instances in a
+        list.  If N=None, all the messages to the end of the file are read.
+        C{pygrib.open(f).read()} is equivalent to C{list(pygrib.open(f))},
+        both return a list containing L{gribmessage} instances for all the
+        grib messages in the file C{f}.
+        """
+        if msgs is None:
+            grbs = self._advance(self.messages-self.messagenumber,return_msgs=True)
+        else:
+            grbs = self._advance(msgs,return_msgs=True)
+        return grbs
+    def close(self):
+        """
+        close()
+
+        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)
+            if err:
+                raise RuntimeError(grib_get_error_message(err))
+        self.closed = True
+        self._fd = NULL
+
+    def __dealloc__(self):
+        # close file handle if there are no more references 
+        # to the object.
+        cdef int err
+        if self._fd:
+            fclose(self._fd)
+
+    def rewind(self):
+        """rewind iterator (same as seek(0))"""
+        # before rewinding, move iterator to end of file
+        # 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)
+            if gh == NULL: break
+        rewind(self._fd)
+        self.messagenumber = 0
+    def message(self, N):
+        """
+        message(N)
+        
+        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.
+        if self.messagenumber >= N:
+            self.rewind()
+        # move iterator forward to message N.
+        self._advance(N-self.messagenumber)
+        return _create_gribmessage(self._gh, self.messagenumber)
+    def select(self, **kwargs):
+        """
+select(**kwargs)
+
+return a list of L{gribmessage} instances from iterator filtered by kwargs.
+If keyword is a container object, each grib message
+in the iterator is searched for membership in the container.
+If keyword is a callable (has a _call__ method), each grib
+message in the iterator is tested using the callable (which should
+return a boolean).
+If keyword is not a container object or a callable, each 
+grib message in the iterator is tested for equality.
+
+Example usage:
+
+>>> import pygrib
+>>> grbs = pygrib.open('sampledata/gfs.grb')
+>>> selected_grbs=grbs.select(shortName='gh',typeOfLevel='isobaricInhPa',level=10)
+>>> for grb in selected_grbs: grb
+26:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 10 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
+>>> # the __call__ method does the same thing
+>>> selected_grbs=grbs(shortName='gh',typeOfLevel='isobaricInhPa',level=10)
+>>> for grb in selected_grbs: grb
+26:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 10 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
+>>> # to select multiple specific key values, use containers (e.g. sequences)
+>>> selected_grbs=grbs(shortName=['u','v'],typeOfLevel='isobaricInhPa',level=[10,50])
+>>> for grb in selected_grbs: grb
+193:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 50 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
+194:v-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 50 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
+199:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 10 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
+200:v-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 10 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
+>>> # to select key values based on a conditional expression, use a function
+>>> selected_grbs=grbs(shortName='gh',level=lambda l: l < 500 and l >= 300)
+>>> for grb in selected_grbs: grb
+14:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 45000 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
+15:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
+16:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
+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)]
+        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):
+        """advance iterator n messages from current position.
+        if return_msgs==True, grib message instances are returned
+        in a list"""
+        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):
+            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:
+                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))
+        if return_msgs: return grbs
+
+# keep track of python gribmessage attributes so they can be
+# distinguished from grib keys.
+_private_atts =\
+['_gh','fcstimeunits','expand_reduced','projparams','messagenumber','_all_keys','_ro_keys']
+
+def julian_to_datetime(object jd):
+    """
+    julian_to_datetime(julday)
+    
+    convert Julian day number to python datetime instance.
+
+    Used to create validDate and analDate attributes from
+    julianDay and forecastTime keys."""
+    cdef double julday
+    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:
+        raise RuntimeError(grib_get_error_message(err))
+    return datetime(year, month, day, hour, minute, second)
+
+def datetime_to_julian(object d):
+    """
+    datetime_to_julian(date)
+    
+    convert python datetime instance to Julian day number."""
+    cdef double julday
+    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)
+    if err:
+        raise RuntimeError(grib_get_error_message(err))
+    return julday
+
+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
+    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)
+
+def fromstring(gribstring):
+    """
+    fromstring(string)
+
+    Create a gribmessage instance from a python bytes object
+    representing a binary grib message (the reverse of L{gribmessage.tostring}).
+    """
+    cdef char* gribstr
+    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)
+    grb.messagenumber = 1
+    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.
+    return setdates(grb)
+
+def setdates(gribmessage grb):
+    """
+    setdates(grb)
+    
+    set fcstimeunits, analDate and validDate attributes using
+    julianDay, forecastTime and indicatorOfUnitOfTimeRange.
+    Called automatically when gribmessage instance created,
+    but can be called manually to update keys if one of 
+    them is modified after instance creation.
+    """
+    grb.fcstimeunits = ""
+    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'):
+            # this is a hack to work around grib_api bug
+            # 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
+            try: 
+                ftime = float(ftime.split('-')[1])
+            except:
+                ftime = grb.forecastTime
+        else:
+            ftime = grb.forecastTime
+    else:
+        ftime = 0
+    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)
+        except ValueError:
+            return grb
+        if grb.fcstimeunits == 'hrs':
+            try:
+                grb.validDate =\
+                julian_to_datetime(grb.julianDay+ftime/24.)
+            except ValueError:
+                return grb
+        elif grb.fcstimeunits == 'mins':
+            try:
+                grb.validDate =\
+                julian_to_datetime(grb.julianDay+ftime/1440.)
+            except ValueError:
+                return grb
+        elif grb.fcstimeunits == 'days':
+            try:
+                grb.validDate =\
+                julian_to_datetime(grb.julianDay+ftime)
+            except ValueError:
+                return grb
+        elif grb.fcstimeunits == 'secs':
+            try:
+                grb.validDate =\
+                julian_to_datetime(grb.julianDay+ftime/86400.)
+            except ValueError:
+                return grb
+        elif grb.fcstimeunits == '3 hr periods':
+            try:
+                grb.validDate =\
+                julian_to_datetime(grb.julianDay+ftime/8.)
+            except ValueError:
+                return grb
+        elif grb.fcstimeunits == '6 hr periods':
+            try:
+                grb.validDate =\
+                julian_to_datetime(grb.julianDay+ftime/4.)
+            except ValueError:
+                return grb
+        elif grb.fcstimeunits == '12 hr periods':
+            try:
+                grb.validDate =\
+                julian_to_datetime(grb.julianDay+ftime/2.)
+            except ValueError:
+                return grb
+    return grb
+
+def reload(gribmessage grb):
+    """
+    reload(grb)
+
+    Recreate gribmessage object, updating all the keys to be consistent
+    with each other.  For example, if the forecastTime key is changed,
+    recreating the gribmessage object with this function will cause
+    the analDate and verifDate keys to be updated accordingly.
+
+    Equivalent to fromstring(grb.tostring())"""
+    return fromstring(grb.tostring())
+
+cdef class gribmessage(object):
+    """
+    Grib message object.
+
+    Each grib message has attributes corresponding to grib message
+    keys for 
+    U{GRIB1 <http://www.ecmwf.int/publications/manuals/d/gribapi/fm92/grib1>}
+    and
+    U{GRIB2 <http://www.ecmwf.int/publications/manuals/d/gribapi/fm92/grib2/>}.
+    Parameter names are
+    are given by the C{name}, C{shortName} and C{paramID}
+    U{keys <http://www.ecmwf.int/publications/manuals/d/gribapi/param/>}.
+    pygrib also defines some special attributes which are defined below
+    under the heading B{Instance Variables}.
+
+    @ivar messagenumber: The grib message number in the file.
+
+    @ivar projparams: A dictionary containing proj4 key/value pairs describing 
+    the grid.  Set to C{None} for unsupported grid types.
+
+    @ivar expand_reduced:  If True (default), reduced lat/lon and gaussian grids
+    will be expanded to regular grids when data is accessed via "values" key. If
+    False, data is kept on unstructured reduced grid, and is returned in a 1-d
+    array.
+
+    @ivar fcstimeunits:  A string representing the forecast time units
+    (an empty string if not defined).
+
+    @ivar analDate:  A python datetime instance describing the analysis date
+    and time for the forecast. Only set if forecastTime and julianDay keys
+    exist.
+
+    @ivar validDate:  A python datetime instance describing the valid date
+    and time for the forecast. Only set if forecastTime and julianDay keys
+    exist, and fcstimeunits is defined. If forecast time
+    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):
+        # 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
+        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().
+        try:
+            return self.__getitem__(item)
+        except KeyError:
+            raise AttributeError(item)
+    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
+        else:
+            # these are python attributes.
+            self.__dict__[name]=value
+    def __repr__(self):
+        """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'])
+            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'])
+            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'):
+            if self.valid_key('typeOfGrid'):
+               inventory.append(':'+self['typeOfGrid'])
+            else:
+               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
+            levunits = 'unknown'
+            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\
+                   self.valid_key('scaleFactorOfFirstFixedSurface'):
+                   if self['scaleFactorOfFirstFixedSurface']:
+                       toplev = self['scaledValueOfFirstFixedSurface']/\
+                                np.power(10.0,self['scaleFactorOfFirstFixedSurface'])
+                   else:
+                       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'):
+                   if self['scaleFactorOfSecondFixedSurface']:
+                       botlev = self['scaledValueOfSecondFixedSurface']/\
+                                np.power(10.0,self['scaleFactorOfSecondFixedSurface'])
+                   else:
+                       botlev = self['scaledValueOfSecondFixedSurface']
+            levstring = None
+            if botlev is None or toplev == botlev:
+                levstring = ':level %s' % toplev
+            else:
+                levstring = ':levels %s-%s' % (toplev,botlev)
+            if levunits != 'unknown':
+                levstring = levstring+' %s' % levunits
+            if levstring is not None:
+                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
+            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))
+        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(
+            ':from '+repr(self['dataDate'])+'%04i' % self['dataTime'])
+        #if self.valid_key('validityDate') and self.valid_key('validityTime'):
+        #    inventory.append(
+        #    ':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']
+            if ens_type == 0:
+               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)
+            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")
+            elif self['derivedForecast'] == 1:
+                inventory.append(":weighted ens mean")
+            elif self['derivedForecast'] == 2:
+                inventory.append(":ens std dev")
+            elif self['derivedForecast'] == 3:
+                inventory.append(":normalized ens std dev")
+            elif self['derivedForecast'] == 4:
+                inventory.append(":ens spread")
+            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'):
+            inventory.append(":"+self['probabilityTypeName'])
+            lowerlim = None
+            if self.valid_key('scaledValueOfLowerLimit') and\
+               self.valid_key('scaleFactorOfLowerLimit'):
+               if self['scaledValueOfLowerLimit'] and\
+                  self['scaleFactorOfLowerLimit']: 
+                   lowerlim = self['scaledValueOfLowerLimit']/\
+                              np.power(10.0,self['scaleFactorOfLowerLimit'])
+            upperlim = None
+            if self.valid_key('scaledValueOfUpperLimit') and\
+               self.valid_key('scaleFactorOfUpperLimit'):
+               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:
+                inventory.append(" (%s-%s)" % (upperlim,lowerlim))
+            elif upperlim is not None:
+                inventory.append(" (> %s)" % upperlim)
+            elif lowerlim is not None:
+                inventory.append(" (< %s)" % lowerlim)
+        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):
+            return self[key]
+        else:
+            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
+
+    def is_missing(self,key):
+        """
+        is_missing(key)
+
+        returns True if value associated with key is equal
+        to grib missing value flag (False otherwise)"""
+        cdef int err,miss
+        cdef char *name
+        bytestr = _strencode(key)
+        name = bytestr
+        miss = grib_is_missing(self._gh, name, &err)
+        if err:
+            raise RuntimeError(grib_get_error_message(err))
+        if miss:
+            return True
+        else:
+            return False
+    def keys(self):
+        """
+        keys()
+
+        return keys associated with a grib message (a dictionary-like object)
+        """
+        cdef grib_keys_iterator* gi
+        cdef int err, typ
+        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,\
+                GRIB_KEYS_ITERATOR_ALL_KEYS, NULL)
+        keys = []
+        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",
+                       "localDir","7777","oneThousand"]:
+                continue
+            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\
+            [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))
+        # 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):
+        """
+        _read_only_keys()
+
+        return read-only keys associated with a grib message (a dictionary-like object)
+        """
+        cdef grib_keys_iterator* gi
+        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,\
+                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')
+            keys_noro.append(key)
+        err = grib_keys_iterator_delete(gi)
+        if err:
+            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)
+        return keys_ro
+    def data(self,lat1=None,lat2=None,lon1=None,lon2=None):
+        """
+	data(lat1=None,lat2=None,lon1=None,lon2=None)
+
+	extract data, lats and lons for a subset region defined
+	by the keywords lat1,lat2,lon1,lon2.
+
+        The default values of lat1,lat2,lon1,lon2 are None, which
+        means the entire grid is returned.
+
+        If the grid type is unprojected lat/lon and a geographic
+        subset is requested (by using the lat1,lat2,lon1,lon2 keywords),
+        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:
+            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()
+            if lon2 is None: lon2 = lons.max()
+            masklat = (lats >= lat1) & (lats <= lat2)
+            masklon = (lons >= lon1) & (lons <= lon2)
+            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
+            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):
+                    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))
+        return datsubset,latsubset, lonsubset
+    def __setitem__(self, key, value):
+        """
+        change values associated with existing grib keys.
+        """
+        cdef int err, typ
+        cdef size_t size
+        cdef char *name
+        cdef long longval
+        cdef double doubleval
+        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:
+            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)
+        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)
+            is_array = False
+            if datarr.shape:
+                is_array = True
+            if not is_array: # scalar
+                longval = value
+                err = grib_set_long(self._gh, name, longval)
+                if err:
+                    raise RuntimeError(grib_get_error_message(err))
+            else:
+                if key == 'values':
+                    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)
+                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)
+            is_array = False
+            if datarr.shape:
+                is_array = True
+            if not is_array: # scalar
+                doubleval = value
+                err = grib_set_double(self._gh, name, doubleval)
+                if err:
+                    raise RuntimeError(grib_get_error_message(err))
+            else:
+                if key == 'values':
+                    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)
+                if err:
+                    raise RuntimeError(grib_get_error_message(err))
+        elif typ == GRIB_TYPE_STRING:
+            size=len(value)
+            bytestr = _strencode(value)
+            strdata = bytestr
+            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)
+    def __getitem__(self, key):
+        """
+        access values associated with grib keys.
+        
+        The key "values" will return the data associated with the grib message.
+        The data is returned as a numpy array, or if missing values or a bitmap
+        are present, a numpy masked array.  Reduced lat/lon or gaussian grid
+        data is automatically expanded to a regular grid using linear
+        interpolation (nearest neighbor if an adjacent grid point is a missing
+        value)."""
+        cdef int err, typ
+        cdef size_t size
+        cdef char *name
+        cdef long longval
+        cdef double doubleval
+        cdef ndarray datarr
+        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.
+        if usenceplib:
+            size = self.numberOfValues 
+        else:
+            err = grib_get_size(self._gh, name, &size)
+            if err:
+                if tolerate_badgrib:
+                    return None
+                else:
+                    raise RuntimeError(grib_get_error_message(err))
+        # this workaround only needed for grib_api < 1.9.16.
+        if usenceplib:
+            typ = 2
+            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
+        # 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:
+            if size == 1: # scalar
+                err = grib_get_long(self._gh, name, &longval)
+                if err:
+                    raise RuntimeError(grib_get_error_message(err))
+                return longval
+            else: # array
+                if self.has_key('jPointsAreConsecutive') and\
+                   self['jPointsAreConsecutive']:
+                    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)
+                if err:
+                    raise RuntimeError(grib_get_error_message(err))
+                if key == 'values':
+                    return self._reshape_mask(datarr)
+                else:
+                    return datarr
+        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))
+                return doubleval
+            else: # array
+                if self.has_key('jPointsAreConsecutive') and\
+                   self['jPointsAreConsecutive']:
+                    storageorder='F'
+                else:
+                    storageorder='C'
+                if usenceplib: 
+                    # 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:
+                    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':
+                        return self._reshape_mask(datarr)
+                    else:
+                        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:
+                raise RuntimeError(grib_get_error_message(err))
+            msg = strdata.decode(default_encoding)
+            return msg.rstrip()
+        else:
+            raise ValueError("unrecognized grib type % d" % typ)
+    def has_key(self,key):
+        """
+        has_key(key)
+
+        tests whether a grib message object has a specified key.
+        """
+        return key in self._all_keys
+    def valid_key(self,key):
+        """
+        valid_key(key)
+
+        tests whether a grib message object has a specified key,
+        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
+        if ret:
+            try:
+                self[key]
+            except:
+                ret = False
+        return ret
+    def tostring(self):
+        """
+        tostring()
+
+        return coded grib message in a binary string.
+        """
+        cdef int err
+        cdef size_t size
+        cdef void *message
+        cdef char *name
+        cdef FILE *out
+        bytestr = b'values'
+        name = bytestr
+        usenceplib = self.packingType.startswith('grid_complex')
+        # this workaround only needed for grib_api < 1.9.16.
+        if usenceplib:
+            size = self.numberOfValues
+        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)
+        if err:
+            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"""
+        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):
+            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")
+        if datarr.ndim == 2:
+            # check scan modes for rect grids.
+            # columns scan in the -y direction (so flip)
+            #if not self['jScansPositively']:
+            #    datsave = datarr.copy()
+            #    datarr[::-1,:] = datsave[:,:]
+            # rows scan in the -x direction (so flip)
+            #if self['iScansNegatively']:
+            #    datsave = datarr.copy()
+            #    datarr[:,::-1] = datsave[:,:]
+            # adjacent rows scan in opposite direction.
+            # (flip every other row)
+            if self['alternativeRowScanning']:
+                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"""
+        cdef double missval
+        from redtoreg import _redtoreg
+        if datarr.ndim > 2:
+            raise ValueError('array must be 1d or 2d')
+        # reduced grid.
+        if self['gridType'].startswith('reduced'):
+            try:
+                ny = self['Ny']
+            except:
+                ny = self['Nj']
+            if self.has_key('missingValue'):
+                missval = self['missingValue']
+            else:
+                missval = 1.e30
+            if self.expand_reduced:
+                nx = 2*ny
+                datarr = _redtoreg(2*ny, self['pl'], datarr, missval)
+            else:
+                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
+        elif self.has_key('Ni') and self.has_key('Nj'):
+            nx = self['Ni']
+            ny = self['Nj']
+        else: # probably spectral data.
+            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.
+        if datarr.ndim == 2:
+           # columns scan in the -y direction (so flip)
+           #if not self['jScansPositively']:
+           #    datsave = datarr.copy()
+           #    datarr[:,:] = datsave[::-1,:]
+           # rows scan in the -x direction (so flip)
+           #if self['iScansNegatively']:
+           #    datsave = datarr.copy()
+           #    datarr[:,:] = datsave[:,::-1]
+           # adjacent rows scan in opposite direction.
+           # (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,
+           # create a masked array.
+           if self.has_key('missingValue') and self['numberOfMissing']:
+               datarr = ma.masked_values(datarr, self['missingValue'])
+        return datarr
+
+    def _set_projparams(self):
+        """
+        sets the C{projparams} instance variable to a dictionary containing 
+        proj4 key/value pairs describing the grid.
+        """
+        projparams = {}
+
+        # 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']
+        else:
+            if self['shapeOfTheEarth'] == 6:
+                projparams['a']=6371229.0
+                projparams['b']=6371229.0
+            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:
+                        scalea = np.power(10.0,-scalea)
+                        if self['shapeOfTheEarth'] == 3: # radius in km
+                            scalea = 1000.*scalea
+                    else:
+                        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
+                    else:
+                        scaleb = 1.
+                else:
+                    scalea = 1.
+                    scaleb = 1.
+                if grib_api_version < 10900:
+                    projparams['a']=self['scaledValueOfMajorAxisOfOblateSpheroidEarth']*scalea
+                    projparams['b']=self['scaledValueOfMinorAxisOfOblateSpheroidEarth']*scaleb
+                else:
+                    projparams['a']=self['scaledValueOfEarthMajorAxis']*scalea
+                    projparams['b']=self['scaledValueOfEarthMinorAxis']*scaleb
+            elif self['shapeOfTheEarth'] == 2:
+                projparams['a']=6378160.0
+                projparams['b']=6356775.0 
+            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)
+                    else:
+                        scalea = 1
+                    scaleb = scalea
+                else:
+                    scalea = 1.
+                    scaleb = 1.
+                projparams['a']=self['scaledValueOfRadiusOfSphericalEarth']*scalea
+                projparams['b']=self['scaledValueOfRadiusOfSphericalEarth']*scaleb
+            elif self['shapeOfTheEarth'] == 0:
+                projparams['a']=6367470.0
+                projparams['b']=6367470.0
+            elif self['shapeOfTheEarth'] == 5: # WGS84
+                projparams['a']=6378137.0
+                projparams['b']=6356752.3142
+            elif self['shapeOfTheEarth'] == 8:
+                projparams['a']=6371200.0
+                projparams['b']=6371200.0
+            else:
+                if not tolerate_badgrib: raise ValueError('unknown shape of the earth flag')
+
+        if 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']
+            if self.has_key('projectionCentreFlag'):
+                projcenterflag = self['projectionCentreFlag']
+            elif self.has_key('projectionCenterFlag'):
+                projcenterflag = self['projectionCenterFlag']
+            else:
+                if not tolerate_badgrib: raise KeyError('cannot find projection center flag')
+            if projcenterflag == 0:
+                projparams['lat_0']=90.
+            else:
+                projparams['lat_0']=-90.
+            projparams['lon_0']=self['orientationOfTheGridInDegrees']
+        elif self['gridType'] == 'lambert':
+            projparams['proj']='lcc'
+            projparams['lon_0']=self['LoVInDegrees']
+            projparams['lat_0']=self['LaDInDegrees']
+            projparams['lat_1']=self['Latin1InDegrees']
+            projparams['lat_2']=self['Latin2InDegrees']
+        elif self['gridType'] =='albers':
+            projparams['proj']='aea'
+            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
+            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'])
+            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']
+            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:
+                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']
+        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":
+            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 scale:
+                scale = float(scale)
+            else:
+                scale = 1000.
+            lon1 = self['longitudeOfFirstGridPoint']/scale
+            lon2 = self['longitudeOfLastGridPoint']/scale
+            if self._get_key('truncateDegrees',False):
+                lon1 = int(lon1)
+                lon2 = int(lon2)
+            if self._get_key('LaD',False):
+                projparams['lat_ts'] = self['LaD']/scale
+            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']:
+            rot_angle = self['angleOfRotationInDegrees']
+            pole_lat = self['latitudeOfSouthernPoleInDegrees']
+            pole_lon = self['longitudeOfSouthernPoleInDegrees']
+            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
+        else: # unsupported grid type.
+            projparams = None
+        self.projparams = projparams
+
+    def latlons(self):
+        """
+        latlons()
+
+        compute lats and lons (in degrees) of grid.
+        Currently handles reg. lat/lon, global gaussian, mercator, stereographic,
+        lambert conformal, albers equal-area, space-view, azimuthal 
+        equidistant, reduced gaussian, reduced lat/lon,
+        lambert azimuthal equal-area, rotated lat/lon and rotated gaussian grids.
+
+        @return: C{B{lats},B{lons}}, numpy arrays 
+        containing latitudes and longitudes of grid (in degrees).
+        """
+
+        if self.projparams is None:
+            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']
+            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:
+                lon1 = lon1-360
+            lat1 = self['latitudeOfFirstGridPointInDegrees']
+            lat2 = self['latitudeOfLastGridPointInDegrees']
+            # workaround for grib_api bug with complex packing.
+            # (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.
+                lats = np.linspace(lat1,lat2,ny)
+                lons = np.linspace(lon1,lon2,nx)
+            else:
+                lats = self['distinctLatitudes']
+                if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]
+                lons = self['distinctLongitudes']
+            # don't trust distinctLongitudes 
+            # 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) 
+        elif self['gridType'] == 'reduced_gg': # reduced global gaussian grid
+            if self.expand_reduced:
+                lat1 = self['latitudeOfFirstGridPointInDegrees']
+                lat2 = self['latitudeOfLastGridPointInDegrees']
+                lats = self['distinctLatitudes']
+                if lat2 < lat1 and lats[-1] > lats[0]: lats = lats[::-1]
+                ny = self['Nj']
+                nx = 2*ny
+                lon1 = self['longitudeOfFirstGridPointInDegrees']
+                lon2 = self['longitudeOfLastGridPointInDegrees']
+                lons = np.linspace(lon1,lon2,nx)
+                lons,lats = np.meshgrid(lons,lats) 
+            else:
+                lats = self['latitudes']
+                lons = self['longitudes']
+        elif self['gridType'] == 'reduced_ll': # reduced lat/lon grid
+            if self.expand_reduced:
+                ny = self['Nj']
+                nx = 2*ny
+                lat1 = self['latitudeOfFirstGridPointInDegrees']
+                lat2 = self['latitudeOfLastGridPointInDegrees']
+                lon1 = self['longitudeOfFirstGridPointInDegrees']
+                lon2 = self['longitudeOfLastGridPointInDegrees']
+                lons = np.linspace(lon1,lon2,nx)
+                lats = np.linspace(lat1,lat2,ny)
+                lons,lats = np.meshgrid(lons,lats) 
+            else:
+                lats = self['latitudes']
+                lons = self['longitudes']
+        elif self['gridType'] == 'polar_stereographic':
+            lat1 = self['latitudeOfFirstGridPointInDegrees']
+            lon1 = self['longitudeOfFirstGridPointInDegrees']
+            try:
+                nx = self['Nx']
+                ny = self['Ny']
+            except:
+                nx = self['Ni']
+                ny = self['Nj']
+            # key renamed from xDirectionGridLengthInMetres to
+            # DxInMetres grib_api 1.8.0.1.
+            try:
+                dx = self['DxInMetres']
+            except:
+                dx = self['xDirectionGridLengthInMetres']
+            try:
+                dy = self['DyInMetres']
+            except:
+                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)
+            x, y = np.meshgrid(x, y)
+            lons, lats = pj(x, y, inverse=True)
+        elif self['gridType'] == 'lambert':
+            lat1 = self['latitudeOfFirstGridPointInDegrees']
+            lon1 = self['longitudeOfFirstGridPointInDegrees']
+            try:
+                nx = self['Nx']
+                ny = self['Ny']
+            except:
+                nx = self['Ni']
+                ny = self['Nj']
+            dx = self['DxInMetres']
+            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)
+            x, y = np.meshgrid(x, y)
+            lons, lats = pj(x, y, inverse=True)
+        elif self['gridType'] =='albers':
+            lat1 = self['latitudeOfFirstGridPointInDegrees']
+            lon1 = self['longitudeOfFirstGridPointInDegrees']
+            try:
+                nx = self['Nx']
+                ny = self['Ny']
+            except:
+                nx = self['Ni']
+                ny = self['Nj']
+            dx = self['Dx']/1000.
+            dy = self['Dy']/1000.
+            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)
+            x, y = np.meshgrid(x, y)
+            lons, lats = pj(x, y, inverse=True)
+        elif self['gridType'] == 'space_view':
+            try:
+                nx = self['Nx']
+                ny = self['Ny']
+            except:
+                nx = self['Ni']
+                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')
+            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'])
+            # 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)
+            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
+            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)
+            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)
+            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
+            lat1 = self['latitudeOfFirstGridPointInDegrees']
+            lon1 = self['longitudeOfFirstGridPointInDegrees']
+            pj = pyproj.Proj(self.projparams)
+            llcrnrx, llcrnry = pj(lon1,lat1)
+            try:
+                nx = self['Nx']
+                ny = self['Ny']
+            except:
+                nx = self['Ni']
+                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)
+        elif self['gridType'] == "lambert_azimuthal_equal_area":
+            dx = self['Dx']/1.e3
+            dy = self['Dy']/1.e3
+            lat1 = self['latitudeOfFirstGridPointInDegrees']
+            lon1 = self['longitudeOfFirstGridPointInDegrees']
+            pj = pyproj.Proj(self.projparams)
+            llcrnrx, llcrnry = pj(lon1,lat1)
+            try:
+                nx = self['Nx']
+                ny = self['Ny']
+            except:
+                nx = self['Ni']
+                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)
+        elif self['gridType'] == 'mercator':
+            scale = self._get_key('grib2divider',False)
+            if scale:
+                scale = float(scale)
+            else:
+                scale = 1000.
+            lon1 = self['longitudeOfFirstGridPoint']/scale
+            lon2 = self['longitudeOfLastGridPoint']/scale
+            if self._get_key('truncateDegrees',False):
+                lon1 = int(lon1)
+                lon2 = int(lon2)
+            lat1 = self['latitudeOfFirstGridPoint']/scale
+            lat2 = self['latitudeOfLastGridPoint']/scale
+            if self._get_key('truncateDegrees',False):
+                lat1 = int(lat1)
+                lat2 = int(lat2)
+            pj = pyproj.Proj(self.projparams)
+            llcrnrx, llcrnry = pj(lon1,lat1)
+            urcrnrx, urcrnry = pj(lon2,lat2)
+            try:
+                nx = self['Nx']
+                ny = self['Ny']
+            except:
+                nx = self['Ni']
+                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)
+            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']
+            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:
+            raise ValueError('unsupported grid %s' % self['gridType'])
+        return lats, lons
+
+cdef class index(object):
+    """ 
+index(filename, *args)
+    
+returns grib index object given GRIB filename indexed by keys given in
+*args.  The L{select} or L{__call__} method can then be used to selected grib messages
+based on specified values of indexed keys.
+Unlike L{open.select}, containers or callables cannot be used to 
+select multiple key values.
+However, using L{index.select} is much faster than L{open.select}.
+
+B{Warning}:  Searching for data within multi-field grib messages does not
+work using an index (and is not supported by the 
+U{GRIB API<https://software.ecmwf.int/wiki/display/GRIB/Home>} library).  NCEP
+often puts u and v winds together in a single multi-field grib message.  You
+will get incorrect results if you try to use an index to find data in these
+messages.  Use the slower, but more robust L{open.select} in this case.
+
+If no key are given (i.e. *args is empty), it is assumed the filename represents a previously
+saved index (created using the C{grib_index_build} tool or L{index.write}) instead of a GRIB file.
+
+Example usage:
+
+>>> import pygrib
+>>> grbindx=pygrib.index('sampledata/gfs.grb','shortName','typeOfLevel','level')
+>>> selected_grbs=grbindx.select(shortName='gh',typeOfLevel='isobaricInhPa',level=500)
+>>> for grb in selected_grbs:
+>>>     grb
+1:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 500 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
+>>> # __call__ method does same thing as select
+>>> selected_grbs=grbindx(shortName='u',typeOfLevel='isobaricInhPa',level=250)
+>>> for grb in selected_grbs:
+>>>     grb
+1:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 250 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
+>>> grbindx.write('gfs.grb.idx') # save index to a file
+>>> grbindx.close()
+>>> grbindx = pygrib.index('gfs.grb.idx') # re-open index (no keys specified)
+>>> for grb in selected_grbs:
+>>>     grb
+1:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 250 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
+
+ at ivar keys: list of strings containing keys used in the index.
+
+ at ivar types: if keys are typed, this list contains the type declarations
+(C{l}, C{s} or C{d}). Type declarations are specified by appending to the key
+name (i.e. C{level:l} will search for values of C{level} that are longs).
+"""
+    cdef grib_index *_gi
+    cdef public object keys, types, name
+    def __cinit__(self, filename, *args):
+        # initialize C level objects.
+        cdef grib_index *gi
+        cdef int err
+        cdef char *filenamec, *keys
+        bytestr = _strencode(filename)
+        filenamec = bytestr
+        if args == ():
+            #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))
+        else:
+            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))
+            grbs = open(filename)
+            if grbs.has_multi_field_msgs:
+                msg="""
+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):
+        # initalize Python level objects
+        self.name = filename
+        self.keys = None
+        self.types = None
+        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 = []
+            for arg in args:
+                try: 
+                    type = arg.split(':')[1]
+                except IndexError:
+                    type = None
+                types.append(type)
+            self.keys = keys
+            self.types = types
+    def __call__(self, **kwargs):
+        """same as L{select}"""
+        return self.select(**kwargs)
+    def select(self, **kwargs):
+        """
+select(**kwargs)
+
+return a list of L{gribmessage} instances from grib index object 
+corresponding to specific values of indexed keys (given by kwargs).
+Unlike L{open.select}, containers or callables cannot be used to 
+select multiple key values.
+However, using L{index.select} is much faster than L{open.select}.
+
+Example usage:
+
+>>> import pygrib
+>>> grbindx=pygrib.index('sampledata/gfs.grb','shortName','typeOfLevel','level')
+>>> selected_grbs=grbindx.select(shortName='gh',typeOfLevel='isobaricInhPa',level=500)
+>>> for grb in selected_grbs:
+>>>     grb
+1:Geopotential height:gpm (instant):regular_ll:isobaricInhPa:level 500 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
+>>> # __call__ method does same thing as select
+>>> selected_grbs=grbindx(shortName='u',typeOfLevel='isobaricInhPa',level=250)
+>>> for grb in selected_grbs:
+>>>     grb
+1:u-component of wind:m s**-1 (instant):regular_ll:isobaricInhPa:level 250 Pa:fcst time 72 hrs:from 200412091200:lo res cntl fcst
+>>> grbindx.close()
+"""
+        cdef grib_handle *gh
+        cdef int err
+        cdef size_t size
+        cdef long longval
+        cdef double doubval
+        cdef char *strval, *key
+        # 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:
+                raise KeyError('key not part of grib index')
+            if self.types is not None:
+                typ = self.types[self.keys.index(k)]
+            else:
+                typ = None
+            bytestr = _strencode(k)
+            key = bytestr
+            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
+            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)
+                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)
+                if err:
+                    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)
+                if err:
+                    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:
+            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)
+            if err or gh == NULL:
+                break
+            else:
+                messagenumber = messagenumber + 1
+            grbs.append(_create_gribmessage(gh, messagenumber))
+            err = grib_handle_delete(gh)
+            if err:
+                raise RuntimeError(grib_get_error_message(err))
+        if not grbs:
+            raise ValueError('no matches found')
+        # return the list of grib messages.
+        return grbs
+    def write(self,filename):
+        """
+        write(filename)
+
+        save grib index to file"""
+        cdef char * filenamec
+        bytestr = _strencode(filename)
+        filenamec = bytestr
+        err = grib_index_write(self._gi, filenamec);
+        if err:
+            raise RuntimeError(grib_get_error_message(err))
+    def close(self):
+        """
+        close()
+
+        deallocate C structures associated with class instance"""
+        grib_index_delete(self._gi)
+        self._gi = NULL
+
+    def __dealloc__(self):
+        # deallocate storage when there are no more references
+        # to the object.
+        if self._gi != NULL:
+            grib_index_delete(self._gi)
+
+def _is_stringlike(a):
+    if type(a) == str or type(a) == bytes or type(a) == unicode:
+        return True
+    else:
+        return False
+
+def _is_container(a):
+    # 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
+    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.
+    # 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?
+        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.
+        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
+            continue
+        else:
+            return False
+    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.
+    if encoding is None:
+        encoding = default_encoding
+    try:
+        return pystr.encode(encoding)
+    except AttributeError:
+        return pystr # already bytes?
diff --git a/redtoreg.c b/redtoreg.c
new file mode 100644
index 0000000..cde85cc
--- /dev/null
+++ b/redtoreg.c
@@ -0,0 +1,5809 @@
+/* Generated by Cython 0.19.1 on Tue Nov 19 15:58:39 2013 */
+
+#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)
+    #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__redtoreg
+#define __PYX_HAVE_API__redtoreg
+#include "string.h"
+#include "stdio.h"
+#include "stdlib.h"
+#include "numpy/arrayobject.h"
+#include "numpy/ufuncobject.h"
+#ifdef _OPENMP
+#include <omp.h>
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define CYTHON_UNUSED __attribute__ ((__unused__))
+#   else
+#     define CYTHON_UNUSED
+#   endif
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+#   define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+#   define CYTHON_UNUSED
+# endif
+#endif
+typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
+                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
+#define __PYX_DEFAULT_STRING_ENCODING ""
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+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;
+
+#if !defined(CYTHON_CCOMPLEX)
+  #if defined(__cplusplus)
+    #define CYTHON_CCOMPLEX 1
+  #elif defined(_Complex_I)
+    #define CYTHON_CCOMPLEX 1
+  #else
+    #define CYTHON_CCOMPLEX 0
+  #endif
+#endif
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    #include <complex>
+  #else
+    #include <complex.h>
+  #endif
+#endif
+#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
+  #undef _Complex_I
+  #define _Complex_I 1.0fj
+#endif
+
+
+static const char *__pyx_f[] = {
+  "redtoreg.pyx",
+  "numpy.pxd",
+  "type.pxd",
+};
+
+/* "numpy.pxd":723
+ * # in Cython to enable them only on the right systems.
+ * 
+ * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_int16      int16_t
+ * ctypedef npy_int32      int32_t
+ */
+typedef npy_int8 __pyx_t_5numpy_int8_t;
+
+/* "numpy.pxd":724
+ * 
+ * ctypedef npy_int8       int8_t
+ * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_int32      int32_t
+ * ctypedef npy_int64      int64_t
+ */
+typedef npy_int16 __pyx_t_5numpy_int16_t;
+
+/* "numpy.pxd":725
+ * ctypedef npy_int8       int8_t
+ * ctypedef npy_int16      int16_t
+ * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_int64      int64_t
+ * #ctypedef npy_int96      int96_t
+ */
+typedef npy_int32 __pyx_t_5numpy_int32_t;
+
+/* "numpy.pxd":726
+ * ctypedef npy_int16      int16_t
+ * ctypedef npy_int32      int32_t
+ * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
+ * #ctypedef npy_int96      int96_t
+ * #ctypedef npy_int128     int128_t
+ */
+typedef npy_int64 __pyx_t_5numpy_int64_t;
+
+/* "numpy.pxd":730
+ * #ctypedef npy_int128     int128_t
+ * 
+ * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_uint16     uint16_t
+ * ctypedef npy_uint32     uint32_t
+ */
+typedef npy_uint8 __pyx_t_5numpy_uint8_t;
+
+/* "numpy.pxd":731
+ * 
+ * ctypedef npy_uint8      uint8_t
+ * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_uint32     uint32_t
+ * ctypedef npy_uint64     uint64_t
+ */
+typedef npy_uint16 __pyx_t_5numpy_uint16_t;
+
+/* "numpy.pxd":732
+ * ctypedef npy_uint8      uint8_t
+ * ctypedef npy_uint16     uint16_t
+ * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_uint64     uint64_t
+ * #ctypedef npy_uint96     uint96_t
+ */
+typedef npy_uint32 __pyx_t_5numpy_uint32_t;
+
+/* "numpy.pxd":733
+ * ctypedef npy_uint16     uint16_t
+ * ctypedef npy_uint32     uint32_t
+ * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
+ * #ctypedef npy_uint96     uint96_t
+ * #ctypedef npy_uint128    uint128_t
+ */
+typedef npy_uint64 __pyx_t_5numpy_uint64_t;
+
+/* "numpy.pxd":737
+ * #ctypedef npy_uint128    uint128_t
+ * 
+ * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_float64    float64_t
+ * #ctypedef npy_float80    float80_t
+ */
+typedef npy_float32 __pyx_t_5numpy_float32_t;
+
+/* "numpy.pxd":738
+ * 
+ * ctypedef npy_float32    float32_t
+ * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
+ * #ctypedef npy_float80    float80_t
+ * #ctypedef npy_float128   float128_t
+ */
+typedef npy_float64 __pyx_t_5numpy_float64_t;
+
+/* "numpy.pxd":747
+ * # The int types are mapped a bit surprising --
+ * # numpy.int corresponds to 'l' and numpy.long to 'q'
+ * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_longlong   long_t
+ * ctypedef npy_longlong   longlong_t
+ */
+typedef npy_long __pyx_t_5numpy_int_t;
+
+/* "numpy.pxd":748
+ * # numpy.int corresponds to 'l' and numpy.long to 'q'
+ * ctypedef npy_long       int_t
+ * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_longlong   longlong_t
+ * 
+ */
+typedef npy_longlong __pyx_t_5numpy_long_t;
+
+/* "numpy.pxd":749
+ * ctypedef npy_long       int_t
+ * ctypedef npy_longlong   long_t
+ * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
+ * 
+ * ctypedef npy_ulong      uint_t
+ */
+typedef npy_longlong __pyx_t_5numpy_longlong_t;
+
+/* "numpy.pxd":751
+ * ctypedef npy_longlong   longlong_t
+ * 
+ * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_ulonglong  ulong_t
+ * ctypedef npy_ulonglong  ulonglong_t
+ */
+typedef npy_ulong __pyx_t_5numpy_uint_t;
+
+/* "numpy.pxd":752
+ * 
+ * ctypedef npy_ulong      uint_t
+ * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_ulonglong  ulonglong_t
+ * 
+ */
+typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
+
+/* "numpy.pxd":753
+ * ctypedef npy_ulong      uint_t
+ * ctypedef npy_ulonglong  ulong_t
+ * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
+ * 
+ * ctypedef npy_intp       intp_t
+ */
+typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
+
+/* "numpy.pxd":755
+ * ctypedef npy_ulonglong  ulonglong_t
+ * 
+ * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_uintp      uintp_t
+ * 
+ */
+typedef npy_intp __pyx_t_5numpy_intp_t;
+
+/* "numpy.pxd":756
+ * 
+ * ctypedef npy_intp       intp_t
+ * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
+ * 
+ * ctypedef npy_double     float_t
+ */
+typedef npy_uintp __pyx_t_5numpy_uintp_t;
+
+/* "numpy.pxd":758
+ * ctypedef npy_uintp      uintp_t
+ * 
+ * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_double     double_t
+ * ctypedef npy_longdouble longdouble_t
+ */
+typedef npy_double __pyx_t_5numpy_float_t;
+
+/* "numpy.pxd":759
+ * 
+ * ctypedef npy_double     float_t
+ * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_longdouble longdouble_t
+ * 
+ */
+typedef npy_double __pyx_t_5numpy_double_t;
+
+/* "numpy.pxd":760
+ * ctypedef npy_double     float_t
+ * ctypedef npy_double     double_t
+ * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
+ * 
+ * ctypedef npy_cfloat      cfloat_t
+ */
+typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    typedef ::std::complex< float > __pyx_t_float_complex;
+  #else
+    typedef float _Complex __pyx_t_float_complex;
+  #endif
+#else
+    typedef struct { float real, imag; } __pyx_t_float_complex;
+#endif
+
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    typedef ::std::complex< double > __pyx_t_double_complex;
+  #else
+    typedef double _Complex __pyx_t_double_complex;
+  #endif
+#else
+    typedef struct { double real, imag; } __pyx_t_double_complex;
+#endif
+
+
+/*--- Type declarations ---*/
+
+/* "numpy.pxd":762
+ * ctypedef npy_longdouble longdouble_t
+ * 
+ * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_cdouble     cdouble_t
+ * ctypedef npy_clongdouble clongdouble_t
+ */
+typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
+
+/* "numpy.pxd":763
+ * 
+ * ctypedef npy_cfloat      cfloat_t
+ * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
+ * ctypedef npy_clongdouble clongdouble_t
+ * 
+ */
+typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
+
+/* "numpy.pxd":764
+ * ctypedef npy_cfloat      cfloat_t
+ * ctypedef npy_cdouble     cdouble_t
+ * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
+ * 
+ * ctypedef npy_cdouble     complex_t
+ */
+typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
+
+/* "numpy.pxd":766
+ * ctypedef npy_clongdouble clongdouble_t
+ * 
+ * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
+ * 
+ * cdef inline object PyArray_MultiIterNew1(a):
+ */
+typedef npy_cdouble __pyx_t_5numpy_complex_t;
+#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_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*/
+
+static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
+    const char *name, int exact); /*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_mod_long(long, long); /* proto */
+
+#ifndef __PYX_FORCE_INIT_THREADS
+  #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+
+static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
+
+static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
+
+static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
+
+static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/
+
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    #define __Pyx_CREAL(z) ((z).real())
+    #define __Pyx_CIMAG(z) ((z).imag())
+  #else
+    #define __Pyx_CREAL(z) (__real__(z))
+    #define __Pyx_CIMAG(z) (__imag__(z))
+  #endif
+#else
+    #define __Pyx_CREAL(z) ((z).real)
+    #define __Pyx_CIMAG(z) ((z).imag)
+#endif
+#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX
+    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
+    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
+#else
+    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
+    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
+#endif
+
+static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
+
+#if CYTHON_CCOMPLEX
+    #define __Pyx_c_eqf(a, b)   ((a)==(b))
+    #define __Pyx_c_sumf(a, b)  ((a)+(b))
+    #define __Pyx_c_difff(a, b) ((a)-(b))
+    #define __Pyx_c_prodf(a, b) ((a)*(b))
+    #define __Pyx_c_quotf(a, b) ((a)/(b))
+    #define __Pyx_c_negf(a)     (-(a))
+  #ifdef __cplusplus
+    #define __Pyx_c_is_zerof(z) ((z)==(float)0)
+    #define __Pyx_c_conjf(z)    (::std::conj(z))
+    #if 1
+        #define __Pyx_c_absf(z)     (::std::abs(z))
+        #define __Pyx_c_powf(a, b)  (::std::pow(a, b))
+    #endif
+  #else
+    #define __Pyx_c_is_zerof(z) ((z)==0)
+    #define __Pyx_c_conjf(z)    (conjf(z))
+    #if 1
+        #define __Pyx_c_absf(z)     (cabsf(z))
+        #define __Pyx_c_powf(a, b)  (cpowf(a, b))
+    #endif
+ #endif
+#else
+    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
+    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
+    #if 1
+        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
+        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
+    #endif
+#endif
+
+static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
+
+#if CYTHON_CCOMPLEX
+    #define __Pyx_c_eq(a, b)   ((a)==(b))
+    #define __Pyx_c_sum(a, b)  ((a)+(b))
+    #define __Pyx_c_diff(a, b) ((a)-(b))
+    #define __Pyx_c_prod(a, b) ((a)*(b))
+    #define __Pyx_c_quot(a, b) ((a)/(b))
+    #define __Pyx_c_neg(a)     (-(a))
+  #ifdef __cplusplus
+    #define __Pyx_c_is_zero(z) ((z)==(double)0)
+    #define __Pyx_c_conj(z)    (::std::conj(z))
+    #if 1
+        #define __Pyx_c_abs(z)     (::std::abs(z))
+        #define __Pyx_c_pow(a, b)  (::std::pow(a, b))
+    #endif
+  #else
+    #define __Pyx_c_is_zero(z) ((z)==0)
+    #define __Pyx_c_conj(z)    (conj(z))
+    #if 1
+        #define __Pyx_c_abs(z)     (cabs(z))
+        #define __Pyx_c_pow(a, b)  (cpow(a, b))
+    #endif
+ #endif
+#else
+    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
+    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
+    #if 1
+        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
+        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
+    #endif
+#endif
+
+static CYTHON_INLINE 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 'cpython.buffer' */
+
+/* Module declarations from 'cpython.ref' */
+
+/* Module declarations from 'libc.string' */
+
+/* Module declarations from 'libc.stdio' */
+
+/* Module declarations from 'cpython.object' */
+
+/* Module declarations from '__builtin__' */
+
+/* Module declarations from 'cpython.type' */
+static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
+
+/* Module declarations from 'libc.stdlib' */
+
+/* Module declarations from 'numpy' */
+
+/* Module declarations from 'numpy' */
+static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
+static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
+static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
+static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
+static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
+static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
+
+/* Module declarations from 'redtoreg' */
+#define __Pyx_MODULE_NAME "redtoreg"
+int __pyx_module_is_main_redtoreg = 0;
+
+/* Implementation of 'redtoreg' */
+static PyObject *__pyx_builtin_ValueError;
+static PyObject *__pyx_builtin_range;
+static PyObject *__pyx_builtin_RuntimeError;
+static PyObject *__pyx_pf_8redtoreg__redtoreg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nlonsin, PyArrayObject *__pyx_v_lonsperlat, PyArrayObject *__pyx_v_redgrid, PyObject *__pyx_v_missval); /* proto */
+static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
+static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
+static char __pyx_k_1[] = "size of reduced grid does not match number of data values";
+static char __pyx_k_2[] = "ndarray is not C contiguous";
+static char __pyx_k_4[] = "ndarray is not Fortran contiguous";
+static char __pyx_k_6[] = "Non-native byte order not supported";
+static char __pyx_k_8[] = "unknown dtype code in numpy.pxd (%d)";
+static char __pyx_k_9[] = "Format string allocated too short, see comment in numpy.pxd";
+static char __pyx_k_12[] = "Format string allocated too short.";
+static char __pyx_k_16[] = "/Volumes/User/jwhitaker/python/pygrib/redtoreg.pyx";
+static char __pyx_k__B[] = "B";
+static char __pyx_k__H[] = "H";
+static char __pyx_k__I[] = "I";
+static char __pyx_k__L[] = "L";
+static char __pyx_k__O[] = "O";
+static char __pyx_k__Q[] = "Q";
+static char __pyx_k__b[] = "b";
+static char __pyx_k__d[] = "d";
+static char __pyx_k__f[] = "f";
+static char __pyx_k__g[] = "g";
+static char __pyx_k__h[] = "h";
+static char __pyx_k__i[] = "i";
+static char __pyx_k__j[] = "j";
+static char __pyx_k__l[] = "l";
+static char __pyx_k__n[] = "n";
+static char __pyx_k__q[] = "q";
+static char __pyx_k__Zd[] = "Zd";
+static char __pyx_k__Zf[] = "Zf";
+static char __pyx_k__Zg[] = "Zg";
+static char __pyx_k__im[] = "im";
+static char __pyx_k__ip[] = "ip";
+static char __pyx_k__np[] = "np";
+static char __pyx_k__msg[] = "msg";
+static char __pyx_k__sum[] = "sum";
+static char __pyx_k__zdx[] = "zdx";
+static char __pyx_k__zxi[] = "zxi";
+static char __pyx_k__indx[] = "indx";
+static char __pyx_k__npts[] = "npts";
+static char __pyx_k__ones[] = "ones";
+static char __pyx_k__flons[] = "flons";
+static char __pyx_k__ilons[] = "ilons";
+static char __pyx_k__nlats[] = "nlats";
+static char __pyx_k__nlons[] = "nlons";
+static char __pyx_k__numpy[] = "numpy";
+static char __pyx_k__range[] = "range";
+static char __pyx_k__double[] = "double";
+static char __pyx_k__missvl[] = "missvl";
+static char __pyx_k__lonsptr[] = "lonsptr";
+static char __pyx_k__missval[] = "missval";
+static char __pyx_k__nlonsin[] = "nlonsin";
+static char __pyx_k__redgrid[] = "redgrid";
+static char __pyx_k__reggrid[] = "reggrid";
+static char __pyx_k____main__[] = "__main__";
+static char __pyx_k____test__[] = "__test__";
+static char __pyx_k__redtoreg[] = "redtoreg";
+static char __pyx_k___redtoreg[] = "_redtoreg";
+static char __pyx_k__redgrdptr[] = "redgrdptr";
+static char __pyx_k__reggrdptr[] = "reggrdptr";
+static char __pyx_k__ValueError[] = "ValueError";
+static char __pyx_k____import__[] = "__import__";
+static char __pyx_k__lonsperlat[] = "lonsperlat";
+static char __pyx_k__RuntimeError[] = "RuntimeError";
+static PyObject *__pyx_kp_s_1;
+static PyObject *__pyx_kp_u_12;
+static PyObject *__pyx_kp_s_16;
+static PyObject *__pyx_kp_u_2;
+static PyObject *__pyx_kp_u_4;
+static PyObject *__pyx_kp_u_6;
+static PyObject *__pyx_kp_u_8;
+static PyObject *__pyx_kp_u_9;
+static PyObject *__pyx_n_s__RuntimeError;
+static PyObject *__pyx_n_s__ValueError;
+static PyObject *__pyx_n_s____import__;
+static PyObject *__pyx_n_s____main__;
+static PyObject *__pyx_n_s____test__;
+static PyObject *__pyx_n_s___redtoreg;
+static PyObject *__pyx_n_s__double;
+static PyObject *__pyx_n_s__flons;
+static PyObject *__pyx_n_s__i;
+static PyObject *__pyx_n_s__ilons;
+static PyObject *__pyx_n_s__im;
+static PyObject *__pyx_n_s__indx;
+static PyObject *__pyx_n_s__ip;
+static PyObject *__pyx_n_s__j;
+static PyObject *__pyx_n_s__lonsperlat;
+static PyObject *__pyx_n_s__lonsptr;
+static PyObject *__pyx_n_s__missval;
+static PyObject *__pyx_n_s__missvl;
+static PyObject *__pyx_n_s__msg;
+static PyObject *__pyx_n_s__n;
+static PyObject *__pyx_n_s__nlats;
+static PyObject *__pyx_n_s__nlons;
+static PyObject *__pyx_n_s__nlonsin;
+static PyObject *__pyx_n_s__np;
+static PyObject *__pyx_n_s__npts;
+static PyObject *__pyx_n_s__numpy;
+static PyObject *__pyx_n_s__ones;
+static PyObject *__pyx_n_s__range;
+static PyObject *__pyx_n_s__redgrdptr;
+static PyObject *__pyx_n_s__redgrid;
+static PyObject *__pyx_n_s__redtoreg;
+static PyObject *__pyx_n_s__reggrdptr;
+static PyObject *__pyx_n_s__reggrid;
+static PyObject *__pyx_n_s__sum;
+static PyObject *__pyx_n_s__zdx;
+static PyObject *__pyx_n_s__zxi;
+static PyObject *__pyx_int_15;
+static PyObject *__pyx_k_tuple_3;
+static PyObject *__pyx_k_tuple_5;
+static PyObject *__pyx_k_tuple_7;
+static PyObject *__pyx_k_tuple_10;
+static PyObject *__pyx_k_tuple_11;
+static PyObject *__pyx_k_tuple_13;
+static PyObject *__pyx_k_tuple_14;
+static PyObject *__pyx_k_codeobj_15;
+
+/* Python wrapper */
+static PyObject *__pyx_pw_8redtoreg_1_redtoreg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_8redtoreg__redtoreg[] = "\n    convert data on global reduced gaussian to global\n    full gaussian grid using linear interpolation.\n    ";
+static PyMethodDef __pyx_mdef_8redtoreg_1_redtoreg = {__Pyx_NAMESTR("_redtoreg"), (PyCFunction)__pyx_pw_8redtoreg_1_redtoreg, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8redtoreg__redtoreg)};
+static PyObject *__pyx_pw_8redtoreg_1_redtoreg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_nlonsin = 0;
+  PyArrayObject *__pyx_v_lonsperlat = 0;
+  PyArrayObject *__pyx_v_redgrid = 0;
+  PyObject *__pyx_v_missval = 0;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("_redtoreg (wrapper)", 0);
+  {
+    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__nlonsin,&__pyx_n_s__lonsperlat,&__pyx_n_s__redgrid,&__pyx_n_s__missval,0};
+    PyObject* values[4] = {0,0,0,0};
+    if (unlikely(__pyx_kwds)) {
+      Py_ssize_t kw_args;
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
+        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        case  0: break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+      kw_args = PyDict_Size(__pyx_kwds);
+      switch (pos_args) {
+        case  0:
+        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__nlonsin)) != 0)) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lonsperlat)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_redtoreg", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  2:
+        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__redgrid)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_redtoreg", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+        case  3:
+        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__missval)) != 0)) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("_redtoreg", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_redtoreg") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
+      goto __pyx_L5_argtuple_error;
+    } else {
+      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+    }
+    __pyx_v_nlonsin = values[0];
+    __pyx_v_lonsperlat = ((PyArrayObject *)values[1]);
+    __pyx_v_redgrid = ((PyArrayObject *)values[2]);
+    __pyx_v_missval = values[3];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("_redtoreg", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("redtoreg._redtoreg", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lonsperlat), __pyx_ptype_5numpy_ndarray, 1, "lonsperlat", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_redgrid), __pyx_ptype_5numpy_ndarray, 1, "redgrid", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_r = __pyx_pf_8redtoreg__redtoreg(__pyx_self, __pyx_v_nlonsin, __pyx_v_lonsperlat, __pyx_v_redgrid, __pyx_v_missval);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "redtoreg.pyx":3
+ * import numpy as np
+ * cimport numpy as npc
+ * def _redtoreg(object nlonsin, npc.ndarray lonsperlat, npc.ndarray redgrid, \             # <<<<<<<<<<<<<<
+ *               object missval):
+ *     """
+ */
+
+static PyObject *__pyx_pf_8redtoreg__redtoreg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nlonsin, PyArrayObject *__pyx_v_lonsperlat, PyArrayObject *__pyx_v_redgrid, PyObject *__pyx_v_missval) {
+  long __pyx_v_i;
+  long __pyx_v_j;
+  long __pyx_v_n;
+  long __pyx_v_im;
+  long __pyx_v_ip;
+  long __pyx_v_indx;
+  long __pyx_v_ilons;
+  long __pyx_v_nlats;
+  long __pyx_v_npts;
+  double __pyx_v_zxi;
+  double __pyx_v_zdx;
+  double __pyx_v_flons;
+  double __pyx_v_missvl;
+  PyArrayObject *__pyx_v_reggrid = 0;
+  double *__pyx_v_redgrdptr;
+  double *__pyx_v_reggrdptr;
+  long *__pyx_v_lonsptr;
+  PyObject *__pyx_v_nlons = NULL;
+  PyObject *__pyx_v_msg = NULL;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  Py_ssize_t __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  int __pyx_t_5;
+  PyObject *__pyx_t_6 = NULL;
+  double __pyx_t_7;
+  long __pyx_t_8;
+  long __pyx_t_9;
+  long __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("_redtoreg", 0);
+
+  /* "redtoreg.pyx":14
+ *     cdef double *redgrdptr, *reggrdptr
+ *     cdef long *lonsptr
+ *     nlons = nlonsin             # <<<<<<<<<<<<<<
+ *     nlats = len(lonsperlat)
+ *     npts = len(redgrid)
+ */
+  __Pyx_INCREF(__pyx_v_nlonsin);
+  __pyx_v_nlons = __pyx_v_nlonsin;
+
+  /* "redtoreg.pyx":15
+ *     cdef long *lonsptr
+ *     nlons = nlonsin
+ *     nlats = len(lonsperlat)             # <<<<<<<<<<<<<<
+ *     npts = len(redgrid)
+ *     if lonsperlat.sum() != npts:
+ */
+  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_lonsperlat)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_nlats = __pyx_t_1;
+
+  /* "redtoreg.pyx":16
+ *     nlons = nlonsin
+ *     nlats = len(lonsperlat)
+ *     npts = len(redgrid)             # <<<<<<<<<<<<<<
+ *     if lonsperlat.sum() != npts:
+ *         msg='size of reduced grid does not match number of data values'
+ */
+  __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_redgrid)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_npts = __pyx_t_1;
+
+  /* "redtoreg.pyx":17
+ *     nlats = len(lonsperlat)
+ *     npts = len(redgrid)
+ *     if lonsperlat.sum() != npts:             # <<<<<<<<<<<<<<
+ *         msg='size of reduced grid does not match number of data values'
+ *         raise ValueError(msg)
+ */
+  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_lonsperlat), __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __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 = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_npts); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  if (__pyx_t_5) {
+
+    /* "redtoreg.pyx":18
+ *     npts = len(redgrid)
+ *     if lonsperlat.sum() != npts:
+ *         msg='size of reduced grid does not match number of data values'             # <<<<<<<<<<<<<<
+ *         raise ValueError(msg)
+ *     reggrid = missval*np.ones((nlats,nlons),np.double)
+ */
+    __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
+    __pyx_v_msg = ((PyObject *)__pyx_kp_s_1);
+
+    /* "redtoreg.pyx":19
+ *     if lonsperlat.sum() != npts:
+ *         msg='size of reduced grid does not match number of data values'
+ *         raise ValueError(msg)             # <<<<<<<<<<<<<<
+ *     reggrid = missval*np.ones((nlats,nlons),np.double)
+ *     # get data buffers and cast to desired type.
+ */
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __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_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_2);
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 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 = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
+
+  /* "redtoreg.pyx":20
+ *         msg='size of reduced grid does not match number of data values'
+ *         raise ValueError(msg)
+ *     reggrid = missval*np.ones((nlats,nlons),np.double)             # <<<<<<<<<<<<<<
+ *     # get data buffers and cast to desired type.
+ *     lonsptr = <long *>lonsperlat.data
+ */
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__ones); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = PyInt_FromLong(__pyx_v_nlats); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __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 = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_3);
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
+  __Pyx_GIVEREF(__pyx_t_2);
+  __Pyx_INCREF(__pyx_v_nlons);
+  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_nlons);
+  __Pyx_GIVEREF(__pyx_v_nlons);
+  __pyx_t_2 = 0;
+  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__double); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_6);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
+  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
+  __Pyx_GIVEREF(__pyx_t_6);
+  __pyx_t_3 = 0;
+  __pyx_t_6 = 0;
+  __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __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_2)); __pyx_t_2 = 0;
+  __pyx_t_2 = PyNumber_Multiply(__pyx_v_missval, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_reggrid = ((PyArrayObject *)__pyx_t_2);
+  __pyx_t_2 = 0;
+
+  /* "redtoreg.pyx":22
+ *     reggrid = missval*np.ones((nlats,nlons),np.double)
+ *     # get data buffers and cast to desired type.
+ *     lonsptr = <long *>lonsperlat.data             # <<<<<<<<<<<<<<
+ *     redgrdptr = <double *>redgrid.data
+ *     reggrdptr = <double *>reggrid.data
+ */
+  __pyx_v_lonsptr = ((long *)__pyx_v_lonsperlat->data);
+
+  /* "redtoreg.pyx":23
+ *     # get data buffers and cast to desired type.
+ *     lonsptr = <long *>lonsperlat.data
+ *     redgrdptr = <double *>redgrid.data             # <<<<<<<<<<<<<<
+ *     reggrdptr = <double *>reggrid.data
+ *     missvl = <double>missval
+ */
+  __pyx_v_redgrdptr = ((double *)__pyx_v_redgrid->data);
+
+  /* "redtoreg.pyx":24
+ *     lonsptr = <long *>lonsperlat.data
+ *     redgrdptr = <double *>redgrid.data
+ *     reggrdptr = <double *>reggrid.data             # <<<<<<<<<<<<<<
+ *     missvl = <double>missval
+ *     # iterate over full grid, do linear interpolation.
+ */
+  __pyx_v_reggrdptr = ((double *)__pyx_v_reggrid->data);
+
+  /* "redtoreg.pyx":25
+ *     redgrdptr = <double *>redgrid.data
+ *     reggrdptr = <double *>reggrid.data
+ *     missvl = <double>missval             # <<<<<<<<<<<<<<
+ *     # iterate over full grid, do linear interpolation.
+ *     n = 0
+ */
+  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_missval); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_v_missvl = ((double)__pyx_t_7);
+
+  /* "redtoreg.pyx":27
+ *     missvl = <double>missval
+ *     # iterate over full grid, do linear interpolation.
+ *     n = 0             # <<<<<<<<<<<<<<
+ *     indx = 0
+ *     for j from 0 <= j < nlats:
+ */
+  __pyx_v_n = 0;
+
+  /* "redtoreg.pyx":28
+ *     # iterate over full grid, do linear interpolation.
+ *     n = 0
+ *     indx = 0             # <<<<<<<<<<<<<<
+ *     for j from 0 <= j < nlats:
+ *         ilons = lonsptr[j]
+ */
+  __pyx_v_indx = 0;
+
+  /* "redtoreg.pyx":29
+ *     n = 0
+ *     indx = 0
+ *     for j from 0 <= j < nlats:             # <<<<<<<<<<<<<<
+ *         ilons = lonsptr[j]
+ *         flons = <double>ilons
+ */
+  __pyx_t_8 = __pyx_v_nlats;
+  for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_8; __pyx_v_j++) {
+
+    /* "redtoreg.pyx":30
+ *     indx = 0
+ *     for j from 0 <= j < nlats:
+ *         ilons = lonsptr[j]             # <<<<<<<<<<<<<<
+ *         flons = <double>ilons
+ *         for i from 0 <= i < nlons:
+ */
+    __pyx_v_ilons = (__pyx_v_lonsptr[__pyx_v_j]);
+
+    /* "redtoreg.pyx":31
+ *     for j from 0 <= j < nlats:
+ *         ilons = lonsptr[j]
+ *         flons = <double>ilons             # <<<<<<<<<<<<<<
+ *         for i from 0 <= i < nlons:
+ *             # zxi is the grid index (relative to the reduced grid)
+ */
+    __pyx_v_flons = ((double)__pyx_v_ilons);
+
+    /* "redtoreg.pyx":32
+ *         ilons = lonsptr[j]
+ *         flons = <double>ilons
+ *         for i from 0 <= i < nlons:             # <<<<<<<<<<<<<<
+ *             # zxi is the grid index (relative to the reduced grid)
+ *             # of the i'th point on the full grid.
+ */
+    __pyx_t_9 = __Pyx_PyInt_AsLong(__pyx_v_nlons); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) {
+
+      /* "redtoreg.pyx":35
+ *             # zxi is the grid index (relative to the reduced grid)
+ *             # of the i'th point on the full grid.
+ *             zxi = i * flons / nlons # goes from 0 to ilons             # <<<<<<<<<<<<<<
+ *             im = <long>zxi
+ *             zdx = zxi - <double>im
+ */
+      __pyx_t_2 = PyFloat_FromDouble((__pyx_v_i * __pyx_v_flons)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_2);
+      __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_v_nlons); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+      __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+      __pyx_v_zxi = __pyx_t_7;
+
+      /* "redtoreg.pyx":36
+ *             # of the i'th point on the full grid.
+ *             zxi = i * flons / nlons # goes from 0 to ilons
+ *             im = <long>zxi             # <<<<<<<<<<<<<<
+ *             zdx = zxi - <double>im
+ *             if ilons != 0:
+ */
+      __pyx_v_im = ((long)__pyx_v_zxi);
+
+      /* "redtoreg.pyx":37
+ *             zxi = i * flons / nlons # goes from 0 to ilons
+ *             im = <long>zxi
+ *             zdx = zxi - <double>im             # <<<<<<<<<<<<<<
+ *             if ilons != 0:
+ *                 im = (im + ilons)%ilons
+ */
+      __pyx_v_zdx = (__pyx_v_zxi - ((double)__pyx_v_im));
+
+      /* "redtoreg.pyx":38
+ *             im = <long>zxi
+ *             zdx = zxi - <double>im
+ *             if ilons != 0:             # <<<<<<<<<<<<<<
+ *                 im = (im + ilons)%ilons
+ *                 ip = (im + 1 + ilons)%ilons
+ */
+      __pyx_t_5 = ((__pyx_v_ilons != 0) != 0);
+      if (__pyx_t_5) {
+
+        /* "redtoreg.pyx":39
+ *             zdx = zxi - <double>im
+ *             if ilons != 0:
+ *                 im = (im + ilons)%ilons             # <<<<<<<<<<<<<<
+ *                 ip = (im + 1 + ilons)%ilons
+ *                 # if one of the nearest values is missing, use nearest
+ */
+        __pyx_t_10 = (__pyx_v_im + __pyx_v_ilons);
+        if (unlikely(__pyx_v_ilons == 0)) {
+          #ifdef WITH_THREAD
+          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+          #endif
+          PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+          #ifdef WITH_THREAD
+          PyGILState_Release(__pyx_gilstate_save);
+          #endif
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+        __pyx_v_im = __Pyx_mod_long(__pyx_t_10, __pyx_v_ilons);
+
+        /* "redtoreg.pyx":40
+ *             if ilons != 0:
+ *                 im = (im + ilons)%ilons
+ *                 ip = (im + 1 + ilons)%ilons             # <<<<<<<<<<<<<<
+ *                 # if one of the nearest values is missing, use nearest
+ *                 # neighbor interpolation.
+ */
+        __pyx_t_10 = ((__pyx_v_im + 1) + __pyx_v_ilons);
+        if (unlikely(__pyx_v_ilons == 0)) {
+          #ifdef WITH_THREAD
+          PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
+          #endif
+          PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+          #ifdef WITH_THREAD
+          PyGILState_Release(__pyx_gilstate_save);
+          #endif
+          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        }
+        __pyx_v_ip = __Pyx_mod_long(__pyx_t_10, __pyx_v_ilons);
+
+        /* "redtoreg.pyx":43
+ *                 # if one of the nearest values is missing, use nearest
+ *                 # neighbor interpolation.
+ *                 if redgrdptr[indx+im] == missvl or\             # <<<<<<<<<<<<<<
+ *                    redgrdptr[indx+ip] == missvl:
+ *                     if zdx < 0.5:
+ */
+        __pyx_t_5 = (((__pyx_v_redgrdptr[(__pyx_v_indx + __pyx_v_im)]) == __pyx_v_missvl) != 0);
+        if (!__pyx_t_5) {
+
+          /* "redtoreg.pyx":44
+ *                 # neighbor interpolation.
+ *                 if redgrdptr[indx+im] == missvl or\
+ *                    redgrdptr[indx+ip] == missvl:             # <<<<<<<<<<<<<<
+ *                     if zdx < 0.5:
+ *                         reggrdptr[n] = redgrdptr[indx+im]
+ */
+          __pyx_t_11 = (((__pyx_v_redgrdptr[(__pyx_v_indx + __pyx_v_ip)]) == __pyx_v_missvl) != 0);
+          __pyx_t_12 = __pyx_t_11;
+        } else {
+          __pyx_t_12 = __pyx_t_5;
+        }
+        if (__pyx_t_12) {
+
+          /* "redtoreg.pyx":45
+ *                 if redgrdptr[indx+im] == missvl or\
+ *                    redgrdptr[indx+ip] == missvl:
+ *                     if zdx < 0.5:             # <<<<<<<<<<<<<<
+ *                         reggrdptr[n] = redgrdptr[indx+im]
+ *                     else:
+ */
+          __pyx_t_12 = ((__pyx_v_zdx < 0.5) != 0);
+          if (__pyx_t_12) {
+
+            /* "redtoreg.pyx":46
+ *                    redgrdptr[indx+ip] == missvl:
+ *                     if zdx < 0.5:
+ *                         reggrdptr[n] = redgrdptr[indx+im]             # <<<<<<<<<<<<<<
+ *                     else:
+ *                         reggrdptr[n] = redgrdptr[indx+ip]
+ */
+            (__pyx_v_reggrdptr[__pyx_v_n]) = (__pyx_v_redgrdptr[(__pyx_v_indx + __pyx_v_im)]);
+            goto __pyx_L10;
+          }
+          /*else*/ {
+
+            /* "redtoreg.pyx":48
+ *                         reggrdptr[n] = redgrdptr[indx+im]
+ *                     else:
+ *                         reggrdptr[n] = redgrdptr[indx+ip]             # <<<<<<<<<<<<<<
+ *                 else: # linear interpolation.
+ *                     reggrdptr[n] = redgrdptr[indx+im]*(1.-zdx) +\
+ */
+            (__pyx_v_reggrdptr[__pyx_v_n]) = (__pyx_v_redgrdptr[(__pyx_v_indx + __pyx_v_ip)]);
+          }
+          __pyx_L10:;
+          goto __pyx_L9;
+        }
+        /*else*/ {
+
+          /* "redtoreg.pyx":50
+ *                         reggrdptr[n] = redgrdptr[indx+ip]
+ *                 else: # linear interpolation.
+ *                     reggrdptr[n] = redgrdptr[indx+im]*(1.-zdx) +\             # <<<<<<<<<<<<<<
+ *                                    redgrdptr[indx+ip]*zdx
+ *             n = n + 1
+ */
+          (__pyx_v_reggrdptr[__pyx_v_n]) = (((__pyx_v_redgrdptr[(__pyx_v_indx + __pyx_v_im)]) * (1. - __pyx_v_zdx)) + ((__pyx_v_redgrdptr[(__pyx_v_indx + __pyx_v_ip)]) * __pyx_v_zdx));
+        }
+        __pyx_L9:;
+        goto __pyx_L8;
+      }
+      __pyx_L8:;
+
+      /* "redtoreg.pyx":52
+ *                     reggrdptr[n] = redgrdptr[indx+im]*(1.-zdx) +\
+ *                                    redgrdptr[indx+ip]*zdx
+ *             n = n + 1             # <<<<<<<<<<<<<<
+ *         indx = indx + ilons
+ *     return reggrid
+ */
+      __pyx_v_n = (__pyx_v_n + 1);
+    }
+
+    /* "redtoreg.pyx":53
+ *                                    redgrdptr[indx+ip]*zdx
+ *             n = n + 1
+ *         indx = indx + ilons             # <<<<<<<<<<<<<<
+ *     return reggrid
+ */
+    __pyx_v_indx = (__pyx_v_indx + __pyx_v_ilons);
+  }
+
+  /* "redtoreg.pyx":54
+ *             n = n + 1
+ *         indx = indx + ilons
+ *     return reggrid             # <<<<<<<<<<<<<<
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __Pyx_INCREF(((PyObject *)__pyx_v_reggrid));
+  __pyx_r = ((PyObject *)__pyx_v_reggrid);
+  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_6);
+  __Pyx_AddTraceback("redtoreg._redtoreg", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XDECREF((PyObject *)__pyx_v_reggrid);
+  __Pyx_XDECREF(__pyx_v_nlons);
+  __Pyx_XDECREF(__pyx_v_msg);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+  int __pyx_r;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
+  __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "numpy.pxd":194
+ *         # experimental exception made for __getbuffer__ and __releasebuffer__
+ *         # -- the details of this may change.
+ *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
+ *             # This implementation of getbuffer is geared towards Cython
+ *             # requirements, and does not yet fullfill the PEP.
+ */
+
+static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+  int __pyx_v_copy_shape;
+  int __pyx_v_i;
+  int __pyx_v_ndim;
+  int __pyx_v_endian_detector;
+  int __pyx_v_little_endian;
+  int __pyx_v_t;
+  char *__pyx_v_f;
+  PyArray_Descr *__pyx_v_descr = 0;
+  int __pyx_v_offset;
+  int __pyx_v_hasfields;
+  int __pyx_r;
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  int __pyx_t_2;
+  int __pyx_t_3;
+  PyObject *__pyx_t_4 = NULL;
+  int __pyx_t_5;
+  int __pyx_t_6;
+  int __pyx_t_7;
+  PyObject *__pyx_t_8 = NULL;
+  char *__pyx_t_9;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("__getbuffer__", 0);
+  if (__pyx_v_info != NULL) {
+    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
+    __Pyx_GIVEREF(__pyx_v_info->obj);
+  }
+
+  /* "numpy.pxd":200
+ *             # of flags
+ * 
+ *             if info == NULL: return             # <<<<<<<<<<<<<<
+ * 
+ *             cdef int copy_shape, i, ndim
+ */
+  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
+  if (__pyx_t_1) {
+    __pyx_r = 0;
+    goto __pyx_L0;
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
+
+  /* "numpy.pxd":203
+ * 
+ *             cdef int copy_shape, i, ndim
+ *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
+ *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
+ * 
+ */
+  __pyx_v_endian_detector = 1;
+
+  /* "numpy.pxd":204
+ *             cdef int copy_shape, i, ndim
+ *             cdef int endian_detector = 1
+ *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
+ * 
+ *             ndim = PyArray_NDIM(self)
+ */
+  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
+
+  /* "numpy.pxd":206
+ *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
+ * 
+ *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
+ * 
+ *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
+ */
+  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
+
+  /* "numpy.pxd":208
+ *             ndim = PyArray_NDIM(self)
+ * 
+ *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
+ *                 copy_shape = 1
+ *             else:
+ */
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
+  if (__pyx_t_1) {
+
+    /* "numpy.pxd":209
+ * 
+ *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
+ *                 copy_shape = 1             # <<<<<<<<<<<<<<
+ *             else:
+ *                 copy_shape = 0
+ */
+    __pyx_v_copy_shape = 1;
+    goto __pyx_L4;
+  }
+  /*else*/ {
+
+    /* "numpy.pxd":211
+ *                 copy_shape = 1
+ *             else:
+ *                 copy_shape = 0             # <<<<<<<<<<<<<<
+ * 
+ *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
+ */
+    __pyx_v_copy_shape = 0;
+  }
+  __pyx_L4:;
+
+  /* "numpy.pxd":213
+ *                 copy_shape = 0
+ * 
+ *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
+ *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
+ *                 raise ValueError(u"ndarray is not C contiguous")
+ */
+  __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
+  if (__pyx_t_1) {
+
+    /* "numpy.pxd":214
+ * 
+ *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
+ *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
+ *                 raise ValueError(u"ndarray is not C contiguous")
+ * 
+ */
+    __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
+    __pyx_t_3 = __pyx_t_2;
+  } else {
+    __pyx_t_3 = __pyx_t_1;
+  }
+  if (__pyx_t_3) {
+
+    /* "numpy.pxd":215
+ *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
+ *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
+ *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
+ * 
+ *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
+ */
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L5;
+  }
+  __pyx_L5:;
+
+  /* "numpy.pxd":217
+ *                 raise ValueError(u"ndarray is not C contiguous")
+ * 
+ *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
+ *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
+ *                 raise ValueError(u"ndarray is not Fortran contiguous")
+ */
+  __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
+  if (__pyx_t_3) {
+
+    /* "numpy.pxd":218
+ * 
+ *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
+ *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
+ *                 raise ValueError(u"ndarray is not Fortran contiguous")
+ * 
+ */
+    __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
+    __pyx_t_2 = __pyx_t_1;
+  } else {
+    __pyx_t_2 = __pyx_t_3;
+  }
+  if (__pyx_t_2) {
+
+    /* "numpy.pxd":219
+ *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
+ *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
+ *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
+ * 
+ *             info.buf = PyArray_DATA(self)
+ */
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L6;
+  }
+  __pyx_L6:;
+
+  /* "numpy.pxd":221
+ *                 raise ValueError(u"ndarray is not Fortran contiguous")
+ * 
+ *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
+ *             info.ndim = ndim
+ *             if copy_shape:
+ */
+  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
+
+  /* "numpy.pxd":222
+ * 
+ *             info.buf = PyArray_DATA(self)
+ *             info.ndim = ndim             # <<<<<<<<<<<<<<
+ *             if copy_shape:
+ *                 # Allocate new buffer for strides and shape info.
+ */
+  __pyx_v_info->ndim = __pyx_v_ndim;
+
+  /* "numpy.pxd":223
+ *             info.buf = PyArray_DATA(self)
+ *             info.ndim = ndim
+ *             if copy_shape:             # <<<<<<<<<<<<<<
+ *                 # Allocate new buffer for strides and shape info.
+ *                 # This is allocated as one block, strides first.
+ */
+  __pyx_t_2 = (__pyx_v_copy_shape != 0);
+  if (__pyx_t_2) {
+
+    /* "numpy.pxd":226
+ *                 # Allocate new buffer for strides and shape info.
+ *                 # This is allocated as one block, strides first.
+ *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)             # <<<<<<<<<<<<<<
+ *                 info.shape = info.strides + ndim
+ *                 for i in range(ndim):
+ */
+    __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));
+
+    /* "numpy.pxd":227
+ *                 # This is allocated as one block, strides first.
+ *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
+ *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
+ *                 for i in range(ndim):
+ *                     info.strides[i] = PyArray_STRIDES(self)[i]
+ */
+    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
+
+    /* "numpy.pxd":228
+ *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
+ *                 info.shape = info.strides + ndim
+ *                 for i in range(ndim):             # <<<<<<<<<<<<<<
+ *                     info.strides[i] = PyArray_STRIDES(self)[i]
+ *                     info.shape[i] = PyArray_DIMS(self)[i]
+ */
+    __pyx_t_5 = __pyx_v_ndim;
+    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
+      __pyx_v_i = __pyx_t_6;
+
+      /* "numpy.pxd":229
+ *                 info.shape = info.strides + ndim
+ *                 for i in range(ndim):
+ *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
+ *                     info.shape[i] = PyArray_DIMS(self)[i]
+ *             else:
+ */
+      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
+
+      /* "numpy.pxd":230
+ *                 for i in range(ndim):
+ *                     info.strides[i] = PyArray_STRIDES(self)[i]
+ *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
+ *             else:
+ *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
+ */
+      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
+    }
+    goto __pyx_L7;
+  }
+  /*else*/ {
+
+    /* "numpy.pxd":232
+ *                     info.shape[i] = PyArray_DIMS(self)[i]
+ *             else:
+ *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
+ *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
+ *             info.suboffsets = NULL
+ */
+    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
+
+    /* "numpy.pxd":233
+ *             else:
+ *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
+ *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
+ *             info.suboffsets = NULL
+ *             info.itemsize = PyArray_ITEMSIZE(self)
+ */
+    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
+  }
+  __pyx_L7:;
+
+  /* "numpy.pxd":234
+ *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
+ *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
+ *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
+ *             info.itemsize = PyArray_ITEMSIZE(self)
+ *             info.readonly = not PyArray_ISWRITEABLE(self)
+ */
+  __pyx_v_info->suboffsets = NULL;
+
+  /* "numpy.pxd":235
+ *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
+ *             info.suboffsets = NULL
+ *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
+ *             info.readonly = not PyArray_ISWRITEABLE(self)
+ * 
+ */
+  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
+
+  /* "numpy.pxd":236
+ *             info.suboffsets = NULL
+ *             info.itemsize = PyArray_ITEMSIZE(self)
+ *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
+ * 
+ *             cdef int t
+ */
+  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
+
+  /* "numpy.pxd":239
+ * 
+ *             cdef int t
+ *             cdef char* f = NULL             # <<<<<<<<<<<<<<
+ *             cdef dtype descr = self.descr
+ *             cdef list stack
+ */
+  __pyx_v_f = NULL;
+
+  /* "numpy.pxd":240
+ *             cdef int t
+ *             cdef char* f = NULL
+ *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
+ *             cdef list stack
+ *             cdef int offset
+ */
+  __pyx_t_4 = ((PyObject *)__pyx_v_self->descr);
+  __Pyx_INCREF(__pyx_t_4);
+  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4);
+  __pyx_t_4 = 0;
+
+  /* "numpy.pxd":244
+ *             cdef int offset
+ * 
+ *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
+ * 
+ *             if not hasfields and not copy_shape:
+ */
+  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
+
+  /* "numpy.pxd":246
+ *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
+ * 
+ *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
+ *                 # do not call releasebuffer
+ *                 info.obj = None
+ */
+  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
+  if (__pyx_t_2) {
+    __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0);
+    __pyx_t_1 = __pyx_t_3;
+  } else {
+    __pyx_t_1 = __pyx_t_2;
+  }
+  if (__pyx_t_1) {
+
+    /* "numpy.pxd":248
+ *             if not hasfields and not copy_shape:
+ *                 # do not call releasebuffer
+ *                 info.obj = None             # <<<<<<<<<<<<<<
+ *             else:
+ *                 # need to call releasebuffer
+ */
+    __Pyx_INCREF(Py_None);
+    __Pyx_GIVEREF(Py_None);
+    __Pyx_GOTREF(__pyx_v_info->obj);
+    __Pyx_DECREF(__pyx_v_info->obj);
+    __pyx_v_info->obj = Py_None;
+    goto __pyx_L10;
+  }
+  /*else*/ {
+
+    /* "numpy.pxd":251
+ *             else:
+ *                 # need to call releasebuffer
+ *                 info.obj = self             # <<<<<<<<<<<<<<
+ * 
+ *             if not hasfields:
+ */
+    __Pyx_INCREF(((PyObject *)__pyx_v_self));
+    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
+    __Pyx_GOTREF(__pyx_v_info->obj);
+    __Pyx_DECREF(__pyx_v_info->obj);
+    __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
+  }
+  __pyx_L10:;
+
+  /* "numpy.pxd":253
+ *                 info.obj = self
+ * 
+ *             if not hasfields:             # <<<<<<<<<<<<<<
+ *                 t = descr.type_num
+ *                 if ((descr.byteorder == c'>' and little_endian) or
+ */
+  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
+  if (__pyx_t_1) {
+
+    /* "numpy.pxd":254
+ * 
+ *             if not hasfields:
+ *                 t = descr.type_num             # <<<<<<<<<<<<<<
+ *                 if ((descr.byteorder == c'>' and little_endian) or
+ *                     (descr.byteorder == c'<' and not little_endian)):
+ */
+    __pyx_t_5 = __pyx_v_descr->type_num;
+    __pyx_v_t = __pyx_t_5;
+
+    /* "numpy.pxd":255
+ *             if not hasfields:
+ *                 t = descr.type_num
+ *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
+ *                     (descr.byteorder == c'<' and not little_endian)):
+ *                     raise ValueError(u"Non-native byte order not supported")
+ */
+    __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0);
+    if (__pyx_t_1) {
+      __pyx_t_2 = (__pyx_v_little_endian != 0);
+    } else {
+      __pyx_t_2 = __pyx_t_1;
+    }
+    if (!__pyx_t_2) {
+
+      /* "numpy.pxd":256
+ *                 t = descr.type_num
+ *                 if ((descr.byteorder == c'>' and little_endian) or
+ *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
+ *                     raise ValueError(u"Non-native byte order not supported")
+ *                 if   t == NPY_BYTE:        f = "b"
+ */
+      __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0);
+      if (__pyx_t_1) {
+        __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0);
+        __pyx_t_7 = __pyx_t_3;
+      } else {
+        __pyx_t_7 = __pyx_t_1;
+      }
+      __pyx_t_1 = __pyx_t_7;
+    } else {
+      __pyx_t_1 = __pyx_t_2;
+    }
+    if (__pyx_t_1) {
+
+      /* "numpy.pxd":257
+ *                 if ((descr.byteorder == c'>' and little_endian) or
+ *                     (descr.byteorder == c'<' and not little_endian)):
+ *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
+ *                 if   t == NPY_BYTE:        f = "b"
+ *                 elif t == NPY_UBYTE:       f = "B"
+ */
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L12;
+    }
+    __pyx_L12:;
+
+    /* "numpy.pxd":274
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+    switch (__pyx_v_t) {
+
+      /* "numpy.pxd":258
+ *                     (descr.byteorder == c'<' and not little_endian)):
+ *                     raise ValueError(u"Non-native byte order not supported")
+ *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_UBYTE:       f = "B"
+ *                 elif t == NPY_SHORT:       f = "h"
+ */
+      case NPY_BYTE:
+      __pyx_v_f = __pyx_k__b;
+      break;
+
+      /* "numpy.pxd":259
+ *                     raise ValueError(u"Non-native byte order not supported")
+ *                 if   t == NPY_BYTE:        f = "b"
+ *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_SHORT:       f = "h"
+ *                 elif t == NPY_USHORT:      f = "H"
+ */
+      case NPY_UBYTE:
+      __pyx_v_f = __pyx_k__B;
+      break;
+
+      /* "numpy.pxd":260
+ *                 if   t == NPY_BYTE:        f = "b"
+ *                 elif t == NPY_UBYTE:       f = "B"
+ *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_USHORT:      f = "H"
+ *                 elif t == NPY_INT:         f = "i"
+ */
+      case NPY_SHORT:
+      __pyx_v_f = __pyx_k__h;
+      break;
+
+      /* "numpy.pxd":261
+ *                 elif t == NPY_UBYTE:       f = "B"
+ *                 elif t == NPY_SHORT:       f = "h"
+ *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_INT:         f = "i"
+ *                 elif t == NPY_UINT:        f = "I"
+ */
+      case NPY_USHORT:
+      __pyx_v_f = __pyx_k__H;
+      break;
+
+      /* "numpy.pxd":262
+ *                 elif t == NPY_SHORT:       f = "h"
+ *                 elif t == NPY_USHORT:      f = "H"
+ *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_UINT:        f = "I"
+ *                 elif t == NPY_LONG:        f = "l"
+ */
+      case NPY_INT:
+      __pyx_v_f = __pyx_k__i;
+      break;
+
+      /* "numpy.pxd":263
+ *                 elif t == NPY_USHORT:      f = "H"
+ *                 elif t == NPY_INT:         f = "i"
+ *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_LONG:        f = "l"
+ *                 elif t == NPY_ULONG:       f = "L"
+ */
+      case NPY_UINT:
+      __pyx_v_f = __pyx_k__I;
+      break;
+
+      /* "numpy.pxd":264
+ *                 elif t == NPY_INT:         f = "i"
+ *                 elif t == NPY_UINT:        f = "I"
+ *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_ULONG:       f = "L"
+ *                 elif t == NPY_LONGLONG:    f = "q"
+ */
+      case NPY_LONG:
+      __pyx_v_f = __pyx_k__l;
+      break;
+
+      /* "numpy.pxd":265
+ *                 elif t == NPY_UINT:        f = "I"
+ *                 elif t == NPY_LONG:        f = "l"
+ *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_LONGLONG:    f = "q"
+ *                 elif t == NPY_ULONGLONG:   f = "Q"
+ */
+      case NPY_ULONG:
+      __pyx_v_f = __pyx_k__L;
+      break;
+
+      /* "numpy.pxd":266
+ *                 elif t == NPY_LONG:        f = "l"
+ *                 elif t == NPY_ULONG:       f = "L"
+ *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_ULONGLONG:   f = "Q"
+ *                 elif t == NPY_FLOAT:       f = "f"
+ */
+      case NPY_LONGLONG:
+      __pyx_v_f = __pyx_k__q;
+      break;
+
+      /* "numpy.pxd":267
+ *                 elif t == NPY_ULONG:       f = "L"
+ *                 elif t == NPY_LONGLONG:    f = "q"
+ *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_FLOAT:       f = "f"
+ *                 elif t == NPY_DOUBLE:      f = "d"
+ */
+      case NPY_ULONGLONG:
+      __pyx_v_f = __pyx_k__Q;
+      break;
+
+      /* "numpy.pxd":268
+ *                 elif t == NPY_LONGLONG:    f = "q"
+ *                 elif t == NPY_ULONGLONG:   f = "Q"
+ *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_DOUBLE:      f = "d"
+ *                 elif t == NPY_LONGDOUBLE:  f = "g"
+ */
+      case NPY_FLOAT:
+      __pyx_v_f = __pyx_k__f;
+      break;
+
+      /* "numpy.pxd":269
+ *                 elif t == NPY_ULONGLONG:   f = "Q"
+ *                 elif t == NPY_FLOAT:       f = "f"
+ *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_LONGDOUBLE:  f = "g"
+ *                 elif t == NPY_CFLOAT:      f = "Zf"
+ */
+      case NPY_DOUBLE:
+      __pyx_v_f = __pyx_k__d;
+      break;
+
+      /* "numpy.pxd":270
+ *                 elif t == NPY_FLOAT:       f = "f"
+ *                 elif t == NPY_DOUBLE:      f = "d"
+ *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_CFLOAT:      f = "Zf"
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ */
+      case NPY_LONGDOUBLE:
+      __pyx_v_f = __pyx_k__g;
+      break;
+
+      /* "numpy.pxd":271
+ *                 elif t == NPY_DOUBLE:      f = "d"
+ *                 elif t == NPY_LONGDOUBLE:  f = "g"
+ *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ */
+      case NPY_CFLOAT:
+      __pyx_v_f = __pyx_k__Zf;
+      break;
+
+      /* "numpy.pxd":272
+ *                 elif t == NPY_LONGDOUBLE:  f = "g"
+ *                 elif t == NPY_CFLOAT:      f = "Zf"
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"
+ */
+      case NPY_CDOUBLE:
+      __pyx_v_f = __pyx_k__Zd;
+      break;
+
+      /* "numpy.pxd":273
+ *                 elif t == NPY_CFLOAT:      f = "Zf"
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_OBJECT:      f = "O"
+ *                 else:
+ */
+      case NPY_CLONGDOUBLE:
+      __pyx_v_f = __pyx_k__Zg;
+      break;
+
+      /* "numpy.pxd":274
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+      case NPY_OBJECT:
+      __pyx_v_f = __pyx_k__O;
+      break;
+      default:
+
+      /* "numpy.pxd":276
+ *                 elif t == NPY_OBJECT:      f = "O"
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
+ *                 info.format = f
+ *                 return
+ */
+      __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      break;
+    }
+
+    /* "numpy.pxd":277
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ *                 info.format = f             # <<<<<<<<<<<<<<
+ *                 return
+ *             else:
+ */
+    __pyx_v_info->format = __pyx_v_f;
+
+    /* "numpy.pxd":278
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ *                 info.format = f
+ *                 return             # <<<<<<<<<<<<<<
+ *             else:
+ *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
+ */
+    __pyx_r = 0;
+    goto __pyx_L0;
+    goto __pyx_L11;
+  }
+  /*else*/ {
+
+    /* "numpy.pxd":280
+ *                 return
+ *             else:
+ *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
+ *                 info.format[0] = c'^' # Native data types, manual alignment
+ *                 offset = 0
+ */
+    __pyx_v_info->format = ((char *)malloc(255));
+
+    /* "numpy.pxd":281
+ *             else:
+ *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
+ *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
+ *                 offset = 0
+ *                 f = _util_dtypestring(descr, info.format + 1,
+ */
+    (__pyx_v_info->format[0]) = '^';
+
+    /* "numpy.pxd":282
+ *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
+ *                 info.format[0] = c'^' # Native data types, manual alignment
+ *                 offset = 0             # <<<<<<<<<<<<<<
+ *                 f = _util_dtypestring(descr, info.format + 1,
+ *                                       info.format + _buffer_format_string_len,
+ */
+    __pyx_v_offset = 0;
+
+    /* "numpy.pxd":285
+ *                 f = _util_dtypestring(descr, info.format + 1,
+ *                                       info.format + _buffer_format_string_len,
+ *                                       &offset)             # <<<<<<<<<<<<<<
+ *                 f[0] = c'\0' # Terminate format string
+ * 
+ */
+    __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_f = __pyx_t_9;
+
+    /* "numpy.pxd":286
+ *                                       info.format + _buffer_format_string_len,
+ *                                       &offset)
+ *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
+ * 
+ *         def __releasebuffer__(ndarray self, Py_buffer* info):
+ */
+    (__pyx_v_f[0]) = '\x00';
+  }
+  __pyx_L11:;
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = -1;
+  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
+    __Pyx_GOTREF(__pyx_v_info->obj);
+    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
+  }
+  goto __pyx_L2;
+  __pyx_L0:;
+  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
+    __Pyx_GOTREF(Py_None);
+    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
+  }
+  __pyx_L2:;
+  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* Python wrapper */
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
+static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
+  __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
+  __Pyx_RefNannyFinishContext();
+}
+
+/* "numpy.pxd":288
+ *                 f[0] = c'\0' # Terminate format string
+ * 
+ *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
+ *             if PyArray_HASFIELDS(self):
+ *                 stdlib.free(info.format)
+ */
+
+static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  __Pyx_RefNannySetupContext("__releasebuffer__", 0);
+
+  /* "numpy.pxd":289
+ * 
+ *         def __releasebuffer__(ndarray self, Py_buffer* info):
+ *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
+ *                 stdlib.free(info.format)
+ *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
+ */
+  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
+  if (__pyx_t_1) {
+
+    /* "numpy.pxd":290
+ *         def __releasebuffer__(ndarray self, Py_buffer* info):
+ *             if PyArray_HASFIELDS(self):
+ *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
+ *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
+ *                 stdlib.free(info.strides)
+ */
+    free(__pyx_v_info->format);
+    goto __pyx_L3;
+  }
+  __pyx_L3:;
+
+  /* "numpy.pxd":291
+ *             if PyArray_HASFIELDS(self):
+ *                 stdlib.free(info.format)
+ *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
+ *                 stdlib.free(info.strides)
+ *                 # info.shape was stored after info.strides in the same block
+ */
+  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
+  if (__pyx_t_1) {
+
+    /* "numpy.pxd":292
+ *                 stdlib.free(info.format)
+ *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
+ *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
+ *                 # info.shape was stored after info.strides in the same block
+ * 
+ */
+    free(__pyx_v_info->strides);
+    goto __pyx_L4;
+  }
+  __pyx_L4:;
+
+  __Pyx_RefNannyFinishContext();
+}
+
+/* "numpy.pxd":768
+ * ctypedef npy_cdouble     complex_t
+ * 
+ * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
+ *     return PyArray_MultiIterNew(1, <void*>a)
+ * 
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
+
+  /* "numpy.pxd":769
+ * 
+ * cdef inline object PyArray_MultiIterNew1(a):
+ *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
+ * 
+ * cdef inline object PyArray_MultiIterNew2(a, b):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "numpy.pxd":771
+ *     return PyArray_MultiIterNew(1, <void*>a)
+ * 
+ * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
+ *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
+ * 
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
+
+  /* "numpy.pxd":772
+ * 
+ * cdef inline object PyArray_MultiIterNew2(a, b):
+ *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
+ * 
+ * cdef inline object PyArray_MultiIterNew3(a, b, c):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "numpy.pxd":774
+ *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
+ * 
+ * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
+ *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
+ * 
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
+
+  /* "numpy.pxd":775
+ * 
+ * cdef inline object PyArray_MultiIterNew3(a, b, c):
+ *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
+ * 
+ * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "numpy.pxd":777
+ *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
+ * 
+ * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
+ *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
+ * 
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
+
+  /* "numpy.pxd":778
+ * 
+ * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
+ *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
+ * 
+ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "numpy.pxd":780
+ *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
+ * 
+ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
+ *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
+ * 
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
+
+  /* "numpy.pxd":781
+ * 
+ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
+ *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
+ * 
+ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "numpy.pxd":783
+ *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
+ * 
+ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
+ *     # Recursive utility function used in __getbuffer__ to get format
+ *     # string. The new location in the format string is returned.
+ */
+
+static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
+  PyArray_Descr *__pyx_v_child = 0;
+  int __pyx_v_endian_detector;
+  int __pyx_v_little_endian;
+  PyObject *__pyx_v_fields = 0;
+  PyObject *__pyx_v_childname = NULL;
+  PyObject *__pyx_v_new_offset = NULL;
+  PyObject *__pyx_v_t = NULL;
+  char *__pyx_r;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  Py_ssize_t __pyx_t_2;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  PyObject *__pyx_t_5 = NULL;
+  PyObject *(*__pyx_t_6)(PyObject *);
+  int __pyx_t_7;
+  int __pyx_t_8;
+  int __pyx_t_9;
+  int __pyx_t_10;
+  long __pyx_t_11;
+  char *__pyx_t_12;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("_util_dtypestring", 0);
+
+  /* "numpy.pxd":790
+ *     cdef int delta_offset
+ *     cdef tuple i
+ *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
+ *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
+ *     cdef tuple fields
+ */
+  __pyx_v_endian_detector = 1;
+
+  /* "numpy.pxd":791
+ *     cdef tuple i
+ *     cdef int endian_detector = 1
+ *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
+ *     cdef tuple fields
+ * 
+ */
+  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
+
+  /* "numpy.pxd":794
+ *     cdef tuple fields
+ * 
+ *     for childname in descr.names:             # <<<<<<<<<<<<<<
+ *         fields = descr.fields[childname]
+ *         child, new_offset = fields
+ */
+  if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
+    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
+  for (;;) {
+    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
+    #if CYTHON_COMPILING_IN_CPYTHON
+    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    #else
+    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    #endif
+    __Pyx_XDECREF(__pyx_v_childname);
+    __pyx_v_childname = __pyx_t_3;
+    __pyx_t_3 = 0;
+
+    /* "numpy.pxd":795
+ * 
+ *     for childname in descr.names:
+ *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
+ *         child, new_offset = fields
+ * 
+ */
+    __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_XDECREF(((PyObject *)__pyx_v_fields));
+    __pyx_v_fields = ((PyObject*)__pyx_t_3);
+    __pyx_t_3 = 0;
+
+    /* "numpy.pxd":796
+ *     for childname in descr.names:
+ *         fields = descr.fields[childname]
+ *         child, new_offset = fields             # <<<<<<<<<<<<<<
+ * 
+ *         if (end - f) - (new_offset - offset[0]) < 15:
+ */
+    if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) {
+      PyObject* sequence = ((PyObject *)__pyx_v_fields);
+      #if CYTHON_COMPILING_IN_CPYTHON
+      Py_ssize_t size = Py_SIZE(sequence);
+      #else
+      Py_ssize_t size = PySequence_Size(sequence);
+      #endif
+      if (unlikely(size != 2)) {
+        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
+      #if CYTHON_COMPILING_IN_CPYTHON
+      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
+      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
+      __Pyx_INCREF(__pyx_t_3);
+      __Pyx_INCREF(__pyx_t_4);
+      #else
+      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      #endif
+    } else if (1) {
+      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    } else
+    {
+      Py_ssize_t index = -1;
+      __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
+      index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
+      __Pyx_GOTREF(__pyx_t_3);
+      index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
+      __Pyx_GOTREF(__pyx_t_4);
+      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_6 = NULL;
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      goto __pyx_L6_unpacking_done;
+      __pyx_L5_unpacking_failed:;
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_6 = NULL;
+      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_L6_unpacking_done:;
+    }
+    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_XDECREF(((PyObject *)__pyx_v_child));
+    __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
+    __pyx_t_3 = 0;
+    __Pyx_XDECREF(__pyx_v_new_offset);
+    __pyx_v_new_offset = __pyx_t_4;
+    __pyx_t_4 = 0;
+
+    /* "numpy.pxd":798
+ *         child, new_offset = fields
+ * 
+ *         if (end - f) - (new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
+ *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
+ * 
+ */
+    __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    if (__pyx_t_7) {
+
+      /* "numpy.pxd":799
+ * 
+ *         if (end - f) - (new_offset - offset[0]) < 15:
+ *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
+ * 
+ *         if ((child.byteorder == c'>' and little_endian) or
+ */
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L7;
+    }
+    __pyx_L7:;
+
+    /* "numpy.pxd":801
+ *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
+ * 
+ *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
+ *             (child.byteorder == c'<' and not little_endian)):
+ *             raise ValueError(u"Non-native byte order not supported")
+ */
+    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
+    if (__pyx_t_7) {
+      __pyx_t_8 = (__pyx_v_little_endian != 0);
+    } else {
+      __pyx_t_8 = __pyx_t_7;
+    }
+    if (!__pyx_t_8) {
+
+      /* "numpy.pxd":802
+ * 
+ *         if ((child.byteorder == c'>' and little_endian) or
+ *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
+ *             raise ValueError(u"Non-native byte order not supported")
+ *             # One could encode it in the format string and have Cython
+ */
+      __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
+      if (__pyx_t_7) {
+        __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0);
+        __pyx_t_10 = __pyx_t_9;
+      } else {
+        __pyx_t_10 = __pyx_t_7;
+      }
+      __pyx_t_7 = __pyx_t_10;
+    } else {
+      __pyx_t_7 = __pyx_t_8;
+    }
+    if (__pyx_t_7) {
+
+      /* "numpy.pxd":803
+ *         if ((child.byteorder == c'>' and little_endian) or
+ *             (child.byteorder == c'<' and not little_endian)):
+ *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
+ *             # One could encode it in the format string and have Cython
+ *             # complain instead, BUT: < and > in format strings also imply
+ */
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L8;
+    }
+    __pyx_L8:;
+
+    /* "numpy.pxd":813
+ * 
+ *         # Output padding bytes
+ *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
+ *             f[0] = 120 # "x"; pad byte
+ *             f += 1
+ */
+    while (1) {
+      __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (!__pyx_t_7) break;
+
+      /* "numpy.pxd":814
+ *         # Output padding bytes
+ *         while offset[0] < new_offset:
+ *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
+ *             f += 1
+ *             offset[0] += 1
+ */
+      (__pyx_v_f[0]) = 120;
+
+      /* "numpy.pxd":815
+ *         while offset[0] < new_offset:
+ *             f[0] = 120 # "x"; pad byte
+ *             f += 1             # <<<<<<<<<<<<<<
+ *             offset[0] += 1
+ * 
+ */
+      __pyx_v_f = (__pyx_v_f + 1);
+
+      /* "numpy.pxd":816
+ *             f[0] = 120 # "x"; pad byte
+ *             f += 1
+ *             offset[0] += 1             # <<<<<<<<<<<<<<
+ * 
+ *         offset[0] += child.itemsize
+ */
+      __pyx_t_11 = 0;
+      (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1);
+    }
+
+    /* "numpy.pxd":818
+ *             offset[0] += 1
+ * 
+ *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
+ * 
+ *         if not PyDataType_HASFIELDS(child):
+ */
+    __pyx_t_11 = 0;
+    (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize);
+
+    /* "numpy.pxd":820
+ *         offset[0] += child.itemsize
+ * 
+ *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
+ *             t = child.type_num
+ *             if end - f < 5:
+ */
+    __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
+    if (__pyx_t_7) {
+
+      /* "numpy.pxd":821
+ * 
+ *         if not PyDataType_HASFIELDS(child):
+ *             t = child.type_num             # <<<<<<<<<<<<<<
+ *             if end - f < 5:
+ *                 raise RuntimeError(u"Format string allocated too short.")
+ */
+      __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_XDECREF(__pyx_v_t);
+      __pyx_v_t = __pyx_t_3;
+      __pyx_t_3 = 0;
+
+      /* "numpy.pxd":822
+ *         if not PyDataType_HASFIELDS(child):
+ *             t = child.type_num
+ *             if end - f < 5:             # <<<<<<<<<<<<<<
+ *                 raise RuntimeError(u"Format string allocated too short.")
+ * 
+ */
+      __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
+      if (__pyx_t_7) {
+
+        /* "numpy.pxd":823
+ *             t = child.type_num
+ *             if end - f < 5:
+ *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
+ * 
+ *             # Until ticket #99 is fixed, use integers to avoid warnings
+ */
+        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        goto __pyx_L12;
+      }
+      __pyx_L12:;
+
+      /* "numpy.pxd":826
+ * 
+ *             # Until ticket #99 is fixed, use integers to avoid warnings
+ *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
+ *             elif t == NPY_SHORT:       f[0] = 104 #"h"
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 98;
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":827
+ *             # Until ticket #99 is fixed, use integers to avoid warnings
+ *             if   t == NPY_BYTE:        f[0] =  98 #"b"
+ *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_SHORT:       f[0] = 104 #"h"
+ *             elif t == NPY_USHORT:      f[0] =  72 #"H"
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 66;
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":828
+ *             if   t == NPY_BYTE:        f[0] =  98 #"b"
+ *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
+ *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_USHORT:      f[0] =  72 #"H"
+ *             elif t == NPY_INT:         f[0] = 105 #"i"
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 104;
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":829
+ *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
+ *             elif t == NPY_SHORT:       f[0] = 104 #"h"
+ *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_INT:         f[0] = 105 #"i"
+ *             elif t == NPY_UINT:        f[0] =  73 #"I"
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 72;
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":830
+ *             elif t == NPY_SHORT:       f[0] = 104 #"h"
+ *             elif t == NPY_USHORT:      f[0] =  72 #"H"
+ *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_UINT:        f[0] =  73 #"I"
+ *             elif t == NPY_LONG:        f[0] = 108 #"l"
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 105;
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":831
+ *             elif t == NPY_USHORT:      f[0] =  72 #"H"
+ *             elif t == NPY_INT:         f[0] = 105 #"i"
+ *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_LONG:        f[0] = 108 #"l"
+ *             elif t == NPY_ULONG:       f[0] = 76  #"L"
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 73;
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":832
+ *             elif t == NPY_INT:         f[0] = 105 #"i"
+ *             elif t == NPY_UINT:        f[0] =  73 #"I"
+ *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_ULONG:       f[0] = 76  #"L"
+ *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 108;
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":833
+ *             elif t == NPY_UINT:        f[0] =  73 #"I"
+ *             elif t == NPY_LONG:        f[0] = 108 #"l"
+ *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
+ *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 76;
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":834
+ *             elif t == NPY_LONG:        f[0] = 108 #"l"
+ *             elif t == NPY_ULONG:       f[0] = 76  #"L"
+ *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
+ *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 113;
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":835
+ *             elif t == NPY_ULONG:       f[0] = 76  #"L"
+ *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
+ *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
+ *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 81;
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":836
+ *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
+ *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
+ *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
+ *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 102;
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":837
+ *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
+ *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
+ *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
+ *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 100;
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":838
+ *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
+ *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
+ *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
+ *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 103;
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":839
+ *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
+ *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
+ *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
+ *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
+ *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 90;
+        (__pyx_v_f[1]) = 102;
+        __pyx_v_f = (__pyx_v_f + 1);
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":840
+ *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
+ *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
+ *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
+ *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
+ *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 90;
+        (__pyx_v_f[1]) = 100;
+        __pyx_v_f = (__pyx_v_f + 1);
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":841
+ *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
+ *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
+ *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
+ *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
+ *             else:
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 90;
+        (__pyx_v_f[1]) = 103;
+        __pyx_v_f = (__pyx_v_f + 1);
+        goto __pyx_L13;
+      }
+
+      /* "numpy.pxd":842
+ *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
+ *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
+ *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
+ *             else:
+ *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_7) {
+        (__pyx_v_f[0]) = 79;
+        goto __pyx_L13;
+      }
+      /*else*/ {
+
+        /* "numpy.pxd":844
+ *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
+ *             else:
+ *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
+ *             f += 1
+ *         else:
+ */
+        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_8), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
+        __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+        __pyx_t_5 = 0;
+        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
+      __pyx_L13:;
+
+      /* "numpy.pxd":845
+ *             else:
+ *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ *             f += 1             # <<<<<<<<<<<<<<
+ *         else:
+ *             # Cython ignores struct boundary information ("T{...}"),
+ */
+      __pyx_v_f = (__pyx_v_f + 1);
+      goto __pyx_L11;
+    }
+    /*else*/ {
+
+      /* "numpy.pxd":849
+ *             # Cython ignores struct boundary information ("T{...}"),
+ *             # so don't output it
+ *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
+ *     return f
+ * 
+ */
+      __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_v_f = __pyx_t_12;
+    }
+    __pyx_L11:;
+  }
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "numpy.pxd":850
+ *             # so don't output it
+ *             f = _util_dtypestring(child, f, end, offset)
+ *     return f             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __pyx_r = __pyx_v_f;
+  goto __pyx_L0;
+
+  __pyx_r = 0;
+  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_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XDECREF((PyObject *)__pyx_v_child);
+  __Pyx_XDECREF(__pyx_v_fields);
+  __Pyx_XDECREF(__pyx_v_childname);
+  __Pyx_XDECREF(__pyx_v_new_offset);
+  __Pyx_XDECREF(__pyx_v_t);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "numpy.pxd":965
+ * 
+ * 
+ * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
+ *      cdef PyObject* baseptr
+ *      if base is None:
+ */
+
+static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
+  PyObject *__pyx_v_baseptr;
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  int __pyx_t_2;
+  __Pyx_RefNannySetupContext("set_array_base", 0);
+
+  /* "numpy.pxd":967
+ * cdef inline void set_array_base(ndarray arr, object base):
+ *      cdef PyObject* baseptr
+ *      if base is None:             # <<<<<<<<<<<<<<
+ *          baseptr = NULL
+ *      else:
+ */
+  __pyx_t_1 = (__pyx_v_base == Py_None);
+  __pyx_t_2 = (__pyx_t_1 != 0);
+  if (__pyx_t_2) {
+
+    /* "numpy.pxd":968
+ *      cdef PyObject* baseptr
+ *      if base is None:
+ *          baseptr = NULL             # <<<<<<<<<<<<<<
+ *      else:
+ *          Py_INCREF(base) # important to do this before decref below!
+ */
+    __pyx_v_baseptr = NULL;
+    goto __pyx_L3;
+  }
+  /*else*/ {
+
+    /* "numpy.pxd":970
+ *          baseptr = NULL
+ *      else:
+ *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
+ *          baseptr = <PyObject*>base
+ *      Py_XDECREF(arr.base)
+ */
+    Py_INCREF(__pyx_v_base);
+
+    /* "numpy.pxd":971
+ *      else:
+ *          Py_INCREF(base) # important to do this before decref below!
+ *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
+ *      Py_XDECREF(arr.base)
+ *      arr.base = baseptr
+ */
+    __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
+  }
+  __pyx_L3:;
+
+  /* "numpy.pxd":972
+ *          Py_INCREF(base) # important to do this before decref below!
+ *          baseptr = <PyObject*>base
+ *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
+ *      arr.base = baseptr
+ * 
+ */
+  Py_XDECREF(__pyx_v_arr->base);
+
+  /* "numpy.pxd":973
+ *          baseptr = <PyObject*>base
+ *      Py_XDECREF(arr.base)
+ *      arr.base = baseptr             # <<<<<<<<<<<<<<
+ * 
+ * cdef inline object get_array_base(ndarray arr):
+ */
+  __pyx_v_arr->base = __pyx_v_baseptr;
+
+  __Pyx_RefNannyFinishContext();
+}
+
+/* "numpy.pxd":975
+ *      arr.base = baseptr
+ * 
+ * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
+ *     if arr.base is NULL:
+ *         return None
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  int __pyx_t_1;
+  __Pyx_RefNannySetupContext("get_array_base", 0);
+
+  /* "numpy.pxd":976
+ * 
+ * cdef inline object get_array_base(ndarray arr):
+ *     if arr.base is NULL:             # <<<<<<<<<<<<<<
+ *         return None
+ *     else:
+ */
+  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
+  if (__pyx_t_1) {
+
+    /* "numpy.pxd":977
+ * cdef inline object get_array_base(ndarray arr):
+ *     if arr.base is NULL:
+ *         return None             # <<<<<<<<<<<<<<
+ *     else:
+ *         return <object>arr.base
+ */
+    __Pyx_XDECREF(__pyx_r);
+    __Pyx_INCREF(Py_None);
+    __pyx_r = Py_None;
+    goto __pyx_L0;
+    goto __pyx_L3;
+  }
+  /*else*/ {
+
+    /* "numpy.pxd":979
+ *         return None
+ *     else:
+ *         return <object>arr.base             # <<<<<<<<<<<<<<
+ */
+    __Pyx_XDECREF(__pyx_r);
+    __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
+    __pyx_r = ((PyObject *)__pyx_v_arr->base);
+    goto __pyx_L0;
+  }
+  __pyx_L3:;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+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("redtoreg"),
+    0, /* m_doc */
+    -1, /* m_size */
+    __pyx_methods /* m_methods */,
+    NULL, /* m_reload */
+    NULL, /* m_traverse */
+    NULL, /* m_clear */
+    NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
+  {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0},
+  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
+  {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0},
+  {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0},
+  {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0},
+  {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0},
+  {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
+  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
+  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 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___redtoreg, __pyx_k___redtoreg, sizeof(__pyx_k___redtoreg), 0, 0, 1, 1},
+  {&__pyx_n_s__double, __pyx_k__double, sizeof(__pyx_k__double), 0, 0, 1, 1},
+  {&__pyx_n_s__flons, __pyx_k__flons, sizeof(__pyx_k__flons), 0, 0, 1, 1},
+  {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
+  {&__pyx_n_s__ilons, __pyx_k__ilons, sizeof(__pyx_k__ilons), 0, 0, 1, 1},
+  {&__pyx_n_s__im, __pyx_k__im, sizeof(__pyx_k__im), 0, 0, 1, 1},
+  {&__pyx_n_s__indx, __pyx_k__indx, sizeof(__pyx_k__indx), 0, 0, 1, 1},
+  {&__pyx_n_s__ip, __pyx_k__ip, sizeof(__pyx_k__ip), 0, 0, 1, 1},
+  {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1},
+  {&__pyx_n_s__lonsperlat, __pyx_k__lonsperlat, sizeof(__pyx_k__lonsperlat), 0, 0, 1, 1},
+  {&__pyx_n_s__lonsptr, __pyx_k__lonsptr, sizeof(__pyx_k__lonsptr), 0, 0, 1, 1},
+  {&__pyx_n_s__missval, __pyx_k__missval, sizeof(__pyx_k__missval), 0, 0, 1, 1},
+  {&__pyx_n_s__missvl, __pyx_k__missvl, sizeof(__pyx_k__missvl), 0, 0, 1, 1},
+  {&__pyx_n_s__msg, __pyx_k__msg, sizeof(__pyx_k__msg), 0, 0, 1, 1},
+  {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1},
+  {&__pyx_n_s__nlats, __pyx_k__nlats, sizeof(__pyx_k__nlats), 0, 0, 1, 1},
+  {&__pyx_n_s__nlons, __pyx_k__nlons, sizeof(__pyx_k__nlons), 0, 0, 1, 1},
+  {&__pyx_n_s__nlonsin, __pyx_k__nlonsin, sizeof(__pyx_k__nlonsin), 0, 0, 1, 1},
+  {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1},
+  {&__pyx_n_s__npts, __pyx_k__npts, sizeof(__pyx_k__npts), 0, 0, 1, 1},
+  {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1},
+  {&__pyx_n_s__ones, __pyx_k__ones, sizeof(__pyx_k__ones), 0, 0, 1, 1},
+  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
+  {&__pyx_n_s__redgrdptr, __pyx_k__redgrdptr, sizeof(__pyx_k__redgrdptr), 0, 0, 1, 1},
+  {&__pyx_n_s__redgrid, __pyx_k__redgrid, sizeof(__pyx_k__redgrid), 0, 0, 1, 1},
+  {&__pyx_n_s__redtoreg, __pyx_k__redtoreg, sizeof(__pyx_k__redtoreg), 0, 0, 1, 1},
+  {&__pyx_n_s__reggrdptr, __pyx_k__reggrdptr, sizeof(__pyx_k__reggrdptr), 0, 0, 1, 1},
+  {&__pyx_n_s__reggrid, __pyx_k__reggrid, sizeof(__pyx_k__reggrid), 0, 0, 1, 1},
+  {&__pyx_n_s__sum, __pyx_k__sum, sizeof(__pyx_k__sum), 0, 0, 1, 1},
+  {&__pyx_n_s__zdx, __pyx_k__zdx, sizeof(__pyx_k__zdx), 0, 0, 1, 1},
+  {&__pyx_n_s__zxi, __pyx_k__zxi, sizeof(__pyx_k__zxi), 0, 0, 1, 1},
+  {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  return 0;
+  __pyx_L1_error:;
+  return -1;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
+
+  /* "numpy.pxd":215
+ *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
+ *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
+ *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
+ * 
+ *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
+ */
+  __pyx_k_tuple_3 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_2)); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_3);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
+
+  /* "numpy.pxd":219
+ *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
+ *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
+ *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
+ * 
+ *             info.buf = PyArray_DATA(self)
+ */
+  __pyx_k_tuple_5 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_4)); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_5);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
+
+  /* "numpy.pxd":257
+ *                 if ((descr.byteorder == c'>' and little_endian) or
+ *                     (descr.byteorder == c'<' and not little_endian)):
+ *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
+ *                 if   t == NPY_BYTE:        f = "b"
+ *                 elif t == NPY_UBYTE:       f = "B"
+ */
+  __pyx_k_tuple_7 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_6)); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_7);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
+
+  /* "numpy.pxd":799
+ * 
+ *         if (end - f) - (new_offset - offset[0]) < 15:
+ *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
+ * 
+ *         if ((child.byteorder == c'>' and little_endian) or
+ */
+  __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_10);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
+
+  /* "numpy.pxd":803
+ *         if ((child.byteorder == c'>' and little_endian) or
+ *             (child.byteorder == c'<' and not little_endian)):
+ *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
+ *             # One could encode it in the format string and have Cython
+ *             # complain instead, BUT: < and > in format strings also imply
+ */
+  __pyx_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_6)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_11);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
+
+  /* "numpy.pxd":823
+ *             t = child.type_num
+ *             if end - f < 5:
+ *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
+ * 
+ *             # Until ticket #99 is fixed, use integers to avoid warnings
+ */
+  __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_13);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
+
+  /* "redtoreg.pyx":3
+ * import numpy as np
+ * cimport numpy as npc
+ * def _redtoreg(object nlonsin, npc.ndarray lonsperlat, npc.ndarray redgrid, \             # <<<<<<<<<<<<<<
+ *               object missval):
+ *     """
+ */
+  __pyx_k_tuple_14 = PyTuple_Pack(23, ((PyObject *)__pyx_n_s__nlonsin), ((PyObject *)__pyx_n_s__lonsperlat), ((PyObject *)__pyx_n_s__redgrid), ((PyObject *)__pyx_n_s__missval), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j), ((PyObject *)__pyx_n_s__n), ((PyObject *)__pyx_n_s__im), ((PyObject *)__pyx_n_s__ip), ((PyObject *)__pyx_n_s__indx), ((PyObject *)__pyx_n_s__ilons), ((PyObject *)__pyx_n_s__nlats), ((PyObject *)__pyx_n_s__npts), ((PyObject *)__pyx_n_s__zxi), ((PyObject *)__py [...]
+  __Pyx_GOTREF(__pyx_k_tuple_14);
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
+  __pyx_k_codeobj_15 = (PyObject*)__Pyx_PyCode_New(4, 0, 23, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s___redtoreg, 3, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __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_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__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 initredtoreg(void); /*proto*/
+PyMODINIT_FUNC initredtoreg(void)
+#else
+PyMODINIT_FUNC PyInit_redtoreg(void); /*proto*/
+PyMODINIT_FUNC PyInit_redtoreg(void)
+#endif
+{
+  PyObject *__pyx_t_1 = 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_redtoreg(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("redtoreg"), __pyx_methods, 0, 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, "redtoreg")) {
+      if (unlikely(PyDict_SetItemString(modules, "redtoreg", __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_redtoreg) {
+    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 ---*/
+  /*--- Type import code ---*/
+  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
+  #if CYTHON_COMPILING_IN_PYPY
+  sizeof(PyTypeObject),
+  #else
+  sizeof(PyHeapTypeObject),
+  #endif
+  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /*--- Variable import code ---*/
+  /*--- Function import code ---*/
+  /*--- Execution code ---*/
+
+  /* "redtoreg.pyx":1
+ * import numpy as np             # <<<<<<<<<<<<<<
+ * cimport numpy as npc
+ * def _redtoreg(object nlonsin, npc.ndarray lonsperlat, npc.ndarray redgrid, \
+ */
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __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 = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "redtoreg.pyx":3
+ * import numpy as np
+ * cimport numpy as npc
+ * def _redtoreg(object nlonsin, npc.ndarray lonsperlat, npc.ndarray redgrid, \             # <<<<<<<<<<<<<<
+ *               object missval):
+ *     """
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8redtoreg_1_redtoreg, NULL, __pyx_n_s__redtoreg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s___redtoreg, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "redtoreg.pyx":1
+ * import numpy as np             # <<<<<<<<<<<<<<
+ * cimport numpy as npc
+ * def _redtoreg(object nlonsin, npc.ndarray lonsperlat, npc.ndarray redgrid, \
+ */
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+
+  /* "numpy.pxd":975
+ *      arr.base = baseptr
+ * 
+ * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
+ *     if arr.base is NULL:
+ *         return None
+ */
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  if (__pyx_m) {
+    __Pyx_AddTraceback("init redtoreg", __pyx_clineno, __pyx_lineno, __pyx_filename);
+    Py_DECREF(__pyx_m); __pyx_m = 0;
+  } else if (!PyErr_Occurred()) {
+    PyErr_SetString(PyExc_ImportError, "init redtoreg");
+  }
+  __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 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 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_mod_long(long a, long b) {
+    long r = a % b;
+    r += ((r != 0) & ((r ^ b) < 0)) * b;
+    return r;
+}
+
+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 void __Pyx_RaiseNoneNotIterableError(void) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
+}
+
+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 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;
+}
+
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
+      return ::std::complex< float >(x, y);
+    }
+  #else
+    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
+      return x + y*(__pyx_t_float_complex)_Complex_I;
+    }
+  #endif
+#else
+    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
+      __pyx_t_float_complex z;
+      z.real = x;
+      z.imag = y;
+      return z;
+    }
+#endif
+
+#if CYTHON_CCOMPLEX
+#else
+    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+       return (a.real == b.real) && (a.imag == b.imag);
+    }
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+        __pyx_t_float_complex z;
+        z.real = a.real + b.real;
+        z.imag = a.imag + b.imag;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+        __pyx_t_float_complex z;
+        z.real = a.real - b.real;
+        z.imag = a.imag - b.imag;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+        __pyx_t_float_complex z;
+        z.real = a.real * b.real - a.imag * b.imag;
+        z.imag = a.real * b.imag + a.imag * b.real;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+        __pyx_t_float_complex z;
+        float denom = b.real * b.real + b.imag * b.imag;
+        z.real = (a.real * b.real + a.imag * b.imag) / denom;
+        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
+        __pyx_t_float_complex z;
+        z.real = -a.real;
+        z.imag = -a.imag;
+        return z;
+    }
+    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
+       return (a.real == 0) && (a.imag == 0);
+    }
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
+        __pyx_t_float_complex z;
+        z.real =  a.real;
+        z.imag = -a.imag;
+        return z;
+    }
+    #if 1
+        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
+          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
+            return sqrtf(z.real*z.real + z.imag*z.imag);
+          #else
+            return hypotf(z.real, z.imag);
+          #endif
+        }
+        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+            __pyx_t_float_complex z;
+            float r, lnr, theta, z_r, z_theta;
+            if (b.imag == 0 && b.real == (int)b.real) {
+                if (b.real < 0) {
+                    float denom = a.real * a.real + a.imag * a.imag;
+                    a.real = a.real / denom;
+                    a.imag = -a.imag / denom;
+                    b.real = -b.real;
+                }
+                switch ((int)b.real) {
+                    case 0:
+                        z.real = 1;
+                        z.imag = 0;
+                        return z;
+                    case 1:
+                        return a;
+                    case 2:
+                        z = __Pyx_c_prodf(a, a);
+                        return __Pyx_c_prodf(a, a);
+                    case 3:
+                        z = __Pyx_c_prodf(a, a);
+                        return __Pyx_c_prodf(z, a);
+                    case 4:
+                        z = __Pyx_c_prodf(a, a);
+                        return __Pyx_c_prodf(z, z);
+                }
+            }
+            if (a.imag == 0) {
+                if (a.real == 0) {
+                    return a;
+                }
+                r = a.real;
+                theta = 0;
+            } else {
+                r = __Pyx_c_absf(a);
+                theta = atan2f(a.imag, a.real);
+            }
+            lnr = logf(r);
+            z_r = expf(lnr * b.real - theta * b.imag);
+            z_theta = theta * b.real + lnr * b.imag;
+            z.real = z_r * cosf(z_theta);
+            z.imag = z_r * sinf(z_theta);
+            return z;
+        }
+    #endif
+#endif
+
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
+      return ::std::complex< double >(x, y);
+    }
+  #else
+    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
+      return x + y*(__pyx_t_double_complex)_Complex_I;
+    }
+  #endif
+#else
+    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
+      __pyx_t_double_complex z;
+      z.real = x;
+      z.imag = y;
+      return z;
+    }
+#endif
+
+#if CYTHON_CCOMPLEX
+#else
+    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+       return (a.real == b.real) && (a.imag == b.imag);
+    }
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+        __pyx_t_double_complex z;
+        z.real = a.real + b.real;
+        z.imag = a.imag + b.imag;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+        __pyx_t_double_complex z;
+        z.real = a.real - b.real;
+        z.imag = a.imag - b.imag;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+        __pyx_t_double_complex z;
+        z.real = a.real * b.real - a.imag * b.imag;
+        z.imag = a.real * b.imag + a.imag * b.real;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+        __pyx_t_double_complex z;
+        double denom = b.real * b.real + b.imag * b.imag;
+        z.real = (a.real * b.real + a.imag * b.imag) / denom;
+        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
+        __pyx_t_double_complex z;
+        z.real = -a.real;
+        z.imag = -a.imag;
+        return z;
+    }
+    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
+       return (a.real == 0) && (a.imag == 0);
+    }
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
+        __pyx_t_double_complex z;
+        z.real =  a.real;
+        z.imag = -a.imag;
+        return z;
+    }
+    #if 1
+        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
+          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
+            return sqrt(z.real*z.real + z.imag*z.imag);
+          #else
+            return hypot(z.real, z.imag);
+          #endif
+        }
+        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+            __pyx_t_double_complex z;
+            double r, lnr, theta, z_r, z_theta;
+            if (b.imag == 0 && b.real == (int)b.real) {
+                if (b.real < 0) {
+                    double denom = a.real * a.real + a.imag * a.imag;
+                    a.real = a.real / denom;
+                    a.imag = -a.imag / denom;
+                    b.real = -b.real;
+                }
+                switch ((int)b.real) {
+                    case 0:
+                        z.real = 1;
+                        z.imag = 0;
+                        return z;
+                    case 1:
+                        return a;
+                    case 2:
+                        z = __Pyx_c_prod(a, a);
+                        return __Pyx_c_prod(a, a);
+                    case 3:
+                        z = __Pyx_c_prod(a, a);
+                        return __Pyx_c_prod(z, a);
+                    case 4:
+                        z = __Pyx_c_prod(a, a);
+                        return __Pyx_c_prod(z, z);
+                }
+            }
+            if (a.imag == 0) {
+                if (a.real == 0) {
+                    return a;
+                }
+                r = a.real;
+                theta = 0;
+            } else {
+                r = __Pyx_c_abs(a);
+                theta = atan2(a.imag, a.real);
+            }
+            lnr = log(r);
+            z_r = exp(lnr * b.real - theta * b.imag);
+            z_theta = theta * b.real + lnr * b.imag;
+            z.real = z_r * cos(z_theta);
+            z.imag = z_r * sin(z_theta);
+            return z;
+        }
+    #endif
+#endif
+
+static CYTHON_INLINE 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 */
diff --git a/redtoreg.pyx b/redtoreg.pyx
new file mode 100644
index 0000000..a18f50b
--- /dev/null
+++ b/redtoreg.pyx
@@ -0,0 +1,54 @@
+import numpy as np
+cimport numpy as npc
+def _redtoreg(object nlonsin, npc.ndarray lonsperlat, npc.ndarray redgrid, \
+              object missval):
+    """
+    convert data on global reduced gaussian to global
+    full gaussian grid using linear interpolation.
+    """
+    cdef long i, j, n, im, ip, indx, ilons, nlats, npts
+    cdef double zxi, zdx, flons, missvl
+    cdef npc.ndarray reggrid
+    cdef double *redgrdptr, *reggrdptr
+    cdef long *lonsptr
+    nlons = nlonsin
+    nlats = len(lonsperlat)
+    npts = len(redgrid)
+    if lonsperlat.sum() != npts:
+        msg='size of reduced grid does not match number of data values'
+        raise ValueError(msg)
+    reggrid = missval*np.ones((nlats,nlons),np.double)
+    # get data buffers and cast to desired type.
+    lonsptr = <long *>lonsperlat.data
+    redgrdptr = <double *>redgrid.data
+    reggrdptr = <double *>reggrid.data
+    missvl = <double>missval
+    # iterate over full grid, do linear interpolation.
+    n = 0
+    indx = 0
+    for j from 0 <= j < nlats:
+        ilons = lonsptr[j]
+        flons = <double>ilons
+        for i from 0 <= i < nlons:
+            # zxi is the grid index (relative to the reduced grid)
+            # of the i'th point on the full grid. 
+            zxi = i * flons / nlons # goes from 0 to ilons
+            im = <long>zxi
+            zdx = zxi - <double>im
+            if ilons != 0:
+                im = (im + ilons)%ilons
+                ip = (im + 1 + ilons)%ilons
+                # if one of the nearest values is missing, use nearest
+                # neighbor interpolation.
+                if redgrdptr[indx+im] == missvl or\
+                   redgrdptr[indx+ip] == missvl: 
+                    if zdx < 0.5:
+                        reggrdptr[n] = redgrdptr[indx+im]
+                    else:
+                        reggrdptr[n] = redgrdptr[indx+ip]
+                else: # linear interpolation.
+                    reggrdptr[n] = redgrdptr[indx+im]*(1.-zdx) +\
+                                   redgrdptr[indx+ip]*zdx
+            n = n + 1
+        indx = indx + ilons
+    return reggrid
diff --git a/sampledata/CMC_reg_WIND_ISBL_300_ps60km_2010052400_P012.grib b/sampledata/CMC_reg_WIND_ISBL_300_ps60km_2010052400_P012.grib
new file mode 100644
index 0000000..33ddea5
Binary files /dev/null and b/sampledata/CMC_reg_WIND_ISBL_300_ps60km_2010052400_P012.grib differ
diff --git a/sampledata/cl00010000_ecoclimap_rot.grib1 b/sampledata/cl00010000_ecoclimap_rot.grib1
new file mode 100644
index 0000000..9d13e3d
Binary files /dev/null and b/sampledata/cl00010000_ecoclimap_rot.grib1 differ
diff --git a/sampledata/ds.maxt.bin b/sampledata/ds.maxt.bin
new file mode 100644
index 0000000..cf7e273
Binary files /dev/null and b/sampledata/ds.maxt.bin differ
diff --git a/sampledata/dspr.temp.bin b/sampledata/dspr.temp.bin
new file mode 100644
index 0000000..3bdb267
Binary files /dev/null and b/sampledata/dspr.temp.bin differ
diff --git a/sampledata/ecmwf_tigge.grb b/sampledata/ecmwf_tigge.grb
new file mode 100644
index 0000000..d9deebc
Binary files /dev/null and b/sampledata/ecmwf_tigge.grb differ
diff --git a/sampledata/eta.grb b/sampledata/eta.grb
new file mode 100755
index 0000000..783a41c
Binary files /dev/null and b/sampledata/eta.grb differ
diff --git a/sampledata/eumetsat_precip.grb b/sampledata/eumetsat_precip.grb
new file mode 100644
index 0000000..84e7083
Binary files /dev/null and b/sampledata/eumetsat_precip.grb differ
diff --git a/sampledata/flux.grb b/sampledata/flux.grb
new file mode 100755
index 0000000..72b0dfc
Binary files /dev/null and b/sampledata/flux.grb differ
diff --git a/sampledata/gfs.grb b/sampledata/gfs.grb
new file mode 100755
index 0000000..efbf25a
Binary files /dev/null and b/sampledata/gfs.grb differ
diff --git a/sampledata/gfs.t12z.pgrbf120.2p5deg.grib2 b/sampledata/gfs.t12z.pgrbf120.2p5deg.grib2
new file mode 100644
index 0000000..d141e16
Binary files /dev/null and b/sampledata/gfs.t12z.pgrbf120.2p5deg.grib2 differ
diff --git a/sampledata/ngm.grb b/sampledata/ngm.grb
new file mode 100755
index 0000000..1928978
Binary files /dev/null and b/sampledata/ngm.grb differ
diff --git a/sampledata/reduced_latlon_surface.grib2 b/sampledata/reduced_latlon_surface.grib2
new file mode 100644
index 0000000..027fa4a
Binary files /dev/null and b/sampledata/reduced_latlon_surface.grib2 differ
diff --git a/sampledata/regular_latlon_surface.grib1 b/sampledata/regular_latlon_surface.grib1
new file mode 100644
index 0000000..bfc6c05
Binary files /dev/null and b/sampledata/regular_latlon_surface.grib1 differ
diff --git a/sampledata/regular_latlon_surface.grib2 b/sampledata/regular_latlon_surface.grib2
new file mode 100644
index 0000000..44a61b9
Binary files /dev/null and b/sampledata/regular_latlon_surface.grib2 differ
diff --git a/sampledata/rotated_ll.grib1 b/sampledata/rotated_ll.grib1
new file mode 100644
index 0000000..945bd3a
Binary files /dev/null and b/sampledata/rotated_ll.grib1 differ
diff --git a/sampledata/safrica.grib2 b/sampledata/safrica.grib2
new file mode 100644
index 0000000..3c4b261
Binary files /dev/null and b/sampledata/safrica.grib2 differ
diff --git a/sampledata/spherical_pressure_level.grib1 b/sampledata/spherical_pressure_level.grib1
new file mode 100644
index 0000000..a0603f5
Binary files /dev/null and b/sampledata/spherical_pressure_level.grib1 differ
diff --git a/sampledata/tigge.grb b/sampledata/tigge.grb
new file mode 100644
index 0000000..58f8c2a
Binary files /dev/null and b/sampledata/tigge.grb differ
diff --git a/sampledata/tpcprblty.grib2 b/sampledata/tpcprblty.grib2
new file mode 100644
index 0000000..95495b9
Binary files /dev/null and b/sampledata/tpcprblty.grib2 differ
diff --git a/setup.cfg.template b/setup.cfg.template
new file mode 100644
index 0000000..16cff25
--- /dev/null
+++ b/setup.cfg.template
@@ -0,0 +1,31 @@
+# Rename this file to setup.cfg to set pygrib's
+# build options. 
+# Follow instructions below for editing.
+[directories]
+# uncomment and set to grib_api install location.
+# Include files should be located in grib_api_dir/include and
+# the library should be located in grib_api_dir/lib.
+# If the libraries and include files are installed in separate locations,
+# use grib_api_libdir and grib_api_incdir to specify the locations
+# separately.  
+#grib_api_dir = /usr/local
+# if grib_api was built with jasper support for JPEG200,
+# uncomment and set to jasper lib install location.
+# If the libraries and include files are installed in separate locations,
+# use jasper_libdir and jasper_incdir.
+#jasper_dir = /usr/local
+# if grib_api was built with openjpeg support for JPEG200,
+# uncomment and set to openjpeg lib install location.
+# If the libraries and include files are installed in separate locations,
+# use openjpeg_libdir and openjpeg_incdir.
+#openjpeg_dir = /usr/local
+# if grib_api was built with png support,
+# uncomment and set to png lib install location.
+# If the libraries and include files are installed in separate locations,
+# use png_libdir and png_incdir.
+#png_dir = /usr
+# if grib_api was built with png support,
+# uncomment and set to zlib install location.
+#zlib_dir = /usr
+# install man pages for command line utilities here
+#man_dir = /usr/local/man
diff --git a/setup.py b/setup.py
new file mode 100755
index 0000000..636214e
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,160 @@
+from distutils.core import setup, Extension
+import os, glob, numpy, sys
+if sys.version_info[0] < 3:
+    import ConfigParser as configparser
+else:
+    import configparser
+
+grib_api_dir = os.environ.get('GRIBAPI_DIR')
+grib_api_libdir = os.environ.get('GRIBAPI_LIBDIR')
+grib_api_incdir = os.environ.get('GRIBAPI_INCDIR')
+jasper_dir = os.environ.get('JASPER_DIR')
+jasper_libdir = os.environ.get('JASPER_LIBDIR')
+jasper_incdir = os.environ.get('JASPER_INCDIR')
+png_dir = os.environ.get('PNG_DIR')
+png_libdir = os.environ.get('PNG_LIBDIR')
+png_incdir = os.environ.get('PNG_INCDIR')
+zlib_dir = os.environ.get('ZLIB_DIR')
+zlib_libdir = os.environ.get('ZLIB_LIBDIR')
+zlib_incdir = os.environ.get('ZLIB_INCDIR')
+openjpeg_dir = os.environ.get('OPENJPEG_DIR')
+openjpeg_libdir = os.environ.get('OPENJPEG_LIBDIR')
+openjpeg_incdir = os.environ.get('OPENJPEG_INCDIR')
+# where to install man pages?
+man_dir = os.environ.get('MAN_DIR')
+
+setup_cfg = os.environ.get('PYGRIBSETUPCFG', 'setup.cfg')
+# contents of setup.cfg will override env vars.
+if os.path.exists(setup_cfg):
+    sys.stdout.write('reading from setup.cfg...')
+    config = configparser.SafeConfigParser()
+    config.read(setup_cfg)
+    try: grib_api_dir = config.get("directories", "grib_api_dir")
+    except: pass
+    try: grib_api_libdir = config.get("directories", "grib_api_libdir")
+    except: pass
+    try: grib_api_incdir = config.get("directories", "grib_api_incdir")
+    except: pass
+    try: jasper_dir = config.get("directories", "jasper_dir")
+    except: pass
+    try: jasper_libdir = config.get("directories", "jasper_libdir")
+    except: pass
+    try: jasper_incdir = config.get("directories", "jasper_incdir")
+    except: pass
+    try: png_dir = config.get("directories", "png_dir")
+    except: pass
+    try: png_libdir = config.get("directories", "png_libdir")
+    except: pass
+    try: png_incdir = config.get("directories", "png_incdir")
+    except: pass
+    try: openjpeg_dir = config.get("directories", "openjpeg_dir")
+    except: pass
+    try: openjpeg_libdir = config.get("directories", "openjpeg_libdir")
+    except: pass
+    try: openjpeg_incdir = config.get("directories", "openjpeg_incdir")
+    except: pass
+    try: zlib_dir = config.get("directories", "zlib_dir")
+    except: pass
+    try: zlib_libdir = config.get("directories", "zlib_libdir")
+    except: pass
+    try: zlib_incdir = config.get("directories", "zlib_incdir")
+    except: pass
+    try: man_dir = config.get("directories", "man_dir")
+    except: pass
+
+libdirs=[]
+incdirs=[numpy.get_include()]
+libraries=['grib_api']
+
+if grib_api_libdir is None and grib_api_dir is not None:
+    libdirs.append(os.path.join(grib_api_dir,'lib'))
+    libdirs.append(os.path.join(grib_api_dir,'lib64'))
+if grib_api_incdir is None and grib_api_dir is not None:
+    incdirs.append(os.path.join(grib_api_dir,'include'))
+
+if jasper_dir is not None or jasper_libdir is not None:
+    libraries.append("jasper")
+if jasper_libdir is None and jasper_dir is not None:
+    libdirs.append(os.path.join(jasper_dir,'lib'))
+    libdirs.append(os.path.join(jasper_dir,'lib64'))
+if jasper_incdir is None and jasper_dir is not None:
+    incdirs.append(os.path.join(jasper_dir,'include'))
+    incdirs.append(os.path.join(jasper_dir,'include/jasper'))
+
+if openjpeg_dir is not None or openjpeg_libdir is not None:
+    libraries.append("openjpeg")
+if openjpeg_libdir is None and openjpeg_dir is not None:
+    libdirs.append(os.path.join(openjpeg_dir,'lib'))
+    libdirs.append(os.path.join(openjpeg_dir,'lib64'))
+if openjpeg_incdir is None and openjpeg_dir is not None:
+    incdirs.append(os.path.join(openjpeg_dir,'include'))
+
+if png_dir is not None or png_libdir is not None:
+    libraries.append("png")
+if png_libdir is None and png_dir is not None:
+    libdirs.append(os.path.join(png_dir,'lib'))
+    libdirs.append(os.path.join(png_dir,'lib64'))
+if png_incdir is None and png_dir is not None:
+    incdirs.append(os.path.join(png_dir,'include'))
+
+if zlib_dir is not None or zlib_libdir is not None:
+    libraries.append("z")
+if zlib_libdir is None and zlib_dir is not None:
+    libdirs.append(os.path.join(zlib_dir,'lib'))
+    libdirs.append(os.path.join(zlib_dir,'lib64'))
+if zlib_incdir is None and zlib_dir is not None:
+    incdirs.append(os.path.join(zlib_dir,'include'))
+
+g2clib_deps = glob.glob('g2clib_src/*.c')
+g2clib_deps.append('g2clib.c')
+incdirs.append("g2clib_src")
+macros=[]
+
+# if jasper or openjpeg lib not available...
+if 'jasper' not in libraries and 'openjpeg' not in libraries:
+    g2clib_deps.remove('g2clib_src/jpcpack.c')
+    g2clib_deps.remove('g2clib_src/jpcunpack.c')
+else:
+    macros.append(('USE_JPEG2000',1))
+# if png lib not available...
+if 'png' not in libraries:
+    g2clib_deps.remove('g2clib_src/pngpack.c')
+    g2clib_deps.remove('g2clib_src/pngunpack.c')
+else:
+    macros.append(('USE_PNG',1))
+
+if hasattr(sys,'maxsize'):
+    if sys.maxsize > 2**31-1: macros.append(('__64BIT__',1))
+else:
+    if sys.maxint > 2**31-1: macros.append(('__64BIT__',1))
+
+g2clibext = Extension("g2clib",g2clib_deps,include_dirs=incdirs,\
+            library_dirs=libdirs,libraries=libraries,runtime_library_dirs=libdirs,define_macros=macros)
+redtoregext =\
+Extension("redtoreg",["redtoreg.c"],include_dirs=[numpy.get_include()])
+pygribext =\
+Extension("pygrib",["pygrib.c"],include_dirs=incdirs,library_dirs=libdirs,\
+          runtime_library_dirs=libdirs,libraries=libraries)
+
+# man pages installed in man_dir/man1
+if man_dir is not None:
+    manpages = glob.glob(os.path.join('man','*.1'))
+    data_files = [(os.path.join(man_dir,'man1'), manpages)]
+# if man_dir not set, man pages not installed
+else:
+    data_files = None
+
+
+
+setup(name = "pygrib",
+      version = "1.9.9",
+      description       = "Python module for reading/writing GRIB files",
+      author            = "Jeff Whitaker",
+      author_email      = "jeffrey.s.whitaker at noaa.gov",
+      url               = "http://code.google.com/p/pygrib",
+      download_url      = "http://code.google.com/p/pygrib/downloads/list",
+      scripts =
+      ['utils/grib_list','utils/grib_repack','utils/cnvgrib1to2','utils/cnvgrib2to1'],
+      ext_modules       = [pygribext,g2clibext,redtoregext],
+      py_modules        = ["ncepgrib2"],
+      data_files        = data_files)
diff --git a/test.py b/test.py
new file mode 100644
index 0000000..6a14bbc
--- /dev/null
+++ b/test.py
@@ -0,0 +1,235 @@
+def test():
+    """
+    demonstrates basic pygrib functionality.
+
+    open a grib file, create an iterator.
+    >>> import pygrib
+    >>> list(pygrib.open('sampledata/flux.grb'))
+    [1:Precipitation rate:kg m**-2 s**-1 (avg):regular_gg:surface:level 0:fcst time 108-120 hrs (avg):from 200402291200, 2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200, 3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200, 4:Minimum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200]
+    >>> pygrib.open('sampledata/flux.grb').read()
+    [1:Precipitation rate:kg m**-2 s**-1 (avg):regular_gg:surface:level 0:fcst time 108-120 hrs (avg):from 200402291200, 2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200, 3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200, 4:Minimum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200]
+    >>> grbs = pygrib.open('sampledata/flux.grb')
+
+    acts like a file object
+    >>> grbs.tell()
+    0
+    >>> grbs.read(1)
+    [1:Precipitation rate:kg m**-2 s**-1 (avg):regular_gg:surface:level 0:fcst time 108-120 hrs (avg):from 200402291200]
+    >>> grbs.tell()
+    1
+    >>> grbs.read(2)
+    [2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200, 3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200]
+    >>> grbs.read()
+    [4:Minimum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200]
+    >>> grbs.seek(1)
+    >>> grbs.readline()
+    2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200
+    >>> grbs.seek(-3,2)
+    >>> grbs.readline()
+    2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200
+    >>> grbs.seek(1,1)
+    >>> grbs.readline()
+    4:Minimum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+    >>> grbs.seek(0)
+
+    first grib message
+    >>> grb1 = grbs.readline()
+    >>> grb1
+    1:Precipitation rate:kg m**-2 s**-1 (avg):regular_gg:surface:level 0:fcst time 108-120 hrs (avg):from 200402291200
+
+    iterate over rest of grib messages.
+    >>> for grb in grbs: grb
+    2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200
+    3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+    4:Minimum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+
+    iterator now positioned at last message
+    >>> grb
+    4:Minimum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+
+    grb1 is still first grib message
+    >>> grb1
+    1:Precipitation rate:kg m**-2 s**-1 (avg):regular_gg:surface:level 0:fcst time 108-120 hrs (avg):from 200402291200
+
+    position iterator at beginning again.
+    >>> grbs.rewind()
+    >>> for grb in grbs: grb
+    1:Precipitation rate:kg m**-2 s**-1 (avg):regular_gg:surface:level 0:fcst time 108-120 hrs (avg):from 200402291200
+    2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200
+    3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+    4:Minimum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+
+    get a specific grib message from the iterator.
+    iterator will be positioned at this message.
+    >>> grb = grbs.message(3)
+    >>> grb # 3rd message
+    3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+
+    indexing iterator with an integer key has the same result,
+    except that the position of iterator does not change.
+    >>> grbs.seek(0) # position iterator at beginning (same as grbs.rewind())
+    >>> grb = grbs[2] # 2nd message
+    >>> grb
+    2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200
+
+    position iterator at next grib message.
+    >>> grb = grbs.readline()
+    >>> grb # back to the 1st message
+    1:Precipitation rate:kg m**-2 s**-1 (avg):regular_gg:surface:level 0:fcst time 108-120 hrs (avg):from 200402291200
+
+    use select method to choose grib messages based upon specified key/value pairs.
+    >>> selected_grbs = grbs.select(level=2,typeOfLevel='heightAboveGround') # get all 2-m level fields
+    >>> for grb in selected_grbs: grb
+    3:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+    4:Minimum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+
+    or create grib index instance for faster searching
+    >>> grbindx = pygrib.index('sampledata/flux.grb','name','typeOfLevel','level')
+    >>> selgrbs = grbindx(name='Minimum temperature',level=2,typeOfLevel='heightAboveGround')
+    >>> for grb in selgrbs: grb
+    1:Minimum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+    >>> selgrbs = grbindx(name='Maximum temperature',level=2,typeOfLevel='heightAboveGround')
+    >>> for grb in selgrbs: grb
+    1:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+    >>> grbindx.write('flux.grb.idx') # save the index
+    >>> grbindx.close()
+
+    reload the saved index
+    >>> grbindx = pygrib.index('flux.grb.idx')
+    >>> selgrbs = grbindx(name='Minimum temperature',level=2,typeOfLevel='heightAboveGround')
+    >>> for grb in selgrbs: grb
+    1:Minimum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+    >>> selgrbs = grbindx(name='Maximum temperature',level=2,typeOfLevel='heightAboveGround')
+    >>> for grb in selgrbs: grb
+    1:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+    >>> grbindx.close()
+
+    >>> grb = selgrbs[0]
+    >>> grb
+    1:Maximum temperature:K (instant):regular_gg:heightAboveGround:level 2 m:fcst time 108-120 hrs:from 200402291200
+
+    get the data and the lat/lon values of the Max temp grid
+    >>> data = grb['values'] # 'values' returns the data
+    >>> 'shape/min/max data %s %6.2f %6.2f'%(str(data.shape),data.min(),data.max())
+    'shape/min/max data (94, 192) 223.70 319.90'
+    >>> lats, lons = grb.latlons() # returns lat/lon values on grid.
+    >>> str('min/max of %d lats on %s grid %4.2f %4.2f' % (grb['Nj'], grb['typeOfGrid'],lats.min(),lats.max()))
+    'min/max of 94 lats on regular_gg grid -88.54 88.54'
+    >>> str('min/max of %d lons on %s grid %4.2f %4.2f' % (grb['Ni'], grb['typeOfGrid'],lons.min(),lons.max()))
+    'min/max of 192 lons on regular_gg grid 0.00 358.12'
+
+    get 2nd grib message from the iterator
+    >>> grb = grbs.message(2)
+    >>> grb
+    2:Surface pressure:Pa (instant):regular_gg:surface:level 0:fcst time 120 hrs:from 200402291200
+    >>> 'valid date %s' % grb['validityDate']
+    'valid date 20040305'
+    >>> 'min/max %5.1f %5.1f' % (grb['minimum'],grb['maximum'])
+    'min/max 49650.0 109330.0'
+
+    change the forecast time.
+    gribmessage keys can be accessed either via attributes or key/value pairs.
+    >>> grb['forecastTime'] = 168
+    >>> grb['forecastTime']
+    168
+    >>> grb.forecastTime = 240
+    >>> grb.forecastTime
+    240
+    >>> grb['parameterNumber'] = 2 # change to pressure tendency
+    >>> data = grb['values']
+    >>> grb['values']=data/1000. # rescale
+
+    open an output file for writing
+    >>> grbout = open('test.grb','wb')
+
+    get coded binary string for modified message
+    >>> msg = grb.tostring()
+
+    write to file and close.
+    >>> ret = grbout.write(msg)
+    >>> grbout.close()
+
+    reopen file, check contents.
+    >>> grbs = pygrib.open('test.grb')
+    >>> grb = grbs.readline()
+    >>> grb
+    1:Pressure tendency:Pa s**-1 (instant):regular_gg:surface:level 0:fcst time 240 hrs:from 200402291200
+    >>> 'valid date %s' % grb['validityDate']
+    'valid date 20040310'
+    >>> grb.analDate
+    datetime.datetime(2004, 2, 29, 12, 0)
+    >>> grb.validDate
+    datetime.datetime(2004, 3, 10, 12, 0)
+
+    disable this test for now, since the result depends on the version
+    of grib_api installed.
+    #>>> str('min/max %4.2f %4.2f' % (grb['minimum'],grb['maximum']))
+    #'min/max 49.65 109.65'
+
+    >>> grbs.close()
+
+    test open.select with scalars, sequences and functions.
+    >>> grbs = pygrib.open('sampledata/gfs.grb')
+    >>> sel_grbs = grbs.select(shortName='t',level=500)
+    >>> for grb in sel_grbs: grb
+    101:Temperature:K (instant):regular_ll:isobaricInhPa:level 50000 Pa:fcst time 72 hrs:from 201110080000
+    >>> sel_grbs = grbs.select(shortName='t',level=(850,700,500))
+    >>> for grb in sel_grbs: grb
+    101:Temperature:K (instant):regular_ll:isobaricInhPa:level 50000 Pa:fcst time 72 hrs:from 201110080000
+    133:Temperature:K (instant):regular_ll:isobaricInhPa:level 70000 Pa:fcst time 72 hrs:from 201110080000
+    157:Temperature:K (instant):regular_ll:isobaricInhPa:level 85000 Pa:fcst time 72 hrs:from 201110080000
+    >>> sel_grbs = grbs.select(shortName='t',level=lambda l: l < 500 and l >= 300)
+    >>> for grb in sel_grbs: grb
+    69:Temperature:K (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 72 hrs:from 201110080000
+    77:Temperature:K (instant):regular_ll:isobaricInhPa:level 35000 Pa:fcst time 72 hrs:from 201110080000
+    85:Temperature:K (instant):regular_ll:isobaricInhPa:level 40000 Pa:fcst time 72 hrs:from 201110080000
+    93:Temperature:K (instant):regular_ll:isobaricInhPa:level 45000 Pa:fcst time 72 hrs:from 201110080000
+    >>> from datetime import datetime
+    >>> sel_grbs = grbs.select(shortName='t',level=300,validDate=datetime(2011,10,11,0))
+    >>> for grb in sel_grbs: grb
+    69:Temperature:K (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 72 hrs:from 201110080000
+    >>> lats, lons = grb.latlons() # returns lat/lon values on grid.
+    >>> str('min/max of %d lats on %s grid %4.2f %4.2f' % (grb['Nj'], grb['typeOfGrid'],lats.min(),lats.max()))
+    'min/max of 73 lats on regular_ll grid -90.00 90.00'
+
+    test data subsetting via data method.
+    >>> datsubset,latsubset,lonsubset=grb.data(lat1=15,lat2=65,lon1=220,lon2=320)
+    >>> latsubset.min(),latsubset.max(),lonsubset.min(),lonsubset.max()
+    (15.0, 65.0, 220.0, 320.0)
+    >>> 'shape/min/max data subset %s %6.2f %6.2f' % (str(datsubset.shape),datsubset.min(),datsubset.max())
+    'shape/min/max data subset (21, 41) 219.70 247.60'
+
+    >>> grbstr = grb.tostring()
+    >>> grb2 = pygrib.fromstring(grbstr)
+    >>> grb2
+    1:Temperature:K (instant):regular_ll:isobaricInhPa:level 30000 Pa:fcst time 72 hrs:from 201110080000
+    >>> grb2.analDate
+    datetime.datetime(2011, 10, 8, 0, 0)
+    >>> grb2.validDate
+    datetime.datetime(2011, 10, 11, 0, 0)
+    >>> grbs.close()
+    >>> grbs = pygrib.open('sampledata/gfs.t12z.pgrbf120.2p5deg.grib2')
+    >>> # see if multi-part grib messages are counted properly
+    >>> grbs.messages
+    343
+    >>> grbs.close()
+
+    test ndfd file with 'grid_complex_spatial_differencing' encoding
+    >>> grbs = pygrib.open('sampledata/dspr.temp.bin')
+    >>> for grb in grbs: grb
+    1:Maximum temperature:K (max):mercator:surface:level 0:fcst time 2-14 hrs (max):from 201109292200
+    2:Maximum temperature:K (max):mercator:surface:level 0:fcst time 26-38 hrs (max):from 201109292200
+    3:Maximum temperature:K (max):mercator:surface:level 0:fcst time 50-62 hrs (max):from 201109292200
+    4:Maximum temperature:K (max):mercator:surface:level 0:fcst time 74-86 hrs (max):from 201109292200
+    >>> str(grb.packingType)
+    'grid_complex_spatial_differencing'
+    >>> data = grb.values
+    >>> str('min/max %5.2f %5.2f' % (data.min(), data.max()))
+    'min/max 295.40 308.10'
+    """
+
+if __name__ == "__main__":
+    import doctest
+    doctest.testmod(verbose=True)
+    import pygrib, sys
+    sys.stdout.write('using GRIB API version %s\n' % pygrib.grib_api_version)
diff --git a/test/README b/test/README
new file mode 100644
index 0000000..68d3baa
--- /dev/null
+++ b/test/README
@@ -0,0 +1,6 @@
+these examples read GRIB files and generate
+plots of the data using matplotlib and the basemap toolkit
+(both availabe from http://matplotlib.sf.net).
+
+test_spectral.py also uses pyspharm, available from 
+http://code.google.com/p/pyspharm.
diff --git a/test/animate.py b/test/animate.py
new file mode 100644
index 0000000..5bd19c7
--- /dev/null
+++ b/test/animate.py
@@ -0,0 +1,41 @@
+import pygrib, time
+import matplotlib.pyplot as plt
+import numpy as np
+from mpl_toolkits.basemap import Basemap
+import matplotlib.animation as animation
+
+# animation example.
+
+grbs = pygrib.open('../sampledata/safrica.grib2')
+# grab all "brightness temp" grib messages.
+btemps = [grb for grb in grbs if grb['name']=='Brightness temperature']
+grb = btemps[0]
+lats, lons = grb.latlons()
+projd = grb.projparams
+grbs.close()
+
+# create a map projection for the domain, plot 1st image on it.
+m =\
+Basemap(projection=projd['proj'],lat_ts=projd['lat_ts'],lon_0=projd['lon_0'],\
+        lat_0=projd['lat_0'],rsphere=(projd['a'],projd['b']),\
+        llcrnrlat=lats[0,0],urcrnrlat=lats[-1,-1],\
+        llcrnrlon=lons[0,0],urcrnrlon=lons[-1,-1],resolution='i')
+fig = plt.figure(figsize=(8,7))
+m.drawcoastlines()
+m.drawcountries()
+grb = btemps[0]
+im = m.imshow(grb['values'],interpolation='nearest',vmin=230,vmax=310)
+plt.colorbar(orientation='horizontal')
+m.drawparallels(np.arange(-80,10,10),labels=[1,0,0,0])
+m.drawmeridians(np.arange(-80,81,20),labels=[0,0,0,1])
+txt = plt.title(grb,fontsize=8)
+
+def updatefig(nt):
+    global im,txt,btemps,cnt,delay
+    grb = btemps[nt]
+    im.set_data(grb['values'])
+    txt.set_text(repr(grb))
+
+ani = animation.FuncAnimation(fig, updatefig, frames=len(btemps))
+
+plt.show()
diff --git a/test/set_bitmap.py b/test/set_bitmap.py
new file mode 100644
index 0000000..9f44ce8
--- /dev/null
+++ b/test/set_bitmap.py
@@ -0,0 +1,34 @@
+import pygrib
+
+grib1 = False
+if grib1:
+    infile = '../sampledata/regular_latlon_surface.grib1'
+else:
+    infile = '../sampledata/regular_latlon_surface.grib2'
+outfile = 'out.grib'
+grbs = pygrib.open(infile)
+grb = grbs.readline()
+data = grb['values']
+grb['missingValue']=9999.
+grb['bitmapPresent']=1
+nx = grb['Ni']; ny = grb['Nj']
+data[3*ny/8:5*ny/8,3*nx/8:5*nx/8]=grb['missingValue']
+grb['values']=data
+msg = grb.tostring()
+grbs.close()
+f = open(outfile,'wb')
+f.write(msg)
+f.close()
+ 
+grbs = pygrib.open('out.grib')
+grb = grbs.readline()
+data = grb['values']
+lats,lons = grb.latlons()
+grbs.close()
+# should be a hole in the middle of the plot
+from mpl_toolkits.basemap import Basemap
+import matplotlib.pyplot as plt
+m = Basemap(llcrnrlon=lons.min(),urcrnrlon=lons.max(),llcrnrlat=lats.min(),urcrnrlat=lats.max(),projection='cyl')
+m.drawcoastlines()
+m.contourf(lons,lats,data,15)
+plt.show()
diff --git a/test/test_Grib2Encode.py b/test/test_Grib2Encode.py
new file mode 100644
index 0000000..b4f0f88
--- /dev/null
+++ b/test/test_Grib2Encode.py
@@ -0,0 +1,56 @@
+from __future__ import print_function
+import pygrib
+import numpy as np
+from numpy import ma
+from ncepgrib2 import Grib2Decode, Grib2Encode
+from mpl_toolkits.basemap import Basemap
+import matplotlib.pyplot as plt
+
+# read soil moisture grib record with GRIB API.
+grbs = pygrib.open('../sampledata/gfs.t12z.pgrbf120.2p5deg.grib2')
+grbmsg = grbs[208] # soil moisture
+data = grbmsg.values
+print(data.min(), data.max())
+
+# convert grib message to a ncepgrib2.Grib2Message instance.
+grb = Grib2Decode(grbmsg.tostring(), gribmsg=True)
+
+# re-write the grib message to a new file.
+f=open('test_masked.grb','wb')
+grbo = Grib2Encode(grb.discipline_code,grb.identification_section)
+grbo.addgrid(grb.grid_definition_info,grb.grid_definition_template)
+# add product definition template, data representation template
+# and data (including bitmap which is read from data mask).
+grbo.addfield(grb.product_definition_template_number,grb.product_definition_template,grb.data_representation_template_number,grb.data_representation_template,data)
+# finalize the grib message.
+grbo.end()
+# write it to the file.
+f.write(grbo.msg)
+# close the output file
+f.close()
+
+# read and plot the data in the new file.
+# ..with pygrib
+#grbs = pygrib.open('test_masked.grb')
+#grb = grbs.readline()
+# ..with ncepgrib2
+grb = Grib2Decode('test_masked.grb')
+lats,lons = grb.latlons()
+data = grb.values
+print(data.min(), data.max())
+m = Basemap(lon_0=180,projection='kav7')
+x, y = m(lons, lats)
+CS = m.contourf(x,y,data,15,cmap=plt.cm.jet)
+m.drawmapboundary(fill_color='w')
+m.colorbar()
+m.drawcoastlines()
+# draw parallels
+delat = 30.
+circles = np.arange(-90.,90.+delat,delat)
+m.drawparallels(circles,labels=[1,0,0,0])
+# draw meridians
+delon = 60.
+meridians = np.arange(0,360,delon)
+m.drawmeridians(meridians,labels=[0,0,0,1])
+plt.title('soil moisture')
+plt.show()
diff --git a/test/test_ectigge.py b/test/test_ectigge.py
new file mode 100644
index 0000000..52ab771
--- /dev/null
+++ b/test/test_ectigge.py
@@ -0,0 +1,31 @@
+import pygrib
+import matplotlib.pyplot as plt
+import numpy as np
+from numpy import ma
+from mpl_toolkits.basemap import Basemap
+
+
+grbs = pygrib.open('../sampledata/ecmwf_tigge.grb')
+grb = grbs.select(parameterName='Soil moisture')[0]
+fld = grb.values; lats,lons = grb.latlons()
+
+#from ncepgrib2 import Grib2Decode
+#grbs = Grib2Decode('../sampledata/ecmwf_tigge.grb')
+#grbx = grbs[14]
+#fld = grbx.data()
+#lats,lons = grbx.grid()
+
+m = Basemap(lon_0=180)
+CS = m.contourf(lons,lats,fld,15,cmap=plt.cm.jet)
+plt.colorbar(shrink=0.6)
+m.drawcoastlines()
+# draw parallels
+delat = 30.
+circles = np.arange(-90.,90.+delat,delat)
+m.drawparallels(circles,labels=[1,0,0,0])
+# draw meridians
+delon = 60.
+meridians = np.arange(0,360,delon)
+m.drawmeridians(meridians,labels=[0,0,0,1])
+plt.title(grb['parameterName']+' on ECMWF Reduced Gaussian Grid')
+plt.show()
diff --git a/test/test_eumetsat.py b/test/test_eumetsat.py
new file mode 100644
index 0000000..b12be10
--- /dev/null
+++ b/test/test_eumetsat.py
@@ -0,0 +1,61 @@
+import pygrib
+import numpy as np
+import matplotlib.pyplot as plt
+from mpl_toolkits.basemap import Basemap
+
+grbs = pygrib.open('../sampledata/eumetsat_precip.grb')
+grb = grbs.readline()
+fld = grb['values']
+lats, lons = grb.latlons()
+rsphere = (grb.projparams['a'], grb.projparams['b'])
+lon_0 = grb.projparams['lon_0']
+h = grb.projparams['h']
+projection = grb.projparams['proj']
+
+plt.figure()
+m = Basemap(lon_0=lon_0,satellite_height=h,\
+            rsphere = rsphere,\
+            resolution='l',area_thresh=10000.,projection='geos')
+# plot every 50th point.
+x, y = m(lons,lats)
+m.scatter(x[::50,::50].flat,y[::50,::50].flat,1,marker='o',color='k',zorder=10)
+m.drawcoastlines()
+m.drawcountries()
+m.drawcoastlines()
+# contour data.
+m.contourf(x,y,fld,30)
+# pcolor image (slower)
+#m.pcolor(x,y,fld)
+m.drawparallels(np.arange(-80,81,20))
+m.drawmeridians(np.arange(-90,90,20))
+m.drawmapboundary()
+plt.title('EUMETSAT geostationary projection grid 1')
+
+grb = grbs.readline()
+fld = grb['values']
+lats, lons = grb.latlons()
+rsphere = (grb.projparams['a'], grb.projparams['b'])
+lon_0 = grb.projparams['lon_0']
+h = grb.projparams['h']
+grbs.close()
+
+plt.figure()
+m = Basemap(lon_0=lon_0,satellite_height=h,\
+            rsphere = rsphere,\
+            resolution='l',area_thresh=10000.,projection='geos')
+# plot every 30th point.
+x, y = m(lons,lats)
+m.scatter(x[::30,::30].flat,y[::30,::30].flat,1,marker='o',color='k',zorder=10)
+m.drawcoastlines()
+m.drawcountries()
+m.drawcoastlines()
+# contour data.
+m.contourf(x,y,fld,30)
+# pcolor image (slower)
+#m.pcolor(x,y,fld)
+m.drawparallels(np.arange(-80,81,20))
+m.drawmeridians(np.arange(-90,90,20))
+m.drawmapboundary()
+plt.title('EUMETSAT geostationary projection grid 2')
+
+plt.show()
diff --git a/test/test_gaussian.py b/test/test_gaussian.py
new file mode 100644
index 0000000..19c3b4e
--- /dev/null
+++ b/test/test_gaussian.py
@@ -0,0 +1,15 @@
+import pygrib
+import matplotlib.pyplot as plt
+from mpl_toolkits.basemap import Basemap
+grbs = pygrib.open('../sampledata/flux.grb')
+grb = grbs.message(2)
+lats, lons = grb.latlons()
+data = grb['values']
+m = Basemap(lon_0=180)
+#m.scatter(lons.flat,lats.flat,1,marker='o',color='k',zorder=10)
+x,y = m(lons,lats)
+m.drawcoastlines()
+m.contourf(x,y,data,15)
+#m.fillcontinents()
+plt.title('Global Gaussian Grid')
+plt.show()
diff --git a/test/test_lambert.py b/test/test_lambert.py
new file mode 100644
index 0000000..d860435
--- /dev/null
+++ b/test/test_lambert.py
@@ -0,0 +1,26 @@
+import pygrib
+import matplotlib.pyplot as plt
+from mpl_toolkits.basemap import Basemap
+grbs = pygrib.open('../sampledata/eta.grb')
+grb = grbs.select(parameterName='Pressure',typeOfLevel='surface')[0]
+data = grb.values
+lats, lons = grb.latlons()
+llcrnrlon = lons[0,0]
+llcrnrlat = lats[0,0]
+urcrnrlon = lons[-1,-1]
+urcrnrlat = lats[-1,-1]
+rsphere = (grb.projparams['a'], grb.projparams['b'])
+lon_0 = grb.projparams['lon_0']
+lat_1 = grb.projparams['lat_1']
+lat_2 = grb.projparams['lat_2']
+projection = grb.projparams['proj']
+m = Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,
+            urcrnrlon=urcrnrlon,urcrnrlat=urcrnrlat,rsphere=rsphere,lon_0=lon_0,
+            lat_1=lat_1,lat_2=lat_2,resolution='l',projection=projection)
+x,y = m(lons, lats)
+m.scatter(x.flat,y.flat,3,marker='o',color='k',zorder=10)
+m.drawcoastlines()
+x,y = m(lons,lats)
+m.contourf(x,y,data,15)
+plt.title('Lambert Conformal Model Grid')
+plt.show()
diff --git a/test/test_ndfd_conus.py b/test/test_ndfd_conus.py
new file mode 100644
index 0000000..b47f81c
--- /dev/null
+++ b/test/test_ndfd_conus.py
@@ -0,0 +1,36 @@
+import pygrib, sys
+import matplotlib.pyplot as plt
+from mpl_toolkits.basemap import Basemap
+grbs = pygrib.open('../sampledata/ds.maxt.bin')
+g = grbs.message(1)
+lats, lons = g.latlons()
+data = g.values
+#from ncepgrib2 import Grib2Decode
+#grbx = Grib2Decode(g.tostring(),gribmsg=True)
+#data = grbx.data()
+llcrnrlon = lons[0,0]
+llcrnrlat = lats[0,0]
+urcrnrlon = lons[-1,-1]
+urcrnrlat = lats[-1,-1]
+rsphere = (g.projparams['a'],g.projparams['b'])
+lat_1 = g.projparams['lat_1']
+lat_2 = g.projparams['lat_2']
+lon_0 = g.projparams['lon_0']
+projection = g.projparams['proj']
+fig=plt.figure()
+sys.stdout.write(repr(g.projparams)+'\n')
+ax = fig.add_axes([0.1,0.1,0.75,0.75])
+m = Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,
+            urcrnrlon=urcrnrlon,urcrnrlat=urcrnrlat,rsphere=rsphere,lon_0=lon_0,
+            lat_1=lat_1,lat_2=lat_2,resolution='l',projection=projection,area_thresh=10000)
+x,y = m(lons, lats)
+cs = m.contourf(x,y,data,20,cmap=plt.cm.jet)
+m.drawcoastlines()
+m.drawstates()
+m.drawcountries()
+# new axis for colorbar.
+cax = plt.axes([0.875, 0.15, 0.03, 0.65])
+plt.colorbar(cs, cax, format='%g') # draw colorbar
+plt.axes(ax)  # make the original axes current again
+plt.title('NDFD Temp CONUS %d-h forecast'% g['forecastTime'],fontsize=12)
+plt.show()
diff --git a/test/test_ndfd_pr.py b/test/test_ndfd_pr.py
new file mode 100644
index 0000000..39c1236
--- /dev/null
+++ b/test/test_ndfd_pr.py
@@ -0,0 +1,35 @@
+import pygrib
+import numpy as np
+import matplotlib.pyplot as plt
+from mpl_toolkits.basemap import Basemap
+grbs = pygrib.open('../sampledata/dspr.temp.bin')
+grb = grbs.select(forecastTime=26)[0]
+data = grb['values']
+lats, lons = grb.latlons()
+llcrnrlon = lons[0,0]
+llcrnrlat = lats[0,0]
+urcrnrlon = lons[-1,-1]
+urcrnrlat = lats[-1,-1]
+rsphere = (grb.projparams['a'], grb.projparams['b'])
+lat_ts = grb.projparams['lat_ts']
+lon_0 = grb.projparams['lon_0']
+projection = grb.projparams['proj']
+fig=plt.figure()
+ax = fig.add_axes([0.1,0.1,0.75,0.75])
+m = Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,
+            urcrnrlon=urcrnrlon,urcrnrlat=urcrnrlat,rsphere=rsphere,lon_0=lon_0,
+            lat_ts=lat_ts,resolution='h',projection=projection)
+x,y = m(lons, lats)
+cs = m.contourf(x,y,data,20,cmap=plt.cm.jet)
+m.drawcoastlines()
+m.drawstates()
+m.drawcountries()
+m.drawmeridians(np.arange(280,300,1),labels=[0,0,0,1])
+m.drawparallels(np.arange(16,21,1),labels=[1,0,0,0])
+# new axis for colorbar.
+cax = plt.axes([0.875, 0.10, 0.03, 0.75])
+plt.colorbar(cs, cax, format='%g') # draw colorbar
+plt.axes(ax)  # make the original axes current again
+plt.title('NDFD Temp Puerto Rico %d-h fcst from %d' %\
+        (grb['forecastTime'],grb['dataDate']),fontsize=12)
+plt.show()
diff --git a/test/test_reduced_ll.py b/test/test_reduced_ll.py
new file mode 100644
index 0000000..5fd4ef6
--- /dev/null
+++ b/test/test_reduced_ll.py
@@ -0,0 +1,14 @@
+import pygrib
+import numpy as np
+import matplotlib.pyplot as plt
+from mpl_toolkits.basemap import Basemap
+grbs = pygrib.open('../sampledata/reduced_latlon_surface.grib2')
+grb = grbs.readline()
+data = grb['values']
+lats, lons = grb.latlons()
+m = Basemap(lon_0=180)
+x,y = m(lons,lats)
+m.drawcoastlines()
+m.contourf(x,y,data,15)
+plt.title(grb['name'])
+plt.show()
diff --git a/test/test_reglatlon.py b/test/test_reglatlon.py
new file mode 100644
index 0000000..b19b2ed
--- /dev/null
+++ b/test/test_reglatlon.py
@@ -0,0 +1,30 @@
+import pygrib
+import matplotlib.pyplot as plt
+from mpl_toolkits.basemap import Basemap
+
+grbs = pygrib.open('../sampledata/gfs.grb')
+grb = grbs.select(name='Orography')[0]
+grb2 = grbs.select(name='Volumetric soil moisture content')[0]
+
+data = grb.values; lats,lons = grb.latlons()
+data2 = grb2.values
+
+m = Basemap(llcrnrlon=lons.min(),llcrnrlat=lats.min(),urcrnrlon=lons.max(),urcrnrlat=lats.max(),projection='cyl')
+m.drawcoastlines()
+m.contourf(lons,lats,data,15,cmap=plt.cm.hot_r)
+plt.title('%s Global Lat/Lon Grid' % grb.name)
+fig = plt.figure()
+m.drawcoastlines()
+m.contourf(lons,lats,data2,15,cmap=plt.cm.spectral)
+plt.title('%s Global Lat/Lon Grid' % grb2.name)
+
+lat1=15; lat2=65; lon1=220; lon2=320
+datsubset,latsubset,lonsubset=grb.data(lat1=lat1,lat2=lat2,lon1=lon1,lon2=lon2)
+
+fig = plt.figure()
+m = Basemap(llcrnrlon=lon1,llcrnrlat=lat1,urcrnrlon=lon2,urcrnrlat=lat2,projection='cyl',resolution='l')
+m.drawcoastlines()
+m.contourf(lonsubset,latsubset,datsubset,15,cmap=plt.cm.hot_r)
+plt.title('%s Regional Lat/Lon Grid' % grb.name)
+
+plt.show()
diff --git a/test/test_rotated_ll.py b/test/test_rotated_ll.py
new file mode 100644
index 0000000..4f470b6
--- /dev/null
+++ b/test/test_rotated_ll.py
@@ -0,0 +1,19 @@
+import pygrib
+import numpy as np
+import matplotlib.pyplot as plt
+from mpl_toolkits.basemap import Basemap
+import sys
+grbs = pygrib.open('../sampledata/cl00010000_ecoclimap_rot.grib1')
+grb = grbs.message(7)
+lats, lons = grb.latlons()
+sys.stdout.write(repr(grb.projparams)+'\n')
+data = grb['values']
+m = Basemap(projection='stere',lon_0=10,lat_0=55,width=5000.e3,height=5000.e3,resolution='l')
+x,y = m(lons,lats)
+m.drawcoastlines()
+m.contourf(x,y,data,15)
+m.scatter(x[::5,::5].flat,y[::5,::5].flat,1,marker='o',color='k',zorder=10)
+m.drawmeridians(np.arange(-60,61,5))
+m.drawparallels(np.arange(20,80,5))
+plt.title(grb['name'])
+plt.show()
diff --git a/test/test_spectral.py b/test/test_spectral.py
new file mode 100644
index 0000000..d2f89e8
--- /dev/null
+++ b/test/test_spectral.py
@@ -0,0 +1,54 @@
+from mpl_toolkits.basemap import Basemap
+import matplotlib.pyplot as plt
+import pygrib
+import numpy as np
+try:
+    import spharm
+except:
+    raise ImportError("requires pyspharm (python spherical harmonic module) from http://code.google.com/p/pyspharm")
+
+grbs = pygrib.open('../sampledata/spherical_pressure_level.grib1')
+g = grbs[1]
+fld = g.values
+
+# ECMWF normalizes the spherical harmonic coeffs differently than NCEP.
+# (m=0,n=0 is global mean, instead of sqrt(2)/2 times global mean)
+fld = 2.*fld/np.sqrt(2.)
+fldr = fld[0::2]
+fldi = fld[1::2]
+fld = np.zeros(fldr.shape,'F')
+fld.real = fldr
+fld.imag = fldi
+nlons = 360;  nlats = 181
+s = spharm.Spharmt(nlons,nlats)
+data = s.spectogrd(fld)
+lons = (360./nlons)*np.arange(nlons)
+lats = 90.-(180./(nlats-1))*np.arange(nlats)
+lons, lats = np.meshgrid(lons, lats)
+# stack grids side-by-side (in longitiudinal direction), so
+# any range of longitudes (between -360 and 360) may be plotted on a world map.
+lons = np.concatenate((lons-360,lons),1)
+lats = np.concatenate((lats,lats),1)
+data = np.concatenate((data,data),1)
+# setup miller cylindrical map projection.
+m = Basemap(llcrnrlon=-180.,llcrnrlat=-90,urcrnrlon=180.,urcrnrlat=90.,\
+            resolution='l',area_thresh=10000.,projection='mill')
+x, y = m(lons,lats)
+CS = m.contourf(x,y,data,15,cmap=plt.cm.jet)
+ax = plt.gca()
+pos = ax.get_position()
+l, b, w, h = pos.bounds
+cax = plt.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes
+plt.colorbar(drawedges=True, cax=cax) # draw colorbar
+plt.axes(ax)  # make the original axes current again
+m.drawcoastlines()
+# draw parallels
+delat = 30.
+circles = np.arange(-90.,90.+delat,delat)
+m.drawparallels(circles,labels=[1,0,0,0])
+# draw meridians
+delon = 60.
+meridians = np.arange(-180,180,delon)
+m.drawmeridians(meridians,labels=[0,0,0,1])
+plt.title(repr(g['level'])+' '+g['typeOfLevel']+' '+g['name']+' from Spherical Harmonic Coeffs')
+plt.show()
diff --git a/test/test_stere.py b/test/test_stere.py
new file mode 100644
index 0000000..0a927eb
--- /dev/null
+++ b/test/test_stere.py
@@ -0,0 +1,47 @@
+import pygrib
+import matplotlib.pyplot as plt
+from mpl_toolkits.basemap import Basemap
+grbs = pygrib.open('../sampledata/ngm.grb')
+grb = grbs.select(parameterName='Pressure',typeOfLevel='surface')[0]
+data = grb.values; lats,lons = grb.latlons()
+llcrnrlon = lons[0,0]
+llcrnrlat = lats[0,0]
+urcrnrlon = lons[-1,-1]
+urcrnrlat = lats[-1,-1]
+rsphere = (grb.projparams['a'], grb.projparams['b'])
+lat_ts = grb.projparams['lat_ts']
+lon_0 = grb.projparams['lon_0']
+lat_0 = grb.projparams['lat_0']
+projection = grb.projparams['proj']
+m = Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,
+            urcrnrlon=urcrnrlon,urcrnrlat=urcrnrlat,rsphere=rsphere,lon_0=lon_0,
+            lat_ts=lat_ts,lat_0=lat_0,resolution='l',projection=projection)
+x,y = m(lons, lats)
+m.scatter(x.flat,y.flat,3,marker='o',color='k',zorder=10)
+m.drawcoastlines()
+m.contourf(x,y,data,15)
+plt.title('Stereographic Model Grid (NCEP)')
+
+plt.figure()
+grbs = pygrib.open('../sampledata/CMC_reg_WIND_ISBL_300_ps60km_2010052400_P012.grib')
+# this file has key "projectionCenterFlag"
+grb = grbs.readline()
+data = grb['values']
+lats,lons = grb.latlons()
+llcrnrlon = lons[0,0]
+llcrnrlat = lats[0,0]
+urcrnrlon = lons[-1,-1]
+urcrnrlat = lats[-1,-1]
+rsphere = (grb.projparams['a'], grb.projparams['b'])
+lat_ts = grb.projparams['lat_ts']
+lon_0 = grb.projparams['lon_0']
+lat_0 = grb.projparams['lat_0']
+projection = grb.projparams['proj']
+m = Basemap(llcrnrlon=llcrnrlon,llcrnrlat=llcrnrlat,
+            urcrnrlon=urcrnrlon,urcrnrlat=urcrnrlat,rsphere=rsphere,lon_0=lon_0,
+            lat_ts=lat_ts,lat_0=lat_0,resolution='l',projection=projection)
+m.drawcoastlines()
+x,y = m(lons,lats)
+m.contourf(x,y,data,15)
+plt.title('Stereographic Model Grid (CMC)')
+plt.show()
diff --git a/test/test_tigge.py b/test/test_tigge.py
new file mode 100644
index 0000000..b2c0e6a
--- /dev/null
+++ b/test/test_tigge.py
@@ -0,0 +1,25 @@
+import numpy as np
+from mpl_toolkits.basemap import Basemap
+from numpy import ma
+import pygrib, sys
+import matplotlib.pyplot as plt
+
+for grb in pygrib.open('../sampledata/tigge.grb'):
+    fld = 0.01*grb['values'] # convert to hPa
+    lats,lons = grb.latlons()
+    sys.stdout.write('%s %s %s %s' % \
+            (grb['centre'], fld.shape, fld.min(), fld.max()))
+    fig=plt.figure(figsize=(10,5))
+    fig.add_axes([0.1,0.1,0.8,0.8])
+    # setup robinson world map projection.
+    m = Basemap(projection='robin',lon_0=180)
+    x, y = m(lons,lats)
+    levels = np.arange(475,1101,25)
+    CS = m.contourf(x,y,fld,levels,cmap=plt.cm.jet)
+    plt.colorbar(drawedges=True, shrink=0.8) # draw colorbar
+    m.drawcoastlines()
+    m.drawparallels(np.arange(-80,81,20),labels=[1,0,0,0])
+    m.drawmeridians(np.arange(0,360,60),labels=[0,0,0,1])
+    m.drawmapboundary()
+    plt.title(grb['name']+': '+grb['centre'].upper(),fontsize=12)
+plt.show()
diff --git a/test/test_tpcprblty.py b/test/test_tpcprblty.py
new file mode 100644
index 0000000..c726273
--- /dev/null
+++ b/test/test_tpcprblty.py
@@ -0,0 +1,24 @@
+import pygrib, sys
+import matplotlib.pyplot as plt
+from mpl_toolkits.basemap import Basemap,cm
+import numpy as np
+grbs = pygrib.open('../sampledata/tpcprblty.grib2')
+grb=grbs.select(parameterName='Wind speed',scaledValueOfUpperLimit=17491,stepRange='0-120')[0]
+sys.stdout.write(repr(grb)+'\n')
+lats, lons = grb.latlons()
+data = grb.values
+map =\
+Basemap(projection='lcc',lon_0=-90,lat_0=30,width=4000.e3,height=2000.e3,resolution='l')
+map.bluemarble()
+map.drawcoastlines(color='yellow')
+x,y = map(lons,lats)
+levels = np.arange(10,101,10)
+map.contourf(x,y,data,levels,cmap=cm.GMT_haxby_r)
+upperlim = float(grb.scaledValueOfUpperLimit)/np.power(10,grb.scaleFactorOfUpperLimit)
+plt.title('TC Wind Speed Prob > %5.2f m/s fcst hrs %s from %s' %\
+        (upperlim,grb.stepRange,repr(grb.dataDate)+repr(grb.dataTime)[0:2]),fontsize=12)
+map.drawparallels(np.arange(0,41,5),labels=[1,0,0,0],color='0.8')
+map.drawmeridians(np.arange(180,360,10),labels=[0,0,0,1],color='0.8')
+cb = plt.colorbar(orientation='horizontal')
+cb.ax.set_xlabel('percent')
+plt.show()
diff --git a/utils/cnvgrib1to2 b/utils/cnvgrib1to2
new file mode 100644
index 0000000..4368c21
--- /dev/null
+++ b/utils/cnvgrib1to2
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+import pygrib, sys
+
+if len(sys.argv) < 3:
+    sys.stdout.write("""
+cnvgrib1to2 <grib1 filename> <grib2 filename> <packing scheme>
+<packing_scheme> is optional - can be 'grid_simple', 'grid_complex',
+'grid_complex_spatial_differencing', 'grid_jpeg', or 'grid_png'. 
+Default is 'grid_jpeg'\n\n""")
+    raise SystemExit
+   
+grbs = pygrib.open(sys.argv[1])
+f = open(sys.argv[2],'wb')
+
+if len(sys.argv) > 3:
+   grb2packing = sys.argv[3]
+else:
+   grb2packing = 'grid_jpeg' # default is jpeg2000 
+
+sys.stdout.write('converting %s from grib1 to grib2 (%s) with %s packing ...\n' % (sys.argv[1],sys.argv[2],grb2packing))
+
+nmsg = 0
+for grb in grbs:
+    try:
+        grb.editionNumber=2 
+        grb.packingType = grb2packing
+        nmsg = nmsg + 1
+    except:
+        sys.stdout.write('cannot convert message %s\n' % grb.messagenumber)
+        continue
+    f.write(grb.tostring())
+
+sys.stdout.write('%s messges out of %s converted\n' % (nmsg,grbs.messages))
+grbs.close()
+f.close()
diff --git a/utils/cnvgrib2to1 b/utils/cnvgrib2to1
new file mode 100644
index 0000000..1ca6d5b
--- /dev/null
+++ b/utils/cnvgrib2to1
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+import pygrib, sys
+
+if len(sys.argv) < 3:
+    sys.stdout.write("""
+cnvgrib2to1 <grib2 filename> <grib1 filename>\n\n""")
+    raise SystemExit
+   
+grbs = pygrib.open(sys.argv[1])
+f = open(sys.argv[2],'wb')
+
+sys.stdout.write('converting %s from grib2 to grib1 (%s) ...\n' % (sys.argv[1],sys.argv[2]))
+
+nmsg = 0
+for grb in grbs:
+    try:
+        grb.editionNumber=1 
+        nmsg = nmsg + 1
+    except:
+        sys.stdout.write('cannot convert message %s\n' % grb.messagenumber)
+        continue
+    f.write(grb.tostring())
+
+sys.stdout.write('%s messages out of %s converted\n' % (nmsg,grbs.messages))
+grbs.close()
+f.close()
diff --git a/utils/grib_list b/utils/grib_list
new file mode 100755
index 0000000..fa901da
--- /dev/null
+++ b/utils/grib_list
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+import pygrib, sys
+pygrib.tolerate_badgrib_on()
+if len(sys.argv) < 2:
+    sys.stdout.write("'grib_list <grib_filename>' to get long listing\n")
+    sys.stdout.write("'grib_list <grib_filename> -s' to get short listing\n")
+    sys.stdout.write("'grib_list <grib_filename> -m' to get short listing plus data min/max\n")
+    sys.exit(1)
+fname = sys.argv[1]
+short = False
+medium = False
+if len(sys.argv) > 2:
+    if sys.argv[2] == '-s': short=True
+    if sys.argv[2] == '-m': medium=True
+grbs = pygrib.open(fname)
+if short:
+    for grb in grbs:
+        sys.stdout.write(repr(grb)+'\n')
+elif medium:
+    for grb in grbs:
+        try:
+            grb.expand_grid(False); data = grb.values
+            sys.stdout.write(repr(grb)+':min/max=%g/%g'%(data.min(), data.max())+'\n')
+        except:
+            sys.stdout.write(repr(grb)+':min/max=NO DATA'+'\n')
+else:
+    for grb in grbs:
+        sys.stdout.write('------message %d------\n' % grb.messagenumber)
+        for k in grb.keys():
+            if k.startswith('mars'): continue
+            if k in ['values','codedValues','packedValues','unpackedValues']: continue
+            if grb.is_missing(k):
+                sys.stdout.write('%s = MISSING\n' % k)
+            else:
+                try:
+                    v = grb[k]
+                    sys.stdout.write('%s = %s\n'%(k,v))
+                except:
+                    sys.stdout.write('%s = NOT FOUND\n'%k)
+sys.stdout.write('packing = %s\n' % grb.packingType)
+grbs.close()
diff --git a/utils/grib_repack b/utils/grib_repack
new file mode 100644
index 0000000..2322a5c
--- /dev/null
+++ b/utils/grib_repack
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+"""
+ command line program to change packing scheme in a grib2 file
+
+ 'grib_repack -h' for help.
+"""
+from optparse import OptionParser
+import sys
+import pygrib
+
+usage = """
+ %prog [options] grib2filein grib2fileout
+
+ repack the data in grib2filein with a different packing scheme
+
+ example:
+
+'%prog -p3 grib2filein grib2fileout' converts grib2filein to complex packing with spatial differencing, saves result to grib2fileout."""
+
+parser = OptionParser(usage=usage)
+parser.add_option("-p", default=False, action="store",dest="ipack",
+                        help="desired packing scheme - 0 for simple packing, 1 for simple matrix packing, 2 for complex packing, 3 for complex packing with spatial differencing, 4 for no packing (ieee), 40 for JPEG2000 packing, 41 for PNG packing, 61 for simple log pre-processing")
+
+(options, args) = parser.parse_args()
+
+if not options.ipack:
+    sys.stdout.write('must specify a packing scheme with -p\n')
+    sys.exit(1)
+
+ipack = int(options.ipack)
+if ipack not in [0,1,2,3,4,40,41,61]:
+    raise ValueError('packing scheme must be one of 0,1,2,3,4,40,41,61')
+
+# open grib file
+try:
+    filein = args[0]
+    fileout = args[1]
+except:
+    sys.stdout.write('need to specify input and output grib2 filenames\n')
+    sys.exit(1)
+sys.stdout.write('input grib file: %s\n' % filein)
+grbs = pygrib.open(filein)
+
+# open the file for output.
+sys.stdout.write('output grib file: %s\n' % fileout)
+f=open(fileout,'wb')
+
+#  "grid_simple"                       = { dataRepresentationTemplateNumber = 0;     }
+#  "spectral_complex"                  = { dataRepresentationTemplateNumber = 51; spectralType=1; spectralMode=1; }
+#  "spectral_simple"                   = { dataRepresentationTemplateNumber = 50; spectralType=1; spectralMode=1; }
+#  "grid_simple_matrix"                = { dataRepresentationTemplateNumber = 1;     }
+#  "grid_complex"                      = { dataRepresentationTemplateNumber = 2;     }
+#  "grid_complex_spatial_differencing" = { dataRepresentationTemplateNumber = 3;     }
+#  "grid_jpeg"                         = { dataRepresentationTemplateNumber = 40000; }
+#  "grid_jpeg"                         = { dataRepresentationTemplateNumber = 40;    }
+#  "grid_png"                          = { dataRepresentationTemplateNumber = 40010; }
+#  "grid_png"                          = { dataRepresentationTemplateNumber = 41;    }
+#  "grid_ieee"                         = { dataRepresentationTemplateNumber = 4;     }
+#  "grid_simple_log_preprocessing"     = { dataRepresentationTemplateNumber = 61;    }
+#  "grid_second_order"                 = { dataRepresentationTemplateNumber = 0;     }
+#  "grid_second_order_different_width" = { dataRepresentationTemplateNumber = 0;  }
+
+for grb in grbs:
+    if grb['editionNumber'] != 2:
+        sys.stdout.write('not a GRIB2 message, skipping ..\n')
+        continue
+    if grb['dataRepresentationTemplateNumber'] == ipack:
+	sys.stdout.write('no repacking required, skipping ..\n')
+    grb['dataRepresentationTemplateNumber'] = ipack
+    msg = grb.tostring()
+    f.write(msg)
+
+f.close()
+grbs.close()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pygrib.git



More information about the debian-science-commits mailing list