Sha256: 771dfe36ca8a46ebc689d601cf6f58818801d2936ed1e6d11f31d4ca03448241
Contents?: true
Size: 1.53 KB
Versions: 3
Compression:
Stored size: 1.53 KB
Contents
#!/usr/bin/env ruby ################################################## =begin = NAME gpprint - a command to print the values of a variable specified by a gtool4-type URL. = DESCRIPTION ((*gpprint*)) is a command-line tool to print the values of a variable specified by a gtool4-type URL. Outputs are comma-separated ascii texts with line feeding to avoid long lines and are made to stdout. = USAGE % gpprint url where the format of the url is path@varname[,dimname=pos1[:pos2[:thinning_intv]][,dimname=...]] = EXAMPLES % gpprint data.nc@temp % gpprint data.nc@temp,lon=135.0 % gpprint data.nc@temp,lon=130:150,lat=0 % gpprint data.nc@temp,lon=130:150,lat=0:90:2 = HISTORY 2004/12/14 T Horinouchi (created) 2005/01/12 T Horinouchi (document -> in rd) 2005/06/15 S Takehiro (set first_dim_length 1 when gp.shape[0] returns nil) 2005/08/10 S Takehiro (utilize internal function for printing help message) 2005/08/23 S Takehiro (common methods to gp* command moved to gpcommon.rb) 2010/03/10 Y SASAKI (change help block into RD format) =end ################################################## require "numru/gphys" require "numru/gphys/gpcommon" include NumRu #------------------------ print help message ------------------------ help if ARGV.length != 1 or /^-+h/ =~ ARGV[0] gturl = ARGV[0] gp = GPhys::IO.open_gturl(gturl) new_line_int = 6 first_dim_len = (gp.shape[0]||1) fmt = " %g," i = 1 gp.val.each do |v| printf(fmt,v) print "\n" if (i % new_line_int) == 0 or (i % first_dim_len) == 0 i += 1 end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gphys-1.1.1b | bin/gpprint |
gphys-1.1.1a | bin/gpprint |
gphys-1.1.1 | bin/gpprint |