gentooboontoo-ruby-netcdf 0.6.6.2

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.
data/test/test.cdl ADDED
@@ -0,0 +1,31 @@
1
+ netcdf test {
2
+ dimensions:
3
+ x = 15 ;
4
+ y = 10 ;
5
+ z = 10 ;
6
+ variables:
7
+ short test_sint(x) ;
8
+ byte test_byte(y) ;
9
+ byte test_byte2(z, y) ;
10
+ int test_int(y) ;
11
+ float test_sfloat(z) ;
12
+ double test_float(y) ;
13
+ byte test_byte_vara(z, y) ;
14
+ test_byte_vara:min to max of byte_vara = 0b, 20b ;
15
+ short test_sint_vara(z, y) ;
16
+ test_sint_vara:string = "%%%%%" ;
17
+ int test_int_vara(z, y) ;
18
+ test_int_vara:min to max of int_vara = 0, 60 ;
19
+ float test_sfloat_vara(z, y) ;
20
+ test_sfloat_vara:min to max of float_vara = 0.01f, 5.5f ;
21
+ double test_float_vara(z, y) ;
22
+ test_float_vara:min_to max of double_vara = 0.0001, 5.5555 ;
23
+
24
+ // global attributes:
25
+ :type_byte = 6b ;
26
+ :type_short = 222s, 333s, 444s ;
27
+ :type_int = 2222s, 3333s, 4444s ;
28
+ :type_float = 2.22f, 3.33f, 4.44f ;
29
+ :type_double = 2.222, 3.333, 4.444 ;
30
+ :string = "netCDF for Ruby" ;
31
+ }
data/test/test.rb ADDED
@@ -0,0 +1,192 @@
1
+ ##require 'numru/netcdf'
2
+ ## // to test before make install -->
3
+ require 'narray'
4
+ require '../netcdfraw'
5
+ require '../lib/netcdf'
6
+ ## <-- to test before make install //
7
+
8
+ include NumRu
9
+
10
+ filename = "test.nc"
11
+ print "creating ",filename,"...\n"
12
+ file=NetCDF.create(filename,false,false)
13
+
14
+ dimx=file.def_dim("x",15)
15
+ dimy=file.def_dim("y",10)
16
+ dimz=file.def_dim("z",10)
17
+
18
+ batt = file.put_att("type_byte",5,"byte")
19
+ file.put_att("type_short",[222,333,444],"sint")
20
+ file.put_att("type_int",[2222,3333,4444])
21
+ file.put_att("type_float",[2.22,3.33,4.44],"sfloat")
22
+ file.put_att("type_double",[2.222,3.333,4.444])
23
+ string = file.put_attraw("string","netCDF for Ruby","string")
24
+ batt.put(6,"byte")
25
+
26
+ sint_var=file.def_var("test_sint","sint",["x"])
27
+ byte_var=file.def_var("test_byte","byte",["y"])
28
+ byte_var2=file.def_var("test_byte2","byte",[dimy,dimz])
29
+ int_var=file.def_var("test_int","int",["y"])
30
+ sfloat_var=file.def_var("test_sfloat","sfloat",["z"])
31
+ float_var=file.def_var("test_float","float",["y"])
32
+
33
+ a=NArray.sint(10).indgen
34
+ b=NArray.sint(10).fill(7)
35
+ c=NArray.byte(10).indgen
36
+ d=NArray.int(10).indgen
37
+ e=NArray.sfloat(10).fill(1.111)
38
+ f=NArray.float(10).fill(5.5555555)
39
+ file.enddef
40
+ file2 = file
41
+ (file2 == file)
42
+
43
+ byte_var.put_var_byte(c)
44
+ int_var.put_var_int(d)
45
+ sfloat_var.put_var_sfloat(e)
46
+ float_var.put_var_float(f)
47
+
48
+ file.redef
49
+ byte_vara=file.def_var("test_byte_vara","byte",[dimy,dimz]);
50
+ sint_vara=file.def_var("test_sint_vara","sint",["y","z"]);
51
+ int_vara=file.def_var("test_int_vara","int",["y","z"]);
52
+ sfloat_vara=file.def_var("test_sfloat_vara","sfloat",["y","z"]);
53
+ float_vara=file.def_var("test_float_vara","float",["y","z"]);
54
+ file.enddef
55
+
56
+ byte_vara2 = byte_vara
57
+ (byte_vara2 == byte_vara)
58
+
59
+ g=NArray.byte(10,10).indgen
60
+ h=NArray.byte(2,3).indgen
61
+ gh=NArray.byte(1,1).fill(33)
62
+ k=NArray.sint(10,10).indgen
63
+ l=NArray.sint(2,3).indgen
64
+ kl=NArray.sint(1,1).fill(44)
65
+ m=NArray.int(10,10).indgen
66
+ n=NArray.int(2,3).indgen
67
+ mn=NArray.int(1,1).fill(55)
68
+ o=NArray.sfloat(10,10).fill(1.234567)
69
+ p=NArray.sfloat(2,3).fill(2.345678)
70
+ op=NArray.int(1,1).fill(3.4)
71
+ q=NArray.float(10,10).fill(1.234)
72
+ r=NArray.float(2,3).fill(2.345)
73
+ qr=NArray.float(1,1).fill(4.5)
74
+ s=NArray.float(2,2).fill(10.0)
75
+
76
+
77
+ byte_vara.put(g)
78
+ byte_vara.put(h,{"start"=>[3,5]})
79
+ byte_vara.put(g,{"start"=>[0,0],"end"=>[9,9]})
80
+ byte_vara.put(h,{"start"=>[-8,2]})
81
+ byte_vara.put(h,{"start"=>[0,0],"stride"=>[2,3]})
82
+ byte_vara.put(h,{'start'=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
83
+ byte_vara.put(gh,{"index"=>[4,7]})
84
+
85
+ sint_vara.put(k)
86
+ sint_vara.put(l,{"start"=>[3,5]})
87
+ sint_vara.put(k,{"start"=>[0,0],"end"=>[9,9]})
88
+ sint_vara.put(l,{"start"=>[-8,2]})
89
+ sint_vara.put(l,{"start"=>[0,0],"stride"=>[2,3]})
90
+ sint_vara.put(l,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
91
+ sint_vara.put(kl,{"index"=>[4,7]})
92
+
93
+ int_vara.put(m)
94
+ int_vara.put(n,{"start"=>[3,5]})
95
+ int_vara.put(m,{"start"=>[0,0],"end"=>[9,9]})
96
+ int_vara.put(n,{"start"=>[-8,2]})
97
+ int_vara.put(n,{"start"=>[0,0],"stride"=>[2,3]})
98
+ int_vara.put(n,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
99
+ int_vara.put(mn,{"index"=>[4,7]})
100
+
101
+ sfloat_vara.put(o)
102
+ sfloat_vara.put(p,{"start"=>[3,5]})
103
+ sfloat_vara.put(o,{"start"=>[0,0],"end"=>[9,9]})
104
+ sfloat_vara.put(p,{"start"=>[-8,2]})
105
+ sfloat_vara.put(p,{"start"=>[0,0],"stride"=>[2,3]})
106
+ sfloat_vara.put(p,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
107
+ sfloat_vara.put(op,{"index"=>[4,7]})
108
+
109
+ float_vara.put(q)
110
+ float_vara.put(r,{"start"=>[3,5]})
111
+ float_vara.put(q,{"start"=>[0,0],"end"=>[9,9]})
112
+ float_vara.put(r,{"start"=>[-8,2]})
113
+ float_vara.put(r,{"start"=>[0,0],"stride"=>[2,3]})
114
+ float_vara.put(r,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
115
+ float_vara.put(qr,{"index"=>[4,7]})
116
+
117
+ float_vara.dim_names
118
+
119
+ na_aaa=byte_vara.get({"start"=>[3,5]})
120
+ na_aab=byte_vara.get({"start"=>[0,0],"end"=>[9,9]})
121
+ na_aac=byte_vara.get({"start"=>[-8,2]})
122
+ na_aad=byte_vara.get({"start"=>[0,0],"stride"=>[2,3]})
123
+ na_aae=byte_vara.get({'start'=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
124
+ na_aaf=byte_vara.get({"index"=>[4,7]})
125
+ na_aag=byte_vara.get
126
+
127
+ na_bba=sint_vara.get({"start"=>[3,5]})
128
+ na_bbb=sint_vara.get({"start"=>[0,0],"end"=>[9,9]})
129
+ na_bbc=sint_vara.get({"start"=>[-8,2]})
130
+ na_bbd=sint_vara.get({"start"=>[0,0],"stride"=>[2,3]})
131
+ na_bbf=sint_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
132
+ na_bbg=sint_vara.get({"index"=>[4,7]})
133
+ na_bbh=sint_vara.get
134
+
135
+ na_cca=int_vara.get({"start"=>[3,5]})
136
+ na_ccb=int_vara.get({"start"=>[0,0],"end"=>[9,9]})
137
+ na_ccc=int_vara.get({"start"=>[-8,2]})
138
+ na_ccd=int_vara.get({"start"=>[0,0],"stride"=>[2,3]})
139
+ na_cce=int_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
140
+ na_ccf=int_vara.get({"index"=>[4,7]})
141
+ na_ccg=int_vara.get
142
+
143
+ na_dda=sfloat_vara.get({"start"=>[3,5]})
144
+ na_ddb=sfloat_vara.get({"start"=>[0,0],"end"=>[9,9]})
145
+ na_ddc=sfloat_vara.get({"start"=>[-8,2]})
146
+ na_ddd=sfloat_vara.get({"start"=>[0,0],"stride"=>[2,3]})
147
+ na_dde=sfloat_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
148
+ na_ddf=sfloat_vara.get({"index"=>[4,7]})
149
+ na_ddg=sfloat_vara.get
150
+
151
+ na_eea=float_vara.get({"start"=>[3,5]})
152
+ na_eeb=float_vara.get({"start"=>[0,0],"end"=>[9,9]})
153
+ na_eec=float_vara.get({"start"=>[-8,2]})
154
+ na_eed=float_vara.get({"start"=>[0,0],"stride"=>[2,3]})
155
+ na_eee=float_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
156
+ na_eef=float_vara.get({"index"=>[4,7]})
157
+ na_eeg=float_vara.get
158
+
159
+ file.redef
160
+
161
+ copy_byte = string.copy(byte_vara)
162
+ copy_byte.put([0,20],"byte")
163
+ copy_byte.name="new_name"
164
+
165
+ copy_byte2 = copy_byte
166
+ (copy_byte2 == copy_byte)
167
+
168
+ copy_sint = string.copy(sint_vara)
169
+ copy_sint.put("%%%%%")
170
+ copy_int = string.copy(int_vara)
171
+ copy_int.put([0,60],"int")
172
+ copy_sfloat = string.copy(sfloat_vara)
173
+ copy_sfloat.put([0.01,5.5],"sfloat")
174
+ copy_float = string.copy(float_vara)
175
+ copy_float.put([0.0001,5.5555],"float")
176
+ file.enddef
177
+ nm = copy_byte.name
178
+ att0 = string.get
179
+ att1 = copy_byte.get
180
+ att2 = copy_sint.get
181
+ att3 = copy_int.get
182
+ att4 = copy_sfloat.get
183
+ att5 = copy_float.get
184
+ file.fill(true)
185
+ file.fill(false)
186
+
187
+ float_vara.dim_names
188
+ float_vara.att_names
189
+
190
+ file.close
191
+ exit(0)
192
+
data/test/type.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'numru/netcdf'
2
+ include NumRu
3
+ s = 'tmp.nc'
4
+ f = NetCDF.create(s)
5
+ d = f.def_dim('x',2)
6
+ v = f.def_var('x','sfloat',[d])
7
+ p v.vartype, v.ntype
8
+ v = f.def_var('x1','sint',[d])
9
+ p v.vartype, v.ntype
10
+ v = f.def_var('x2','byte',[d])
11
+ p v.vartype, v.ntype
12
+
13
+ f.close
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gentooboontoo-ruby-netcdf
3
+ version: !ruby/object:Gem::Version
4
+ hash: 99
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 6
9
+ - 6
10
+ - 2
11
+ version: 0.6.6.2
12
+ platform: ruby
13
+ authors:
14
+ - Takeshi Horinouchi
15
+ - Tsuyoshi Koshiro
16
+ - Shigenori Otsuka
17
+ - Seiya Nishizawa
18
+ - T Sakakima
19
+ autorequire:
20
+ bindir: bin
21
+ cert_chain: []
22
+
23
+ date: 2012-06-27 00:00:00 Z
24
+ dependencies:
25
+ - !ruby/object:Gem::Dependency
26
+ name: narray
27
+ prerelease: false
28
+ requirement: &id001 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ hash: 3
34
+ segments:
35
+ - 0
36
+ version: "0"
37
+ type: :runtime
38
+ version_requirements: *id001
39
+ - !ruby/object:Gem::Dependency
40
+ name: narray_miss
41
+ prerelease: false
42
+ requirement: &id002 !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ hash: 3
48
+ segments:
49
+ - 0
50
+ version: "0"
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ description: RubyNetCDF is the Ruby interface to the NetCDF library built on the NArray library, which is an efficient multi-dimensional numeric array class for Ruby.
54
+ email:
55
+ - julien.sanchez@gmail.com
56
+ executables: []
57
+
58
+ extensions:
59
+ - ext/extconf.rb
60
+ extra_rdoc_files: []
61
+
62
+ files:
63
+ - demo/demo1-create-alt.rb
64
+ - demo/demo4-copy.rb
65
+ - demo/README
66
+ - demo/demo2-graphic.rb
67
+ - demo/demo3-ncepclim.rb
68
+ - demo/demo1-create.rb
69
+ - doc/README_JP.txt
70
+ - doc/Ref_man_jp.html
71
+ - doc/Ref_man.rd
72
+ - doc/to_html
73
+ - doc/Ref_man_jp.rd
74
+ - doc/Ref_man.html
75
+ - ext/netcdfraw.c
76
+ - lib/numru/netcdf_miss.rb
77
+ - lib/numru/netcdf.rb
78
+ - test/test.cdl
79
+ - test/putatt.rb
80
+ - test/aref_aset.rb
81
+ - test/test.rb
82
+ - test/char_var.rb
83
+ - test/def_var_with_dim.rb
84
+ - test/putatt.cdl
85
+ - test/clone.rb
86
+ - test/factor_offset.rb
87
+ - test/create_tmp.rb
88
+ - test/type.rb
89
+ - ChangeLog
90
+ - INSTALL
91
+ - LICENSE.txt
92
+ - ext/extconf.rb
93
+ homepage: http://www.gfd-dennou.org/arch/ruby/products/ruby-netcdf/
94
+ licenses:
95
+ - Ruby
96
+ post_install_message:
97
+ rdoc_options: []
98
+
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ hash: 3
107
+ segments:
108
+ - 1
109
+ - 6
110
+ version: "1.6"
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ none: false
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ hash: 3
117
+ segments:
118
+ - 0
119
+ version: "0"
120
+ requirements: []
121
+
122
+ rubyforge_project:
123
+ rubygems_version: 1.8.7
124
+ signing_key:
125
+ specification_version: 3
126
+ summary: Ruby interface to NetCDF
127
+ test_files: []
128
+