hgrib-0.3.0.0: Unofficial bindings for GRIB API

Copyright(c) Mattias Jakobsson 2015
LicenseGPL-3
Maintainermjakob422@gmail.com
Stabilityunstable
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.Grib

Contents

Description

 

Synopsis

The GRIB Monad

type GribIO = ReaderT GribEnv IO Source

The GribIO monad is a ReaderT monad transformer over the IO monad with a GribEnv environment.

runGribIO Source

Arguments

:: FilePath

a path to a GRIB file

-> GribIO a

an action to take on each GRIB message in the file

-> IO [a]

the results of the actions

Run an action on each GRIB message in a file and collect the results.

This operation may fail with:

runGribIO_ :: FilePath -> GribIO a -> IO () Source

Like runGribIO, but discard the results.

data GribEnv Source

The reader environment of GribIO containing the current filename, a GribHandle, and its index in the file.

Get values

These operations may fail with:

  • isGribException GribNotFound if the key is missing.

getDouble :: Key -> GribIO Double Source

Get the value for a key as a float.

getLong :: Key -> GribIO Int Source

Get the value for a key as an integer.

getString :: Key -> GribIO String Source

Get the value for a key as a string.

getValues :: GribIO [Double] Source

Get the data values of the GRIB message as floats.

Set values

These operations may fail with:

  • isGribException GribNotFound if the key is missing; or
  • isGribException GribReadOnly if the key is read-only.

setDouble :: Key -> Double -> GribIO () Source

Set the value of a key from a float.

setLong :: Key -> Int -> GribIO () Source

Set the value of a key from an integer.

setString :: Key -> String -> GribIO () Source

Set the value of a key from a string.

setValues :: [Double] -> GribIO () Source

Set the values of the GRIB message from floats.

Utilities

getFilename :: GribIO FilePath Source

Return the name of the file being read.

getIndex :: GribIO Int Source

Return the zero-based index of the current message in the file.

getHandle :: GribIO GribHandle Source

Return the current GribHandle for use with the Raw GRIB API bindings.

liftIO :: MonadIO m => forall a. IO a -> m a

Lift a computation from the IO monad.