netcdf

This library currently only supports netcdf v4

Crystal bindings to libnetcdf v4.

Based on swillner's NodeJS bindings

Installation

NetCDF must be installed: brew install hdf5 netcdf

Add this to your application's shard.yml:

dependencies:
  netcdf:
    github: fridgerator/netcdfcr

Usage

require "netcdf"

file = NetCDF::File.open("path/to/file.nc")
group = file.groups.first
attr = group.attributes.first
puts attr.name
puts attr.value

variable = group.variables.first
puts variable.name
puts variable.read(0) # one dimension
puts variable.read(0, 0, 0) # 3 dimensions
puts variable.read_slice(0, 10, 0, 1, 0, 1) # read slice of 10 for 3 dimensions

attr = variable.attributes.first
puts attr.value

file.close

Classes

File

Properties:

Methods:

Group

Properties:

Methods:

Dimension

Properties:

Attribute

Properties:

Methods:

Variable

Properties:

Methods:

Contributing

  1. Fork it ( https://github.com/fridgerator/netcdfcr/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors