rb-GRIB is a Ruby library to handle GRIB version 1 and 2 file.
the latest version is 0.4.0 [30 Aug 2016]
# 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.
# C_INCLUDE_PATH=/path_you_installed_header_files # LIBRARY_PATH=/path_you_installed_library_files # export C_INCLUDE_PATH # export LIBRARY_PATH
You can also get from git repository
% git clone http://ruby.gfd-dennou.org/products/rb-grib/rb-grib.gitor repository snapshot rb-grib-snapshot.tar.gz
You need require numru/grib to use rb-GRIB
require 'numru/grib'
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