This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

PythonicGrib is a Python wrapper for the ECMWF’s GRIB API which allows interaction with GRIB messagese in a pythonic way and allows the user to be sure their code is free of memory leaks by transfering bookkeeping tasks to a context manager.

Working with GRIB files in a context manager like this:

>>> with GribFile(filename) as grib:
...     # Print number of messages in file
...     len(grib)
...     # Open all messages in file
...     for i in range(len(grib)):
...         msg = GribMessage(grib)
...         print(msg["shortName"])
...     len(grib.open_messages)
>>> # When the file is closed, any open messages are closed
>>> len(grib.open_messages)

Treat messages as a key-value pair:

>>> with GribFile(filename) as grib:
...     # Access shortNames of all messages
...     for i in range(len(grib)):
...         msg = GribMessage(grib)
...         print(msg["shortName"])
...     # Report number of keys in message
...     len(msg)
...     # Report message size in bytes
...     msg.size
...     # Report keys in message
...     msg.keys()
...     # Check if value is missing
...     msg.missing("scaleFactorOfSecondFixedSurface")
...     # Set scalar value
...     msg["scaleFactorOfSecondFixedSurface"] = 5
...     # Check key's value
...     msg["scaleFactorOfSecondFixedSurface"]
...     # Set value to missing
...     msg.set_missing("scaleFactorOfSecondFixedSurface")
...     # Missing values raise exception when read with dict notation
...     msg["scaleFactorOfSecondFixedSurface"]
...     # Array values are set transparently
...     msg["values"] = [1, 2, 3]
...     # Messages can be written to file
...     with open(testfile, "w") as test:
...         msg.write(test)
...     # Messages can be cloned from other messages
...     msg2 = GribMessage(clone=msg)
...     # If desired, messages can be closed manually or used in with
...     msg.close()

Let indexes worry about taking care of themselves:

>>> # Create index from file with keys
>>> with GribIndex(filename, keys) as idx:
...     # Write index to file
...     idx.write(index_file)
>>> # Read index from file
>>> with GribIndex(file_index=index_file) as idx:
...     # Add new file to index
...     idx.add(other_filename)
...     # Report number of unique values for given key
...     idx.size(key)
...     # Report unique values indexed by key
...     idx.values(key)
...     # Request GribMessage matching key, value
...     msg = idx.select({key: value})
... # No messages are left open after index closes
... idx.open_messages

Install from PyPI with:

pip install PythonicGRIB

Or manually from the sources with:

python setup.py install

Author: Daniel Lee

Release History

Release History

0.2.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
PythonicGRIB-0.2.0.tar.gz (6.1 kB) Copy SHA256 Checksum SHA256 Source Mar 7, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting