by T Horinouchi
This ruby program file provides additional methods to GrADS_Gridded class. The methods introduced here are those to convert the GrADS gridded data into other formats (currently only NetCDF is available), and vice versa (currently none is available).
load grads_grdded.rb first by
require "grads_grdded" require "grads_grdded_convert"
to_netcdf(filename_or_prefix, varnamelist=nil, separate=false)
converts a grads dataset to NetCDF file(s).
Arguments
Return value
info to continue output, which is used by to_netcdf_append. Discard it if you do not append contents from another GrADS file
to_netcdf_append(nctimeax,ncvars,varnamelist)
appends the contents to NetCDF files created by to_netcdf.
Warning
The GrADS file to be appended must have exactly the same variables with the same vertical levels and "options" as the one converted first by to_netcdf. This is ASSUMED, not checked, in the present implimentation.
Arguments
Example
gr1 = GrADS_Gridded.open("grads1.ctl") append_info = gr1.to_netcdf("new.nc") gr2 = GrADS_Gridded.open("grads2.ctl") gr2.to_netcdf_append(*append_info) gr3 = GrADS_Gridded.open("grads3.ctl") gr3.to_netcdf_append(*append_info)