Copyright | (c) Mattias Jakobsson 2015 |
---|---|
License | GPL-3 |
Maintainer | mjakob422@gmail.com |
Stability | unstable |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Iterate on latitude, longitude, values.
Most of the documentation herein was copied from the official documentation of grib_api.
- newtype GribIterator = GribIterator (Ptr GribIterator)
- gribIteratorNew :: GribHandle -> Int -> IO GribIterator
- gribIteratorNext :: GribIterator -> IO (Bool, Double, Double, Double)
- gribIteratorPrevious :: GribIterator -> IO (Bool, Double, Double, Double)
- gribIteratorHasNext :: GribIterator -> IO Bool
- gribIteratorReset :: GribIterator -> IO ()
- gribIteratorDelete :: GribIterator -> IO ()
- withGribIterator :: GribHandle -> Int -> (GribIterator -> IO a) -> IO a
The GRIB Iterator
newtype GribIterator Source
Grib iterator, structure supporting a geographic iteration of values on a grib message.
:: GribHandle | the handle from which the iterator will be created |
-> Int | flags for future use (ignored) |
-> IO GribIterator | an IO action that will return the new iterator |
Create a new iterator from a handle, using current geometry and values.
The returned iterator needs to be manually deleted with
gribIteratorDelete
. However, due to the reason given in that
function, withGribIterator
should be preferred over this
function.
gribIteratorNext :: GribIterator -> IO (Bool, Double, Double, Double) Source
Get the next value from an iterator.
This function returns a tuple (status, latitude, longitude,
value)
, where status
is True
if successful and False
if no
more data is available.
gribIteratorPrevious :: GribIterator -> IO (Bool, Double, Double, Double) Source
Like gribIteratorNext
, but return the previous value instead.
gribIteratorHasNext :: GribIterator -> IO Bool Source
Test procedure for values in an iterator.
gribIteratorReset :: GribIterator -> IO () Source
Reset the iterator.
gribIteratorDelete :: GribIterator -> IO () Source
Frees an iterator from memory.
If the GribHandle
used to create the iterator has been garbage
collected by the time this function is called, the behavior is
undefined. Because of this, withGribIterator
should be preferred
over directly using gribIteratorNew
and this function.
:: GribHandle | the handle from which the iterator will be created |
-> Int | flags for future use (ignored) |
-> (GribIterator -> IO a) | a function that will be called with the newly created iterator |
-> IO a | the result of the above function |
Safely create, use and delete a GribIterator
.
This function should be preferred over directly using
gribIteratorNew
and gribIteratorDelete
.