The hgrib package

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

Unofficial bindings to ECMWF's GRIB API library for reading WMO FM-92 GRIB edition 1 and edition 2 messages.


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.2.0.0, 0.3.0.0, 0.3.1.0, 0.3.1.0
Change logCHANGELOG.md
Dependenciesbase (>=4.5 && <4.9), hgrib, transformers (>=0.3 && <0.5) [details]
LicenseGPL-3
Copyright(c) 2015 Mattias Jakobsson
AuthorMattias Jakobsson
Maintainermjakob422@gmail.com
CategoryData
Home pagehttps://github.com/mjakob/hgrib
Bug trackerhttps://github.com/mjakob/hgrib/issues
Source repositoryhead: git clone https://github.com/mjakob/hgrib.git -b develop
this: git clone https://github.com/mjakob/hgrib.git(tag 0.3.1.0)
Executablesget
UploadedSat Nov 7 12:29:02 UTC 2015 by mjakob

Modules

[Index]

Flags

NameDescriptionDefaultType
build_examplesBuild GRIB API example programsDisabledManual

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for hgrib-0.3.1.0

HGrib

Build Status

Unofficial bindings for ECMWF's GRIB API library for reading and writing WMO FM-92 GRIB edition 1 and edition 2 messages.

In this version of HGrib, a read-only monadic Haskell interface to GRIB API is provided. Raw bindings for the documented parts of GRIB API are also available. Future versions are intended to expand the higher-level Haskell interface to include, among other things, write support.

Installation

The following prerequisites are needed to build HGrib:

With these requirements available, HGrib can be installed from Hackage with Cabal:

cabal install hgrib

Usage

HGrib provides a high-level monadic Haskell interface to GRIB API in Data.Grib. An example of its usage is GRIB API's get.c example re-written with HGrib:

import Control.Exception ( assert )
import Data.Grib
import Text.Printf       ( printf )

main :: IO ()
main = let filename = "test/stage/regular_latlon_surface.grib1" in
  runGribIO_ filename $ do
    setString "file" filename

    getLong "Ni" >>= liftIO . printf "numberOfPointsAlongAParallel=%d\n"
    getLong "Nj" >>= liftIO . printf "numberOfPointsAlongAMeridian=%d\n"

    getDouble "yFirst" >>=
      liftIO . printf "latitudeOfFirstGridPointInDegrees=%g\n"
    getDouble "xFirst" >>=
      liftIO . printf "longitudeOfFirstGridPointInDegrees=%g\n"
    getDouble "yLast"  >>=
      liftIO . printf "latitudeOfLastGridPointInDegrees=%g\n"
    getDouble "xLast"  >>=
      liftIO . printf "longitudeOfLastGridPointInDegrees=%g\n"
    getDouble "DyInDegrees" >>=
      liftIO . printf "jDirectionIncrementInDegrees=%g\n"
    getDouble "DxInDegrees" >>=
      liftIO . printf "iDirectionIncrementInDegrees=%g\n"

    getString "packingType" >>= liftIO . printf "packingType=%s\n"

    values <- getValues
    let numValues = length values
        average   = sum values / fromIntegral numValues
    liftIO $ printf "There are %d values, average is %g\n" numValues average

    filename' <- getString "file"
    liftIO $ assert (filename' == filename) (return ())

Raw bindings for the documented part of GRIB API is also available in Data.Grib.Raw. To be able to work with these bindings, bindings for C's fopen is provided in Data.Grib.Raw.CFile (which is re-exported by Data.Grib.Raw).

For more information, see HGrib's reference documentation generated by Haddock.

Contributing

Issues, feature and pull requests are most welcome! In particular, please give suggestions on what you would like to see in the higher-level interface and let me know if there is any undocumented part of GRIB API that you would like to have included.

Licenses

HGrib was created and is currently maintained by Mattias Jakobsson. It is released under the GNU General Public License v3.0. ECMWF's GRIB API is released under the Apache license. HGrib is in no way associated with ECMWF or the original library.