This has two kinds of methods.
One is an one-to-one wrap method for NuSDaS C library.
The methods are defined as class method of NumRu::NuSDaS
To use these methods,
you have to set NuSDaS root directory to environmental variable 'NUSDASnn',
or move to the directory having NuSDaS root directory named as 'NUSDASnn'.
The other is original.
The methods are defined as instance methods of NumRu::NuSDaS or NumRu::NuSDaSVar.
% git clone http://ruby.gfd-dennou.org/products/ruby-nusdas/ruby-nusdas.git
Rdoc document is here.
require "numru/nusdas" file = NumRu::NuSDaS.open("fcst_p.nus") vnames = file.var_names #=> ["U", "Usrf", "V", "Vsrf", "T", "Tsrf", ...] t = file.var("T") dnames = t.dim_names #=> ["lon", "lat", "pressure", "validtime"] lon = t.dim("lon") lon.val(:full) t[true,true,0,0].get
require "numru/ggraph" include NumRu t = GPhys::IO.open("fcst_p.nus","T") DCL.gropn(1) DCL.sglset("lcntl",false) GGraph.set_fig("itr"=>10) GGraph.set_map("coast_japan"=>true) GGraph.tone(gphys) DCL.grcls
require "numru/gphys" include NumRu in_file = NuSDaS.open("fcst_p.nus") out_file = NetCDF.create(fcst_p.nc") GPhys::IO.var_names(in_file).each do |vname| gphys = GPhys::IO.open(in_file, vname) GPhys::IO.write(out_file, gphys) end out_file.close in_file.close