gphys 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/ChangeLog +7414 -0
- data/LICENSE.txt +1 -1
- data/Rakefile +0 -2
- data/doc/derivative/math-doc/document/images.log +385 -0
- data/doc/ep_flux/math-doc/document/images.log +1375 -0
- data/doc/ganalysis/doc/NumRu.html +203 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis.html +931 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/BetaPlane.html +574 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/Fitting.html +576 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/LogP.html +425 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/Met.html +2021 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/MetZ.html +524 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/Planet.html +1047 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/QG.html +794 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/QG/Uninitialized.html +215 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/QG_common.html +603 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/QG_sphere.html +760 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/QG_sphere_common.html +251 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/QG_sphere_div.html +424 -0
- data/doc/ganalysis/doc/NumRu/GAnalysis/SigmaCoord.html +321 -0
- data/doc/ganalysis/doc/NumRu/GGraph.html +334 -0
- data/doc/ganalysis/doc/NumRu/GPhys.html +579 -0
- data/doc/ganalysis/doc/Object.html +210 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/beta_plane_rb.html +60 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/covariance_rb.html +56 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/eof_rb.html +64 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/fitting_rb.html +54 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/histogram_rb.html +58 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/log_p_rb.html +60 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/met_rb.html +60 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/met_z_rb.html +58 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/planet_rb.html +58 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/qg_rb.html +64 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis/sigma_coord_rb.html +56 -0
- data/doc/ganalysis/doc/__/__/lib/numru/ganalysis_rb.html +98 -0
- data/doc/ganalysis/doc/created.rid +13 -0
- data/doc/ganalysis/doc/images/brick.png +0 -0
- data/doc/ganalysis/doc/images/brick_link.png +0 -0
- data/doc/ganalysis/doc/images/bug.png +0 -0
- data/doc/ganalysis/doc/images/bullet_black.png +0 -0
- data/doc/ganalysis/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/ganalysis/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/ganalysis/doc/images/date.png +0 -0
- data/doc/ganalysis/doc/images/find.png +0 -0
- data/doc/ganalysis/doc/images/loadingAnimation.gif +0 -0
- data/doc/ganalysis/doc/images/macFFBgHack.png +0 -0
- data/doc/ganalysis/doc/images/package.png +0 -0
- data/doc/ganalysis/doc/images/page_green.png +0 -0
- data/doc/ganalysis/doc/images/page_white_text.png +0 -0
- data/doc/ganalysis/doc/images/page_white_width.png +0 -0
- data/doc/ganalysis/doc/images/plugin.png +0 -0
- data/doc/ganalysis/doc/images/ruby.png +0 -0
- data/doc/ganalysis/doc/images/tag_green.png +0 -0
- data/doc/ganalysis/doc/images/wrench.png +0 -0
- data/doc/ganalysis/doc/images/wrench_orange.png +0 -0
- data/doc/ganalysis/doc/images/zoom.png +0 -0
- data/doc/ganalysis/doc/index.html +383 -0
- data/doc/ganalysis/doc/js/darkfish.js +118 -0
- data/doc/ganalysis/doc/js/jquery.js +32 -0
- data/doc/ganalysis/doc/js/quicksearch.js +114 -0
- data/doc/ganalysis/doc/js/thickbox-compressed.js +10 -0
- data/doc/ganalysis/doc/rdoc.css +763 -0
- data/ext/numru/gphys/ext_init.c +1 -0
- data/ext/numru/gphys/quad_mesh_sample.c +478 -0
- data/gphys.gemspec +2 -2
- data/lib/numru/dclext.rb +394 -14
- data/lib/numru/derivative.rb +6 -0
- data/lib/numru/ganalysis/qg.rb +6 -4
- data/lib/numru/ggraph.rb +41 -8
- data/lib/numru/gphys/gphys.rb +62 -14
- data/lib/numru/gphys/gphys_io.rb +4 -4
- data/lib/numru/gphys/version.rb +2 -2
- metadata +84 -79
- data/.gitignore +0 -14
- data/TODO_ep_flux +0 -6
- data/gphys-bigmem.gemspec +0 -44
- data/install.rb +0 -130
- data/sample/cira86_to_nc.rb +0 -122
- data/sample/druby_cli1.rb +0 -23
- data/sample/druby_cli2.rb +0 -28
- data/sample/druby_serv1.rb +0 -30
- data/sample/druby_serv2.rb +0 -51
- data/sample/ep_flux/demo_NCEP_1.rb +0 -48
- data/sample/ep_flux/demo_NCEP_2.rb +0 -57
- data/sample/ep_flux/demo_NCEP_3.rb +0 -81
- data/sample/ggraph_latlon_labelling_dr002690.rb +0 -159
- data/sample/ggraph_mapfit-axes_dr002687.rb +0 -131
- data/sample/map_projection.rb +0 -121
- data/sample/ncep_theta_coord.rb +0 -79
- data/test_old/eof_slp.rb +0 -28
- data/test_old/mltbit.dat +0 -0
- data/test_old/test_ep_flux.rb +0 -533
- data/test_old/test_multibitIO.rb +0 -19
data/.gitignore
DELETED
data/TODO_ep_flux
DELETED
data/gphys-bigmem.gemspec
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
-
require 'numru/gphys/version'
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name = "gphys-bigmem"
|
|
8
|
-
spec.version = NumRu::GPhys::VERSION
|
|
9
|
-
spec.authors = ["Takeshi Horinouchi", "Ryo Mizuta",\
|
|
10
|
-
"Daisuke Tsukahara", "Seiya Nishizawa", "Shin-ichi Takehiro"]
|
|
11
|
-
spec.email = ["horinout@ees.hokudai.ac.jp"]
|
|
12
|
-
|
|
13
|
-
#if spec.respond_to?(:metadata)
|
|
14
|
-
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
|
|
15
|
-
#end
|
|
16
|
-
|
|
17
|
-
spec.summary = %q{A multi-purpose class to handle Gridded Physical quantities}
|
|
18
|
-
spec.description = %q{Comprehensive library for self-descriptive gridded physical data (in NetCDF, GrADS, or on memory) with graphics. This version works with Ruby 2.0.}
|
|
19
|
-
spec.homepage = 'http://www.gfd-dennou.org/arch/ruby/products/gphys/'
|
|
20
|
-
spec.licenses = ["BSD-2-Clause"]
|
|
21
|
-
|
|
22
|
-
spec.files = `git ls-files -z`.split("\x0")
|
|
23
|
-
spec.bindir = "bin"
|
|
24
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
25
|
-
spec.require_paths = ["ext","lib"]
|
|
26
|
-
spec.test_files = spec.files.grep(%r{^(test|test_old|sample|testdata)/})
|
|
27
|
-
spec.extensions << "ext/numru/gphys/extconf.rb"
|
|
28
|
-
|
|
29
|
-
spec.post_install_message = "Thanks for installing! You can add extra libraries (i.e., ruby-lapack, rb-grib) to enjoy powerful calculating and handling datasets."
|
|
30
|
-
|
|
31
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 1.8")
|
|
32
|
-
|
|
33
|
-
spec.add_runtime_dependency(%q<narray-bigmem>)
|
|
34
|
-
spec.add_runtime_dependency(%q<narray_miss-bigmem>)
|
|
35
|
-
spec.add_runtime_dependency(%q<numru-misc-bigmem>)
|
|
36
|
-
spec.add_runtime_dependency(%q<numru-units>, [">= 1.7"])
|
|
37
|
-
spec.add_runtime_dependency(%q<ruby-netcdf-bigmem>)
|
|
38
|
-
spec.add_runtime_dependency(%q<ruby-dcl-bigmem>)
|
|
39
|
-
spec.add_runtime_dependency(%q<ruby-fftw3-bigmem>)
|
|
40
|
-
#spec.add_runtime_dependency(%q<gsl>, [">= 1.14"])
|
|
41
|
-
#spec.add_runtime_dependency(%q<rb-gsl>, [">= 1.14"])
|
|
42
|
-
#spec.add_runtime_dependency(%q<ruby-lapack>, [">= 1.5"])
|
|
43
|
-
#spec.add_development_dependency(%q<rb-grib>, [">= 0.2.0"])
|
|
44
|
-
end
|
data/install.rb
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
require 'rbconfig'
|
|
2
|
-
require 'find'
|
|
3
|
-
include Config
|
|
4
|
-
if CONFIG["MINOR"].to_i > 6 then $rb_18 = true else $rb_18 = false end
|
|
5
|
-
if $rb_18
|
|
6
|
-
require 'fileutils'
|
|
7
|
-
else
|
|
8
|
-
require 'ftools'
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
=begin
|
|
12
|
-
$version = CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
|
|
13
|
-
$libdir = File.join(CONFIG["libdir"], "ruby", $version)
|
|
14
|
-
# $archdir = File.join($libdir, CONFIG["arch"])
|
|
15
|
-
$site_libdir = $:.find {|x| x =~ /site_ruby$/}
|
|
16
|
-
if !$site_libdir
|
|
17
|
-
$site_libdir = File.join($libdir, "site_ruby")
|
|
18
|
-
elsif Regexp.compile($site_libdir) !~ Regexp.quote($version)
|
|
19
|
-
$site_libdir = File.join($site_libdir, $version)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
default_destdir = $site_libdir
|
|
23
|
-
=end
|
|
24
|
-
default_destdir = CONFIG["sitelibdir"]
|
|
25
|
-
|
|
26
|
-
default_bindir = CONFIG["bindir"]
|
|
27
|
-
|
|
28
|
-
def install_rb(srcdir, destdir)
|
|
29
|
-
libdir = "lib"
|
|
30
|
-
libdir = File.join(srcdir, libdir) if srcdir
|
|
31
|
-
path = []
|
|
32
|
-
dir = []
|
|
33
|
-
Find.find(libdir) do |f|
|
|
34
|
-
next unless FileTest.file?(f)
|
|
35
|
-
next if (f = f[libdir.length+1..-1]) == nil
|
|
36
|
-
next if (/CVS$/ =~ File.dirname(f))
|
|
37
|
-
path.push f
|
|
38
|
-
dir |= [File.dirname(f)]
|
|
39
|
-
end
|
|
40
|
-
for f in dir
|
|
41
|
-
next if f == "."
|
|
42
|
-
next if f == "CVS"
|
|
43
|
-
if $rb_18
|
|
44
|
-
FileUtils.makedirs(File.join(destdir, f))
|
|
45
|
-
else
|
|
46
|
-
File::makedirs(File.join(destdir, f))
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
for f in path
|
|
50
|
-
next if (/\~$/ =~ f)
|
|
51
|
-
next if (/^\./ =~ File.basename(f))
|
|
52
|
-
if $rb_18
|
|
53
|
-
FileUtils.install(File.join(libdir, f), File.join(destdir, f), {:mode => 0644, :verbose => true})
|
|
54
|
-
else
|
|
55
|
-
File::install(File.join(libdir, f), File.join(destdir, f), 0644, true)
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def install_bin(srcdir, destbindir)
|
|
61
|
-
localbindir = "bin"
|
|
62
|
-
localbindir = File.join(srcdir, localbindir) if srcdir
|
|
63
|
-
path = []
|
|
64
|
-
dir = []
|
|
65
|
-
Find.find(localbindir) do |f|
|
|
66
|
-
next unless FileTest.file?(f)
|
|
67
|
-
next if (f = f[localbindir.length+1..-1]) == nil
|
|
68
|
-
next if (/CVS$/ =~ File.dirname(f))
|
|
69
|
-
path.push f
|
|
70
|
-
#dir |= [File.dirname(f)]
|
|
71
|
-
end
|
|
72
|
-
#for f in dir
|
|
73
|
-
# next if f == "."
|
|
74
|
-
# next if f == "CVS"
|
|
75
|
-
# File::makedirs(File.join(destbindir, f))
|
|
76
|
-
#end
|
|
77
|
-
for f in path
|
|
78
|
-
next if (/\~$/ =~ f)
|
|
79
|
-
next if (/^\./ =~ File.basename(f))
|
|
80
|
-
if $rb_18
|
|
81
|
-
FileUtils.install(File.join(localbindir, f), File.join(destbindir, f), {:mode => 0755, :verbose => true})
|
|
82
|
-
else
|
|
83
|
-
File::install(File.join(localbindir, f), File.join(destbindir, f), 0755, true)
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def ARGV.switch
|
|
89
|
-
return nil if self.empty?
|
|
90
|
-
arg = self.shift
|
|
91
|
-
return nil if arg == '--'
|
|
92
|
-
if arg =~ /^-(.)(.*)/
|
|
93
|
-
return arg if $1 == '-'
|
|
94
|
-
raise 'unknown switch "-"' if $2.index('-')
|
|
95
|
-
self.unshift "-#{$2}" if $2.size > 0
|
|
96
|
-
"-#{$1}"
|
|
97
|
-
else
|
|
98
|
-
self.unshift arg
|
|
99
|
-
nil
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
def ARGV.req_arg
|
|
104
|
-
self.shift || raise('missing argument')
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
destdir = default_destdir
|
|
108
|
-
bindir = default_bindir
|
|
109
|
-
|
|
110
|
-
begin
|
|
111
|
-
while switch = ARGV.switch
|
|
112
|
-
case switch
|
|
113
|
-
when '-d', '--destdir'
|
|
114
|
-
destdir = ARGV.req_arg
|
|
115
|
-
when '-b', '--bindir'
|
|
116
|
-
bindir = ARGV.req_arg
|
|
117
|
-
else
|
|
118
|
-
raise "unknown switch #{switch.dump}"
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
rescue
|
|
122
|
-
STDERR.puts $!.to_s
|
|
123
|
-
STDERR.puts File.basename($0) +
|
|
124
|
-
" -d <destdir> -b <bindir>"
|
|
125
|
-
exit 1
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
install_rb(nil, destdir)
|
|
129
|
-
install_bin(nil, bindir)
|
|
130
|
-
|
data/sample/cira86_to_nc.rb
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
=cira86_to_nc.rb
|
|
3
|
-
|
|
4
|
-
Read the CIRA86 data file, make corresponding GPhys objects,
|
|
5
|
-
and write into a NetCDF file.
|
|
6
|
-
|
|
7
|
-
==Usage
|
|
8
|
-
|
|
9
|
-
The following will create a NetCDF file 'cira86.nc' under the current
|
|
10
|
-
directory.
|
|
11
|
-
|
|
12
|
-
% ruby cira86_to_nc.rb
|
|
13
|
-
=end
|
|
14
|
-
|
|
15
|
-
require 'numru/gphys'
|
|
16
|
-
|
|
17
|
-
#<< read CIRA data >>
|
|
18
|
-
|
|
19
|
-
file = File.open('../testdata/cira86.dat')
|
|
20
|
-
|
|
21
|
-
nlat = 17
|
|
22
|
-
nht = 36
|
|
23
|
-
nmon = 12
|
|
24
|
-
cira_miss_val = 999.0
|
|
25
|
-
|
|
26
|
-
lat, lat_units = NArray.sfloat(nlat), 'degrees' # latitude
|
|
27
|
-
ht, ht_units = NArray.sfloat(nht), 'km' # height
|
|
28
|
-
mon, mon_units = NArray.sfloat(nmon), 'month' # month
|
|
29
|
-
prs, prs_units = NArray.sfloat(nht), 'hPa' # pressure
|
|
30
|
-
temp,temp_units = NArray.sfloat(nht,nlat,nmon), 'K' # temperature
|
|
31
|
-
gph, gph_units = NArray.sfloat(nht,nlat,nmon), 'km' # geopot. height
|
|
32
|
-
west,west_units = NArray.sfloat(nht,nlat,nmon),'m/s' #eastward(westerly) wind
|
|
33
|
-
|
|
34
|
-
mon.indgen!.add!(1) # => 1..12
|
|
35
|
-
lat=(lat.indgen!-8)*10 # => -80,-70,...,80
|
|
36
|
-
|
|
37
|
-
print "Reading the CIRA86 data file...\n"
|
|
38
|
-
for imon in 0...nmon
|
|
39
|
-
dummy = file.gets
|
|
40
|
-
for iht in 0...nht
|
|
41
|
-
data = file.gets.strip.split(/ +/).collect{|v| v.to_f}
|
|
42
|
-
ht[iht] = data.shift
|
|
43
|
-
prs[iht] = data.shift
|
|
44
|
-
temp[iht,true,imon] = data
|
|
45
|
-
end
|
|
46
|
-
dummy = file.gets
|
|
47
|
-
for iht in 0...nht
|
|
48
|
-
data = file.gets.strip.split(/ +/).collect{|v| v.to_f}
|
|
49
|
-
gph[iht,true,imon] = data[2..-1]
|
|
50
|
-
end
|
|
51
|
-
dummy = file.gets
|
|
52
|
-
for iht in 0...nht
|
|
53
|
-
data = file.gets.strip.split(/ +/).collect{|v| v.to_f}
|
|
54
|
-
west[iht,true,imon] = data[2..-1]
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
temp = temp.transpose(1,0,2) # => [lat,ht,mon]
|
|
59
|
-
gph = gph.transpose(1,0,2) # => [lat,ht,mon]
|
|
60
|
-
west = west.transpose(1,0,2) # => [lat,ht,mon]
|
|
61
|
-
|
|
62
|
-
#<< change missing value to a large value >>
|
|
63
|
-
|
|
64
|
-
gp_miss_val = 2e30
|
|
65
|
-
valid_max = 1e30
|
|
66
|
-
temp[temp.eq(cira_miss_val)] = gp_miss_val
|
|
67
|
-
gph[gph.eq(cira_miss_val)] = gp_miss_val
|
|
68
|
-
west[west.eq(cira_miss_val)] = gp_miss_val
|
|
69
|
-
|
|
70
|
-
#<< into GPhys >>
|
|
71
|
-
|
|
72
|
-
include NumRu
|
|
73
|
-
|
|
74
|
-
lat_ax = Axis.new.set_pos(
|
|
75
|
-
VArray.new(lat,nil,'lat').set_att('units',lat_units).
|
|
76
|
-
set_att('long_name','latitude')
|
|
77
|
-
)
|
|
78
|
-
ht_ax = Axis.new.set_pos(
|
|
79
|
-
VArray.new(ht,nil,'ht').set_att('units',ht_units).
|
|
80
|
-
set_att('long_name','height')
|
|
81
|
-
)
|
|
82
|
-
ht_ax.set_aux('pressure',
|
|
83
|
-
VArray.new(prs,nil,'prs').set_att('units',prs_units).
|
|
84
|
-
set_att('long_name','pressure')
|
|
85
|
-
)
|
|
86
|
-
mon_ax = Axis.new.set_pos(
|
|
87
|
-
VArray.new(mon,nil,'mon').set_att('units',mon_units).
|
|
88
|
-
set_att('long_name','calendar month')
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
grid = Grid.new(lat_ax, ht_ax, mon_ax)
|
|
92
|
-
|
|
93
|
-
gp_miss_val = NArray.sfloat(1).fill!(gp_miss_val)
|
|
94
|
-
valid_max = NArray.sfloat(1).fill!(valid_max)
|
|
95
|
-
|
|
96
|
-
temp_gp = GPhys.new( grid,
|
|
97
|
-
VArray.new(temp,nil,'temp').set_att('units',temp_units).
|
|
98
|
-
set_att('long_name','temperature').
|
|
99
|
-
set_att('valid_max',valid_max).set_att('missing_value',gp_miss_val)
|
|
100
|
-
)
|
|
101
|
-
gph_gp = GPhys.new( grid,
|
|
102
|
-
VArray.new(gph,nil,'gph').set_att('units',gph_units).
|
|
103
|
-
set_att('long_name','geoptential height').
|
|
104
|
-
set_att('valid_max',valid_max).set_att('missing_value',gp_miss_val)
|
|
105
|
-
)
|
|
106
|
-
west_gp = GPhys.new( grid,
|
|
107
|
-
VArray.new(west,nil,'west').set_att('units',west_units).
|
|
108
|
-
set_att('long_name','westerly wind').
|
|
109
|
-
set_att('valid_max',valid_max).set_att('missing_value',gp_miss_val)
|
|
110
|
-
)
|
|
111
|
-
print "...GPhys created: #{temp_gp.name}, #{gph_gp.name}, #{west_gp.name}\n"
|
|
112
|
-
|
|
113
|
-
#<<into a NetCDF file>>
|
|
114
|
-
|
|
115
|
-
ofilename = 'cira86.nc'
|
|
116
|
-
print "Writing into #{ofilename}...\n"
|
|
117
|
-
file = NetCDF.create(ofilename)
|
|
118
|
-
GPhys::NetCDF_IO.write(file,temp_gp)
|
|
119
|
-
GPhys::NetCDF_IO.write(file,gph_gp)
|
|
120
|
-
GPhys::NetCDF_IO.write(file,west_gp)
|
|
121
|
-
file.close
|
|
122
|
-
print "...done\n"
|
data/sample/druby_cli1.rb
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# druby_cli1.rb -- a sample dRuby client
|
|
2
|
-
#
|
|
3
|
-
# USAGE
|
|
4
|
-
# See ./druby_serv1.rb
|
|
5
|
-
|
|
6
|
-
require "drb/drb"
|
|
7
|
-
require "numru/gphys"
|
|
8
|
-
include NumRu
|
|
9
|
-
|
|
10
|
-
DRb.start_service
|
|
11
|
-
uri = ARGV.shift || raise("Usage: % #{$0} uri")
|
|
12
|
-
gp = DRbObject.new(nil, uri)
|
|
13
|
-
|
|
14
|
-
p gp.class, gp.name, gp.rank, gp.length
|
|
15
|
-
p gp.grid.axis(0).pos.name
|
|
16
|
-
|
|
17
|
-
gps = gp[0,true,true]
|
|
18
|
-
p gps.class, gps.name, gps.rank, gps.length
|
|
19
|
-
p gps.grid.axis(0).pos.name
|
|
20
|
-
|
|
21
|
-
gpmean = gp[true,true,0].mean(0)
|
|
22
|
-
p gpmean.class, gpmean.name, gpmean.rank, gpmean.length
|
|
23
|
-
p gpmean.grid.axis(0).pos.name
|
data/sample/druby_cli2.rb
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# druby_cli2.rb -- a sample dRuby client
|
|
2
|
-
#
|
|
3
|
-
# USAGE
|
|
4
|
-
# See ./druby_serv2.rb
|
|
5
|
-
|
|
6
|
-
require "drb/drb"
|
|
7
|
-
require "numru/ggraph"
|
|
8
|
-
include NumRu
|
|
9
|
-
|
|
10
|
-
DRb.start_service
|
|
11
|
-
uri = ARGV.shift || raise("Usage: % #{$0} uri")
|
|
12
|
-
gp = DRbObject.new(nil, uri)
|
|
13
|
-
|
|
14
|
-
p gp.class, gp.name, gp.rank, gp.length
|
|
15
|
-
p gp.grid.axis(0).pos.name
|
|
16
|
-
|
|
17
|
-
gpmean = gp.mean(0)
|
|
18
|
-
p gpmean.class, gpmean.name, gpmean.rank
|
|
19
|
-
|
|
20
|
-
p ( gpmean_copy = gpmean.copy )
|
|
21
|
-
DCL.gropn(1)
|
|
22
|
-
DCL.sgpset('lfull',true)
|
|
23
|
-
DCL.sgpset('lcntl',false)
|
|
24
|
-
DCL.uzfact(0.7)
|
|
25
|
-
GGraph.set_fig('viewport'=>[0.25,0.7,0.15,0.6], 'itr'=>2 )
|
|
26
|
-
GGraph.contour( gpmean_copy )
|
|
27
|
-
DCL.grcls
|
|
28
|
-
|
data/sample/druby_serv1.rb
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
=druby_serv1.rb
|
|
3
|
-
|
|
4
|
-
a sample dRuby server
|
|
5
|
-
|
|
6
|
-
==USAGE
|
|
7
|
-
|
|
8
|
-
To start the server:
|
|
9
|
-
|
|
10
|
-
% ruby druby_serv1.rb
|
|
11
|
-
|
|
12
|
-
This will print the address of the server such as
|
|
13
|
-
druby://[hostname]:[port] (For exaple druby://horihost:39391
|
|
14
|
-
|
|
15
|
-
Then run the client as (if the address is druby://horihost:39391):
|
|
16
|
-
|
|
17
|
-
% ruby druby_cli1.rb druby://horihost:39391
|
|
18
|
-
=end
|
|
19
|
-
|
|
20
|
-
require "drb/drb"
|
|
21
|
-
require "numru/gphys"
|
|
22
|
-
include NumRu
|
|
23
|
-
|
|
24
|
-
file = NetCDF.open("../testdata/T.jan.nc")
|
|
25
|
-
gp = GPhys::NetCDF_IO.open(file,"T")
|
|
26
|
-
|
|
27
|
-
DRb.start_service(nil, gp)
|
|
28
|
-
puts 'URI: '+DRb.uri
|
|
29
|
-
puts '[return] to exit'
|
|
30
|
-
gets
|
data/sample/druby_serv2.rb
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
=druby_serv2.rb
|
|
3
|
-
|
|
4
|
-
a sample dRuby server. The difference from druby_serv1.rb is that
|
|
5
|
-
a couple of methods are added to NArray, which enables us to serialize
|
|
6
|
-
NArray with Marshal.dump. Therefore, a GPhys object can be transferred by
|
|
7
|
-
value (not by reference) if all the VArray in it is based on NArray.
|
|
8
|
-
This can be done with the copy method of GPhys. See druby_cli2.rb
|
|
9
|
-
for an example.
|
|
10
|
-
|
|
11
|
-
==USAGE
|
|
12
|
-
|
|
13
|
-
To start the server:
|
|
14
|
-
|
|
15
|
-
% ruby druby_serv2.rb [port]
|
|
16
|
-
|
|
17
|
-
This will print the address of the server such as
|
|
18
|
-
druby://[hostname]:[port] (For exaple druby://horihost:39391
|
|
19
|
-
|
|
20
|
-
Then run the client as (if the address is druby://horihost:39391):
|
|
21
|
-
|
|
22
|
-
% ruby druby_cli2.rb druby://horihost:39391
|
|
23
|
-
=end
|
|
24
|
-
|
|
25
|
-
require "drb/drb"
|
|
26
|
-
require "numru/gphys"
|
|
27
|
-
include NumRu
|
|
28
|
-
|
|
29
|
-
def usage
|
|
30
|
-
print <<-EOS
|
|
31
|
-
|
|
32
|
-
USAGE:
|
|
33
|
-
% ruby #{$0} [port]
|
|
34
|
-
|
|
35
|
-
Here, port (optional) is the port number to assign.
|
|
36
|
-
EOS
|
|
37
|
-
raise RuntimeError
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
port = ARGV.shift
|
|
41
|
-
usage if port && port.to_i.to_s != port
|
|
42
|
-
usage if ARGV.length > 0
|
|
43
|
-
|
|
44
|
-
file = NetCDF.open("../testdata/T.jan.nc")
|
|
45
|
-
gp = GPhys::NetCDF_IO.open(file,"T")
|
|
46
|
-
|
|
47
|
-
uri_seed = ( port ? 'druby://:'+port : nil ) # 'druby://:'+port, or nil
|
|
48
|
-
DRb.start_service(uri_seed, gp)
|
|
49
|
-
puts 'URI: '+DRb.uri
|
|
50
|
-
puts '[return] to exit'
|
|
51
|
-
gets
|