hnetcdf: Haskell NetCDF library

[ bsd3, data, library, program ] [ Propose Tags ]

Bindings to the Unidata NetCDF library, along with a higher-level Haskell interface that attempts to provide container polymorphic data access (initially just Storable vectors and Repa arrays).

[Skip to Readme]
Versions [faq],,,,,,
Change log CHANGELOG.markdown
Dependencies base (>=4.3 && <5), containers (>= && <0.6), either (==4.4.*), errors (>=2.0 && <2.2), filepath (==1.4.*), hnetcdf, repa (==3.4.*), transformers (>=0.2 && <0.6), vector (>=0.10.9 && <0.12) [details]
License BSD-3-Clause
Copyright Copyright (2013) Ian Ross
Author Ian Ross
Category Data
Home page
Source repo head: git clone
Uploaded by IanRoss at 2016-12-17T17:38:03Z
Distributions NixOS:
Executables example2, example1
Downloads 5271 total (9 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs not available [build log]
All reported builds failed as of 2016-12-17 [all 3 reports]


  • Data
    • Data.NetCDF
      • Data.NetCDF.Metadata
      • Data.NetCDF.PutGet
      • Data.NetCDF.Raw
        • Data.NetCDF.Raw.Attributes
        • Data.NetCDF.Raw.Base
        • Data.NetCDF.Raw.PutGet
        • Data.NetCDF.Raw.Utils
      • Data.NetCDF.Repa
      • Data.NetCDF.Storable
      • Data.NetCDF.Store
      • Data.NetCDF.Types
      • Data.NetCDF.Utils
      • Data.NetCDF.Vector


Maintainer's Corner

For package maintainers and hackage trustees

Readme for hnetcdf-

[back to package description]


Build Status

Haskell NetCDF library: as well as conventional low-level FFI bindings to the functions in the NetCDF library (in the Data.NetCDF.Raw modules), hnetcdf provides a higher-level Haskell interface (currently only for reading data). This higher-level interface aims to provide a "container polymorphic" view of NetCDF data allowing NetCDF variables to be read into Storable Vectors and Repa arrays easily.

For example:

import Data.NetCDF
import Foreign.C
import qualified Data.Vector.Storable as SV
type SVRet = IO (Either NcError (SV.Vector a))
  enc <- openFile "" ReadMode
  case enc of
    Right nc -> do
      eval <- get nc "varname" :: SVRet CDouble

gets the full contents of a NetCDF variable as a Storable Vector, while the following code reads the same variable (assumed to be three-dimensional) into a Repa array:

import Data.NetCDF
import Foreign.C
import qualified Data.Array.Repa as R
import qualified Data.Array.Repa.Eval as RE
import Data.Array.Repa.Repr.ForeignPtr (F)
type RepaRet3 a = IO (Either NcError (R.Array F R.DIM3 a))
  enc <- openFile "" ReadMode
  case enc of
    Right nc -> do
      eval <- get nc "varname" :: RepaRet3 CDouble