Home: dennou ruby home page

rb-GRIB

- a Ruby library handling GRIB file -



What's rb-GRIB

rb-GRIB is a Ruby library to handle GRIB version 1 and 2 file.


Requires


Install/Download

the latest version is 0.2.2 [09 Mar 2012]

gem

rb-grib on rubygems

# gem install rb-grib
* If you installed NArray or GRIB API to non-standard directory, you may need to set the environment variables (C_INCLUDE_PATH, LIBRARY_PATH) before installing.
e.g.)
# C_INCLUDE_PATH=/path_you_installed_header_files
# LIBRARY_PATH=/path_you_installed_library_files
# export C_INCLUDE_PATH
# export LIBRARY_PATH

source file

rb-grib-0.2.2.tar.gz

repository

You can also get from git repository

% git clone http://ruby.gfd-dennou.org/products/rb-grib/rb-grib.git
or repository snapshot rb-grib-snapshot.tar.gz


Usage

You need require numru/grib to use rb-GRIB

require 'numru/grib'


Example

require 'numru/grib'
include NumRu

filename = "test.grib2"
file = Grib.open(filename)
var_names = file.var_names #=> Array of variable names
var_names.each do |var_name|
  var = file.var(var_name)
  var.dim_names #=> Array of dimention names
  dim = var.dim(dim_names[0])
  var.get #=> NArray
end
file.close