ruby-netcdf 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
data/doc/README_JP.txt ADDED
@@ -0,0 +1,152 @@
1
+ ***** README_JP.txt --- RubyNetCDF �Ȥ�?--- *****
2
+
3
+ *** RubyNetCDF ���طʤ���Ū ***
4
+
5
+ ���������ݡ��絤��Ķ���زʳؤʤɤ�ʬ����֤��Ƥϡ���¬�����ȯã�ˤ�ꡢ
6
+ ¿���δ�¬�ǡ�����������褦�ˤʤꡢ����˷׻����ʳؤ�ȯã�ˤ�ꡢ��
7
+ �������ߥ�졼�����ˤ����Ͳ��Ϥ�������˹Ԥ���褦�ˤʤä�������
8
+ ��̡����ߤǤϳƸ��漼ñ�̤ǰ�����ǡ����̤�����ͤ��Ƥ⡢�����̤Ϥ�
9
+ �ʤ�����ʤ�ΤȤʤꡢ�����Ǥ⡢��Ψ�褯�ǡ���������Ԥ�ɬ�פ��ǤƤ�����
10
+ ����ˡ���¬�ǡ��������ߥ�졼�����Υǡ�������Ϥ��뤿��Υץ������
11
+ �����ϥե�����Υե����ޥåȤ��㤨�С���줽�Υե����ޥåȤ˹�碌�ơ�
12
+ �ץ�������������ͤФʤ餺������ϫ�ϤȻ��֤���䤹���Ȥˤʤ롣����
13
+ ���褹��ˤϡ��͡��ʥե����ޥåȥǡ��������줷�ư����륤�󥿡��ե���
14
+ ����ɬ�פǡ����Υ��󥿥ե������ϲĻ벽�䡢���ͷ׻��ˤ�Ŭ������Τ�ɬ��
15
+ �Ǥ��롣���Τ褦���طʤ�դޤ��ơ���ȯ��Ψ���⤯���ץ��������ݼ����
16
+ ���ưפǤ���Ȥ�����ͳ���饪�֥������Ȼظ�����ruby���Ѥ����ǡ���������
17
+ �Ļ벽�Ķ���ȯ��ͭ���ȹͤ��롣���Τ���μ�Υե����ޥåȥǡ�����
18
+ ������Υ��󥿡��ե��������ΰ�ĤȤ��ơ����ʵ��ҷ��ե����ޥåȤǤ��롢
19
+ netCDF�ǡ�����C���󥿡��ե������ˤ�����ruby�ˤ���åѡ��γ�ȯ����Ū��
20
+ ���롣
21
+
22
+ *** netCDF�ˤĤ��� ***
23
+
24
+ netCDF�ϡ�Univercity Corporation for Atmospheric Research�ˤ�äƳ�ȯ��
25
+ �줿���Х��ʥ�ǡ����Ȥΰ㤤�ϡ�netCDF��ñ�ʤ��������Τʤ�ӤˤʤäƤ�
26
+ ��ΤǤϤʤ�������¾���ղ�Ū����򤽤Υե��������˻��äƤ���Ȥ�������
27
+ �Ǥ��롣����Ū�ʹ�¤�ϡ�
28
+
29
+ file--has��dimenstions
30
+ �� ref
31
+ --has��variables�� attributes
32
+
33
+ --has��attributes (global)
34
+
35
+ �Ȥ��ä����ˡ��������ѿ�̾��°���Ȥ����ղ�Ū�������ä��ե����ޥåȤ�
36
+ ���롣
37
+
38
+ netCDF�Υ��󥿡��ե������Ȥ��Ƥϡ�C�����ѡ�FORTRAN�����ѡ�C++�����ѡ�
39
+ perl�����ѡ��Ȥ��뤬��ruby�Ϥ�Ȥ��C�Ǥ�����Ƥ��ꡢ����˵�ǽ��ĥ��
40
+ ����ϳ�ĥ�饤�֥��Ȥ����ץ�������C�Ǻ������Ƽ¸����뤳�Ȥ��Ǥ���
41
+ �褦�ˤʤäƤ��롣������C���쥤�󥿡��ե�������ruby��¦���饢�������Ǥ�
42
+ ��褦�˳�ĥ�饤�֥���������롣
43
+
44
+ *** �ºݤ˳�ȯ�����ץ������λ��� ***
45
+
46
+ �ޤ����嵭�Τ褦��netCDF�ι�¤�˹�碌�ơ���������ĥ�饤�֥�����
47
+ 4�ĤΥ��饹�����������
48
+
49
+ �� NetCDF���饹
50
+ �� NetCDFDim ���饹
51
+ �� NetCDFVar ���饹
52
+ �� NetCDFAtt ���饹
53
+
54
+ ���Υ��饹�Τ��줾���C���󥿡��ե������˹�碌�ƺ��������᥽�åɤ�����
55
+ �ʤ���NetCDFDim,NetCDFAtt���饹�Υ��֥������Ȥ˴ؤ��륤�ƥ졼�����ưפ�
56
+ �Ǥ���᥽�åɤ��Ѱդ����ѿ��ؤΥǡ����ν���䡢�ǡ������ɤ߽Ф���ϥå���
57
+ �����Ѥ������ץ��������ˤ��������ǽ�ˤ��뤳�Ȥ����Ѥ��䤹�����󥿡�
58
+ �ե�������¸��������ޤ�ruby������Ͽ��ͷ׻��˸����Ƥ��ʤ��Τǡ�netCDF
59
+ �ե�����˽񤭹��������ޤ�netCDF�ե����뤫���ɤ߽Ф����ǡ�������γ�Ǽ
60
+ �ˤϡ����ͷ׻���Ŭ�������ͷ�����NArray����Ѥ��Ƥ��롣
61
+
62
+ ��İ�ĤΥ᥽�åɤλ��ͤˤĤ��Ƥϡ�netcdf-0.01.tar.gz��Ʊ������Ƥ���
63
+ how_to_use_netcdf.doc�ޤ���how_to_use_netcdf.pdf�˵��ܤ���Ƥ���ΤǤ�
64
+ ����򻲾Ȳ�������
65
+
66
+ *** ���󥹥ȡ�����ˡ��������ջ����� ***
67
+
68
+ netcdf-0.01.tar.gz��Ÿ�����ƤǤ���netcdf-0.01/�ǥ��쥯�ȥ�ˤ���
69
+ extconf.rb����Ѥ��ơ�
70
+
71
+ ruby extconf.rb,
72
+ make
73
+ make test
74
+ make site-install(�ޤ���make install)
75
+ �ǥ��󥹥ȡ���Ǥ��롣(make test �ϥƥ��Ȥ򤹤�����ʤΤǤ��ʤ��Ƥ���
76
+ ��)
77
+
78
+ �ޤ����Υץ���������Ѥ��뤿��ˤϡ�NArray�����餫���ᥤ�󥹥ȡ��뤵
79
+ ��Ƥ��뤳�Ȥ�ɬ�פˤʤ롣�ޤ�NArray�Υإå��ե����롢
80
+
81
+ narray.h,
82
+ narray_config.h
83
+
84
+ ��ruby�Υإå��ե�����ruby.h�γ�Ǽ���
85
+ (�̾�/usr/local/lib/ruby/1.6/�������ƥ�����̾)
86
+ �ʲ��˥��ԡ����Ƥ���ɬ�פ����롣
87
+
88
+ ����ˡ���������ջ���Ǥ���
89
+
90
+ �����ǡ�extconf.rb����Ǥϡ�netcdf-0.01/�ˤ���mkmf.rb��ƤӽФ��ơ�
91
+ �¹Ԥ��ޤ���������ruby�Τ�Ȥ�Ȥ�mkmf.rb���ѹ���ä��Ƥ��ޤ���
92
+ �ѹ��λ�����ʲ��˼����ޤ������塢ruby�ΥС�����󥢥åפ��Ԥ�졢
93
+ mkmf.rb���񤭴�����줿�ݤλ��ͤˤ��Ƥ���������
94
+
95
+ **********************************************************************
96
+ install: $(archdir)/$(DLLIB)
97
+
98
+ site-install: $(sitearchdir)/$(DLLIB)
99
+
100
+ �ȤʤäƤ���Τǡ�$(archdir)/$(DLLIB): ��
101
+ $(sitearchdir)/$(DLLIB): �ˤ��줾�졢
102
+
103
+ $(archdir)/$(DLLIB): $(DLLIB) �Τۤ���
104
+
105
+ @$(RUBY) -r ftools -e 'File::makedirs(*ARGV)' $(rubylibdir) $(archdir)
106
+ @$(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0555,
107
+ true)' $(DLLIB) $(archdir)/$(DLLIB)
108
+
109
+ ��ľ��ˡ�
110
+
111
+ @$(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0555, true)'
112
+ netcdf.rb $(rubylibdir)/netcdf.rb
113
+
114
+ ��
115
+
116
+ $(sitearchdir)/$(DLLIB): $(DLLIB) �Τۤ���
117
+
118
+ @$(RUBY) -r ftools -e 'File::makedirs(*ARGV)' $(libdir) $(sitearchdir)
119
+ @$(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0555,
120
+ true)' $(DLLIB) $(sitearchdir)/$(DLLIB)
121
+
122
+ ��ľ��ˡ�
123
+
124
+ @$(RUBY) -r ftools -e 'File::install(ARGV[0], ARGV[1], 0555,
125
+ true)' netcdf.rb $(sitelibdir)/netcdf.rb
126
+
127
+ ��ä��Ƥ��ޤ���
128
+
129
+ disclean: ���Ф�����Ȥ�
130
+ @$(RM) core ruby$(EXEEXT) *~
131
+ �Ǥ���Τ��Ф���
132
+ @$(RM) core ruby$(EXEEXT) *~ *.nc demo/*.nc
133
+ �ȡ�*.nc �ե������õ��褦�ˤ��ޤ�����
134
+ *************************************************************************
135
+
136
+ ���۾���Ruby�Υ饤���󥹤˽�򤹤롣
137
+
138
+ �ʤ���netcdf,ruby,narray�˴ؤ������ϰʲ���URL�򻲾Ȳ�������
139
+
140
+ netcdf�Υۡ���ڡ���
141
+
142
+ http://www.unidata.ucar.edu/packages/netcdf/
143
+
144
+ ruby�Υۡ���ڡ���
145
+
146
+ http://www.ruby-lang.org/
147
+
148
+ narray�Υۡ���ڡ���
149
+
150
+ http://www.ruby-lang.org/en/raa-list.rhtml?name=NArray
151
+
152
+ ***** End of the README_JP.txt *****
data/doc/Ref_man.html ADDED
@@ -0,0 +1,1482 @@
1
+ <?xml version="1.0" ?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html xmlns="http://www.w3.org/1999/xhtml">
6
+ <head>
7
+ <title>Ref_man.rd</title>
8
+ </head>
9
+ <body>
10
+ <h1><a name="label:0" id="label:0">RubyNetCDF Reference Manual</a></h1><!-- RDLabel: "RubyNetCDF Reference Manual" -->
11
+ <ul>
12
+ <li><a href="#label:9">Method Index</a></li>
13
+ </ul>
14
+ <p>---------------------------------------------</p>
15
+ <h2><a name="label:1" id="label:1">Overview</a></h2><!-- RDLabel: "Overview" -->
16
+ <p>RubyNetCDF is the Ruby interface of the NetCDF library. Ruby is a free
17
+ object-oriented scripting language and is freely available from
18
+ <a href="http://www.ruby-lang.org/">the Ruby homepage</a>.
19
+ To handle numeric data, RubyNetCDF uses
20
+ <a href="http://www.ruby-lang.org/en/raa-list.rhtml?name=NArray">NArray</a>, which is the standard numeric multi-dimensional array class
21
+ for Ruby. Thus, you have to have installed it before installing this library.
22
+ An NArray object holds numeric data in a consecutive memory area
23
+ pointed by a C pointer. Thus, it is computationally efficient.
24
+ NArray is similar to NumPy for Python, but results of some benchmark
25
+ tests suggests that NArray is more efficient than NumPy.
26
+ Optionally, RubyNetCDF offers methods to handle data missing
27
+ automatically. To use it, you will also
28
+ need <a href="http://ruby.gfd-dennou.org/products/narray_miss/">NArrayMiss</a>.
29
+ See <a href="#label:6">Usage</a> for details.</p>
30
+ <h3><a name="label:2" id="label:2">Structure</a></h3><!-- RDLabel: "Structure" -->
31
+ <p>RubyNetCDF consists of the four classes in the following.</p>
32
+ <ul>
33
+ <li><p><a href="#label:10">class NetCDF</a> -- the file class</p>
34
+ <p>An NetCDF object represents a NetCDF file</p></li>
35
+ <li><p><a href="#label:43">class NetCDFDim</a> -- the dimension class</p>
36
+ <p>Although in its C version a NetCDF dimension is represented by a
37
+ combination of a file ID and a dimension ID, it is represented by
38
+ only one NetCDFDim object in RubyNetCDF.</p></li>
39
+ <li><p><a href="#label:51">class NetCDFVar</a> -- the variable class</p>
40
+ <p>Although in its C version a NetCDF variable is represented by a
41
+ combination of a file ID and a variable ID, it is represented by
42
+ only one NetCDFVar object in RubyNetCDF.</p></li>
43
+ <li><p><a href="#label:90">class NetCDFAtt</a> -- the attribute class</p>
44
+ <p>Although in its C version a NetCDF attribute is represented by a
45
+ combination of file ID, variable ID, and its name, it is represented
46
+ by only one NetCDFAtt object in RubyNetCDF.</p></li>
47
+ </ul>
48
+ <h3><a name="label:3" id="label:3">Data type</a></h3><!-- RDLabel: "Data type" -->
49
+ <p>All the NetCDF variable types char, byte, short, int, float, and
50
+ double are supported in this Ruby interface. These types are called,
51
+ however, differently in it to adhere to the convention of Ruby, or,
52
+ more specifically, of NArray. These types are named to as "char",
53
+ "byte", "sint", "int", "sfloat", and "float", respectively. Therefore,
54
+ the vartype (=ntype) method of the NetCDFVar class returns one of these
55
+ strings. The def_var method of the NetCDF class also accepts one of
56
+ them to define a variable. It should be noted especially that "float"
57
+ in this library means the double in the NetCDF terminology. This is
58
+ due to the convention of Ruby -- the predefined Float class
59
+ corresponds to the double in C, not the float.</p>
60
+ <p>The "get" method of NetCDFVar class reads a variable in a NArray of
61
+ the same type as in the file, except for the "char" type which is read
62
+ into a "byte". This is because NArray does not have a "char" type.
63
+ However, it not is not supposed to be a problem, since a byte NArray
64
+ can easily handle string data.</p>
65
+ <h3><a name="label:4" id="label:4">Error handling</a></h3><!-- RDLabel: "Error handling" -->
66
+ <p>Errors are basically handled by raising exceptions. However, light
67
+ errors in value-returning methods are handled by returning nil (e.g.,
68
+ if a non-existent attribute name is specified in attribute reading).
69
+ Those methods that return nil on error are explicitly written as such
70
+ in the following.</p>
71
+ <h3><a name="label:5" id="label:5">Security features</a></h3><!-- RDLabel: "Security features" -->
72
+ <p>Security handling is done just as in the pre-defined File class.</p>
73
+ <h3><a name="label:6" id="label:6">Usage</a></h3><!-- RDLabel: "Usage" -->
74
+ <p>To use the RubyNetCDF library, load the library first by placing the
75
+ following line in your Ruby program to load the library:</p>
76
+ <pre>require 'numru/netcdf'</pre>
77
+ <p>If you want to use automatic data-missing-handling methods
78
+ (of NetCDFVar class), use the following:</p>
79
+ <pre>require 'numru/netcdf_miss'</pre>
80
+ <p>This will call <code>require 'numru/netcdf'</code> inside at the beginning, so
81
+ you do not have to call the both. The missing-data handling is done
82
+ with <a href="http://ruby.gfd-dennou.org/products/narray_miss/">NArrayMiss</a>,
83
+ so you have have installed it. This is, however, not needed if you only
84
+ call <code>require 'numru/netcdf'</code>.</p>
85
+ <p>Here, 'numru', which stands for "Numerical Ruby", is the name of
86
+ the subdirectory in the user's load path where the RubyNetCDF library
87
+ is placed. Then, it can be used as in the following:</p>
88
+ <pre>file = NumRu::NetCDF.create('tmp.nc')
89
+ x = file.def_dim('x',10)
90
+ y = file.def_dim('y',10)
91
+ v = file.def_var('v','float',[x,y])
92
+ file.close</pre>
93
+ <p>Here, NumRu is the module that has the library in it. The
94
+ reason why NetCDF library is wrapped in such a module is to avoid
95
+ conflicts in the name space. Without this kind of treatment,
96
+ problems happen if the user wants to use a library that happens to
97
+ have a class or module with the same name as even one of the classes
98
+ in this library.</p>
99
+ <p>If such a problem is not expected to happen, the prefix "NumRu::" can
100
+ be eliminated by "including" the NumRu module as in the following, so
101
+ that to place "NumRu::" is not needed anymore in the current scope:</p>
102
+ <pre>include NumRu
103
+ file = NetCDF.create('tmp.nc')
104
+ ...</pre>
105
+ <p>For more examples, see demo and test programs included in the
106
+ distribution package.</p>
107
+ <p>---------------------------------------------</p>
108
+ <h2><a name="label:7" id="label:7">How to read this manual</a></h2><!-- RDLabel: "How to read this manual" -->
109
+ <dl>
110
+ <dt><h4><a name="label:8" id="label:8"><code>method_name(<var>argument1</var>, <var>argument2</var>, ...) -- <var>arguments</var> <var>that</var> <var>can</var> <var>be</var> <var>omitted</var> <var>are</var> <var>expressed</var> <var>as</var> <var>Argument_name</var>=<var>Default_value</var></code></a></h4></dt><!-- RDLabel: "method_name" -->
111
+ <dd>
112
+ <p>Explanation of its function</p>
113
+ <p>Arguments</p>
114
+ <ul>
115
+ <li>name of argument1 (its class or possible values): explanation</li>
116
+ <li>name of argument2 (its class or possible values): explanation</li>
117
+ <li>...</li>
118
+ </ul>
119
+ <p>Return value</p>
120
+ <ul>
121
+ <li>Explanation of the return value</li>
122
+ </ul>
123
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
124
+ <ul>
125
+ <li>Name(s) in NetCDF ver 3. The function equivalent to the current
126
+ method, if not in parenthesis. If no direct correspondence,
127
+ dependent functions are listed in parentheses.</li>
128
+ </ul></dd>
129
+ </dl>
130
+ <p>---------------------------------------------</p>
131
+ <h2><a name="label:9" id="label:9">Method Index</a></h2><!-- RDLabel: "Method Index" -->
132
+ <ul>
133
+ <li><p><a href="#label:10">class NetCDF</a></p>
134
+ <p>Class Methods</p>
135
+ <ul>
136
+ <li><a href="#label:12">NetCDF.open</a> Opens a file (class method). If mode="w" and non-existent, a new</li>
137
+ <li><a href="#label:13">NetCDF.new</a> Aliased to NetCDF.open</li>
138
+ <li><a href="#label:14">NetCDF.create</a> Creates a NetCDF file (class method)</li>
139
+ <li><a href="#label:15">NetCDF.create_tmp</a> Creates a temporary NetCDF file (class method)</li>
140
+ </ul>
141
+ <p>Instance Methods</p>
142
+ <ul>
143
+ <li><a href="#label:17">close</a> Closes the file.</li>
144
+ <li><a href="#label:18">ndims</a> Returns the number of dimensions in the file</li>
145
+ <li><a href="#label:19">nvars</a> Returns the number of variables in the file</li>
146
+ <li><a href="#label:20">natts</a> Returns the number of global attributes in the file</li>
147
+ <li><a href="#label:21">unlimited</a> Returns the unlimited dimension in the file</li>
148
+ <li><a href="#label:22">path</a> Returns the path of the file (contents of the filename specified when opened/created)</li>
149
+ <li><a href="#label:23">redef</a> Switches to the define mode. Does nothing if already in it (nil returned).</li>
150
+ <li><a href="#label:24">enddef</a> Switches to the data mode. Does nothing if already in it (nil returned).</li>
151
+ <li><a href="#label:25">define_mode?</a> Inquire whether the file is in the define mode.</li>
152
+ <li><a href="#label:26">sync</a> Synchronizes the disk copy of a netCDF dataset with in-memory buffer</li>
153
+ <li><a href="#label:27">def_dim</a> Define a dimension</li>
154
+ <li><a href="#label:28">put_att</a> Sets a global attribute</li>
155
+ <li><a href="#label:29">def_var</a> Defines a variable</li>
156
+ <li><a href="#label:30">def_var_with_dim</a> Same as def_var but defines dimensions first if needed</li>
157
+ <li><a href="#label:31">var</a> Opens an existing variable in the file</li>
158
+ <li><a href="#label:32">vars</a> Opens existing variables in the file</li>
159
+ <li><a href="#label:33">dim</a> Opens an existing dimension in the file</li>
160
+ <li><a href="#label:34">dims</a> Opens existing dimensions in the file</li>
161
+ <li><a href="#label:35">att</a> Opens an existing global attribute in the file</li>
162
+ <li><a href="#label:36">fill=</a> Sets a fill mode. (Default behavior of NetCDF is FILL.)</li>
163
+ <li><a href="#label:37">each_dim</a> Iterator regarding the dimensions in the file.</li>
164
+ <li><a href="#label:38">each_var</a> Iterator regarding the variables in the file.</li>
165
+ <li><a href="#label:39">each_att</a> Iterator regarding the global attributes of the file.</li>
166
+ <li><a href="#label:40">dim_names</a> Returns the names of all dimensions in the file</li>
167
+ <li><a href="#label:41">var_names</a> Returns the names of all variables in the file</li>
168
+ <li><a href="#label:42">att_names</a> Returns the names of all the global attributes of the file</li>
169
+ </ul></li>
170
+ <li><p><a href="#label:43">class NetCDFDim</a></p>
171
+ <p>Class Methods</p>
172
+ <p>Instance Methods</p>
173
+ <ul>
174
+ <li><a href="#label:46">length</a> Returns the length of the dimension</li>
175
+ <li><a href="#label:47">length_ul0</a> Same as length but returns 0 for the unlimited dimension</li>
176
+ <li><a href="#label:48">name=</a> Rename the dimension</li>
177
+ <li><a href="#label:49">name</a> Returns the name of the dimension</li>
178
+ <li><a href="#label:50">unlimited?</a> Inquires whether the dimension is unlimited or not</li>
179
+ </ul></li>
180
+ <li><p><a href="#label:51">class NetCDFVar</a></p>
181
+ <p>Class Methods</p>
182
+ <ul>
183
+ <li><a href="#label:53">NetCDFVar.new</a> Combines NetCDF.open and NetCDF#Var to open a variable with one line (no need to use this).</li>
184
+ <li><a href="#label:54">NetCDFVar.unpack_type=</a> Fix the NArray type to be used
185
+ in <a href="#label:81">unpack</a></li>
186
+ <li><a href="#label:55">NetCDFVar.unpack_type</a> Returns the NArray type set by <a href="#label:54">NetCDFVar.unpack_type=</a>.</li>
187
+ </ul>
188
+ <p>Instance Methods</p>
189
+ <ul>
190
+ <li><a href="#label:33">dim</a> Inquires the dim_num-th dimension of the variable (dim_num=0,1,2,..)</li>
191
+ <li><a href="#label:34">dims</a> Returns an array of all the dimensions of the variable</li>
192
+ <li><a href="#label:59">shape_ul0</a> Returns the shape of the variable, but the length of the unlimited dimension is set to zero.</li>
193
+ <li><a href="#label:60">shape_current</a> Returns the current shape of the variable.</li>
194
+ <li><a href="#label:39">each_att</a> Iterator regarding the global attributes of the variables.</li>
195
+ <li><a href="#label:40">dim_names</a> Returns the names of all the dimensions of the variable</li>
196
+ <li><a href="#label:42">att_names</a> Returns the names of all the attributes of the variable</li>
197
+ <li><a href="#label:49">name</a> Returns the name of the variable</li>
198
+ <li><a href="#label:48">name=</a> Rename the variable</li>
199
+ <li><a href="#label:18">ndims</a> Number of dimensions of the variable (which is rank of the variable).</li>
200
+ <li><a href="#label:67">rank</a> aliased to ndims</li>
201
+ <li><a href="#label:68">ntype</a> Aliased to vartype</li>
202
+ <li><a href="#label:69">vartype</a> Inquires the data value type of the variable</li>
203
+ <li><a href="#label:70">typecode</a> Inquires the data type of the variable (returns a typecode of NArray)</li>
204
+ <li><a href="#label:20">natts</a> Returns the number of the attributes of the variable</li>
205
+ <li><a href="#label:72">file</a> Inquires the file that the variable is in</li>
206
+ <li><a href="#label:35">att</a> Returns the attribute specified by its name</li>
207
+ <li><a href="#label:28">put_att</a> Sets an attribute</li>
208
+ <li><a href="#label:75">put</a> Aliased to <a href="#label:76">simple_put</a></li>
209
+ <li><a href="#label:76">simple_put</a> Set the values of the variable</li>
210
+ <li><a href="#label:77">pack</a> Pack a NArray (etc) using the attributes scale_factor and/or add_offset of self.</li>
211
+ <li><a href="#label:78">scaled_put</a> Same as <a href="#label:76">simple_put</a> but interprets the attributes scale_factor and/or add_offset using <a href="#label:77">pack</a>.</li>
212
+ <li><a href="#label:79">get</a> Aliased to <a href="#label:80">simple_get</a></li>
213
+ <li><a href="#label:80">simple_get</a> Returns values of the variable</li>
214
+ <li><a href="#label:81">unpack</a> Unpack a NArray (etc) using the attributes scale_factor and/or add_offset of self.</li>
215
+ <li><a href="#label:82">scaled_get</a> Same as <a href="#label:80">simple_get</a> but interprets the attributes scale_factor and/or add_offset using <a href="#label:81">unpack</a>.</li>
216
+ <li><a href="#label:83">[]</a> Same as NetCDFVar#get but a subset is specified as in the method [] of NArray. </li>
217
+ <li><a href="#label:84">[]=</a> Same as NetCDFVar#put but a subset is specified as in the method []= of NArray. </li>
218
+ </ul>
219
+ <p>Instance Methods added by requiring "numru/netcdf_miss"</p>
220
+ <ul>
221
+ <li><a href="#label:86">get_with_miss</a> Same as <a href="#label:79">get</a> but interprets data missing.</li>
222
+ <li><a href="#label:87">get_with_miss_and_scaling</a> Same as <a href="#label:86">get_with_miss</a> but handles data scaling too.</li>
223
+ <li><a href="#label:88">put_with_miss</a> Same as <a href="#label:75">put</a> but interprets data missing.</li>
224
+ <li><a href="#label:89">put_with_miss_and_scaling</a> Same as <a href="#label:88">put_with_miss</a> but handles data scaling too.</li>
225
+ </ul></li>
226
+ <li><p><a href="#label:90">class NetCDFAtt</a></p>
227
+ <p>Class Methods</p>
228
+ <p>Instance Methods</p>
229
+ <ul>
230
+ <li><a href="#label:49">name</a> Returns the name of the attribute</li>
231
+ <li><a href="#label:48">name=</a> Rename the attribute</li>
232
+ <li><a href="#label:95">copy</a> Copies an attribute to a variable or a file. If file, becomes an global attribute</li>
233
+ <li><a href="#label:96">delete</a> Delete an attribute</li>
234
+ <li><a href="#label:75">put</a> Sets the value of the attribute</li>
235
+ <li><a href="#label:79">get</a> Returns the values of the attribute</li>
236
+ <li><a href="#label:99">atttype</a> Inquires the type of attribute values</li>
237
+ <li><a href="#label:70">typecode</a> Inquires the type of attribute values (returns a NArray typecode)</li>
238
+ </ul></li>
239
+ </ul>
240
+ <p>---------------------------------------------</p>
241
+ <h1><a name="label:10" id="label:10">class NetCDF</a></h1><!-- RDLabel: "class NetCDF" -->
242
+ <h3><a name="label:11" id="label:11">Class Methods</a></h3><!-- RDLabel: "Class Methods" -->
243
+ <dl>
244
+ <dt><h4><a name="label:12" id="label:12"><code>NetCDF.open(<var>filename</var>, <var>mode</var>="<var>r</var>", <var>share</var>=<var>false</var>)</code></a></h4></dt><!-- RDLabel: "NetCDF.open" -->
245
+ <dd>
246
+ <p>Opens a file (class method). If mode="w" and the file does not
247
+ exist, a new file is created.</p>
248
+ <p>Arguments</p>
249
+ <ul>
250
+ <li>filename (String): file name (path)</li>
251
+ <li>mode (String) : IO mode "r" (read only); "w","w+" (write --
252
+ current contents are overwritten (eliminated!)); "r+","a","a+"
253
+ (append -- writable while current contents are preserved).
254
+ All the options permit reading, unlike the predefined File class.
255
+ Note that to "append" will require extra time and disk
256
+ space due to the limitations of the original NetCDF library,
257
+ which is used in this library.</li>
258
+ <li>share (true or false) : Whether to use the "shared" mode or not
259
+ (set true if a file being written may be read from other
260
+ processes. See nc_open in Ch.5 of users' guide of the C version)</li>
261
+ </ul>
262
+ <p>Return value</p>
263
+ <ul>
264
+ <li>a NetCDF object</li>
265
+ </ul>
266
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF </p>
267
+ <ul>
268
+ <li>nc_open, nc_create</li>
269
+ </ul></dd>
270
+ <dt><h4><a name="label:13" id="label:13"><code>NetCDF.new</code></a></h4></dt><!-- RDLabel: "NetCDF.new" -->
271
+ <dd>
272
+ <p>Aliased to NetCDF.open</p></dd>
273
+ <dt><h4><a name="label:14" id="label:14"><code>NetCDF.create(<var>filename</var>, <var>noclobber</var>=<var>false</var>, <var>share</var>=<var>false</var>)</code></a></h4></dt><!-- RDLabel: "NetCDF.create" -->
274
+ <dd>
275
+ <p>Creates a NetCDF file (class method)</p>
276
+ <p>Arguments</p>
277
+ <ul>
278
+ <li>filename (String) : file name (path)</li>
279
+ <li>noclobber (true or false) : overwrite or not if the file exists</li>
280
+ <li>share (true or false) : Whether to use the shared mode or not
281
+ (set true if a file being written may be read from other
282
+ processes. See nc_open in Ch.5 of users' guide of the C version)</li>
283
+ </ul>
284
+ <p>Return value</p>
285
+ <ul>
286
+ <li>a NetCDF object</li>
287
+ </ul>
288
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
289
+ <ul>
290
+ <li>nc_create</li>
291
+ </ul></dd>
292
+ <dt><h4><a name="label:15" id="label:15"><code>NetCDF.create_tmp(<var>tmpdir</var>=<var>ENV</var>['<var>TMPDIR</var>']||<var>ENV</var>['<var>TMP</var>']||<var>ENV</var>['<var>TEMP</var>']||'.', <var>share</var>=<var>false</var>)</code></a></h4></dt><!-- RDLabel: "NetCDF.create_tmp" -->
293
+ <dd>
294
+ <p>Creates a temporary NetCDF file (class method).
295
+ Its name is automatically generated, and it is deleted when closed.</p>
296
+ <p>Arguments</p>
297
+ <ul>
298
+ <li>tmpdir (String) : directory to place the temporary file.
299
+ By default, "." or a directory specified by an environmental
300
+ variable (TMPDIR or TMP or TEMP) is used. In a secure mode,
301
+ theses environmental variable is NOT used, and the default
302
+ value is '.'.</li>
303
+ <li>share (true or false) : Whether to use the shared mode or not</li>
304
+ </ul>
305
+ <p>Return value</p>
306
+ <ul>
307
+ <li>a NetCDF object</li>
308
+ </ul>
309
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
310
+ <ul>
311
+ <li>nc_create</li>
312
+ </ul></dd>
313
+ </dl>
314
+ <h3><a name="label:16" id="label:16">Instance Methods</a></h3><!-- RDLabel: "Instance Methods" -->
315
+ <dl>
316
+ <dt><h4><a name="label:17" id="label:17"><code>close</code></a></h4></dt><!-- RDLabel: "close" -->
317
+ <dd>
318
+ <p>Closes the file.</p>
319
+ <p>Arguments</p>
320
+ <ul>
321
+ <li>(none)</li>
322
+ </ul>
323
+ <p>Return value</p>
324
+ <ul>
325
+ <li>nil</li>
326
+ </ul>
327
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
328
+ <ul>
329
+ <li>nc_close</li>
330
+ </ul></dd>
331
+ <dt><h4><a name="label:18" id="label:18"><code>ndims</code></a></h4></dt><!-- RDLabel: "ndims" -->
332
+ <dd>
333
+ <p>Returns the number of dimensions in the file</p>
334
+ <p>Arguments</p>
335
+ <ul>
336
+ <li>(none)</li>
337
+ </ul>
338
+ <p>Return value</p>
339
+ <ul>
340
+ <li>Integer</li>
341
+ </ul>
342
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
343
+ <ul>
344
+ <li>nc_inq_ndims</li>
345
+ </ul></dd>
346
+ <dt><h4><a name="label:19" id="label:19"><code>nvars</code></a></h4></dt><!-- RDLabel: "nvars" -->
347
+ <dd>
348
+ <p>Returns the number of variables in the file</p>
349
+ <p>Arguments</p>
350
+ <ul>
351
+ <li>(none)</li>
352
+ </ul>
353
+ <p>Return value</p>
354
+ <ul>
355
+ <li>Integer</li>
356
+ </ul>
357
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
358
+ <ul>
359
+ <li>nc_inq_nvars</li>
360
+ </ul></dd>
361
+ <dt><h4><a name="label:20" id="label:20"><code>natts</code></a></h4></dt><!-- RDLabel: "natts" -->
362
+ <dd>
363
+ <p>Returns the number of global attributes in the file</p>
364
+ <p>Arguments</p>
365
+ <ul>
366
+ <li>(none)</li>
367
+ </ul>
368
+ <p>Return value</p>
369
+ <ul>
370
+ <li>Integer</li>
371
+ </ul>
372
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
373
+ <ul>
374
+ <li>nc_inq_natts</li>
375
+ </ul></dd>
376
+ <dt><h4><a name="label:21" id="label:21"><code>unlimited</code></a></h4></dt><!-- RDLabel: "unlimited" -->
377
+ <dd>
378
+ <p>Returns the unlimited dimension in the file</p>
379
+ <p>Arguments</p>
380
+ <ul>
381
+ <li>(none)</li>
382
+ </ul>
383
+ <p>Return value</p>
384
+ <ul>
385
+ <li>a NetCDFDim if it exists; nil if not</li>
386
+ </ul>
387
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
388
+ <ul>
389
+ <li>nc_inq_unlimdim</li>
390
+ </ul></dd>
391
+ <dt><h4><a name="label:22" id="label:22"><code>path</code></a></h4></dt><!-- RDLabel: "path" -->
392
+ <dd>
393
+ <p>Returns the path of the file (contents of the filename specified when opened/created)</p>
394
+ <p>Arguments</p>
395
+ <ul>
396
+ <li>(none)</li>
397
+ </ul>
398
+ <p>Return value</p>
399
+ <ul>
400
+ <li>String</li>
401
+ </ul>
402
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
403
+ <ul>
404
+ <li>(none)</li>
405
+ </ul></dd>
406
+ <dt><h4><a name="label:23" id="label:23"><code>redef</code></a></h4></dt><!-- RDLabel: "redef" -->
407
+ <dd>
408
+ <p>Switches to the define mode. Does nothing if already in it (nil returned).</p>
409
+ <p>Arguments</p>
410
+ <ul>
411
+ <li>(none)</li>
412
+ </ul>
413
+ <p>Return value</p>
414
+ <ul>
415
+ <li>true if successfully switched to the define mode;</li>
416
+ </ul></dd>
417
+ </dl>
418
+ <pre>nil if the file is already in the define mode.
419
+ Exception is raised if unsuccessful for other reasons.</pre>
420
+ <pre>Corresponding (dependent) function(s) in the C library of NetCDF
421
+ * nc_redef</pre>
422
+ <dl>
423
+ <dt><h4><a name="label:24" id="label:24"><code>enddef</code></a></h4></dt><!-- RDLabel: "enddef" -->
424
+ <dd>
425
+ <p>Switches to the data mode. Does nothing if already in it (nil returned).</p>
426
+ <p>Arguments</p>
427
+ <ul>
428
+ <li>(none)</li>
429
+ </ul>
430
+ <p>Return value</p>
431
+ <ul>
432
+ <li>true if successfully switched to the data mode;</li>
433
+ </ul></dd>
434
+ </dl>
435
+ <pre>nil if the file is already in the data mode.
436
+ Exception is raised if unsuccessful for other reasons.</pre>
437
+ <pre>Corresponding (dependent) function(s) in the C library of NetCDF
438
+ * nc_enddef</pre>
439
+ <dl>
440
+ <dt><h4><a name="label:25" id="label:25"><code>define_mode?</code></a></h4></dt><!-- RDLabel: "define_mode?" -->
441
+ <dd>
442
+ <p>Inquire whether the file is in the define mode.</p>
443
+ <p>Arguments</p>
444
+ <ul>
445
+ <li>(none)</li>
446
+ </ul>
447
+ <p>Return value</p>
448
+ <ul>
449
+ <li>true if the data is in the define mode;</li>
450
+ </ul></dd>
451
+ </dl>
452
+ <pre>false if the file is in the data mode;
453
+ nil otherwise (possibly the file is read-only).</pre>
454
+ <pre>Corresponding (dependent) function(s) in the C library of NetCDF
455
+ * combination of nc_redef and nc_enddef</pre>
456
+ <dl>
457
+ <dt><h4><a name="label:26" id="label:26"><code>sync</code></a></h4></dt><!-- RDLabel: "sync" -->
458
+ <dd>
459
+ <p>Synchronizes the disk copy of a netCDF dataset with in-memory buffer</p>
460
+ <p>Arguments</p>
461
+ <ul>
462
+ <li>(none)</li>
463
+ </ul>
464
+ <p>Return value</p>
465
+ <ul>
466
+ <li>nil</li>
467
+ </ul>
468
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
469
+ <ul>
470
+ <li>nc_sync</li>
471
+ </ul></dd>
472
+ <dt><h4><a name="label:27" id="label:27"><code>def_dim(<var>dimension_name</var>, <var>length</var>)</code></a></h4></dt><!-- RDLabel: "def_dim" -->
473
+ <dd>
474
+ <p>Define a dimension</p>
475
+ <p>Arguments</p>
476
+ <ul>
477
+ <li>dimension_name (String) : Name of the dimension to be defined</li>
478
+ <li>length (Integer) : length of the dimension. 0 for unlimited.</li>
479
+ </ul>
480
+ <p>Return value</p>
481
+ <ul>
482
+ <li>defined dimension (NetCDFDim object)</li>
483
+ </ul>
484
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
485
+ <ul>
486
+ <li>nc_def_dim</li>
487
+ </ul></dd>
488
+ <dt><h4><a name="label:28" id="label:28"><code>put_att(<var>attribute_name</var>, <var>value</var>, <var>atttype</var>=<var>nil</var>)</code></a></h4></dt><!-- RDLabel: "put_att" -->
489
+ <dd>
490
+ <p>Sets a global attribute</p>
491
+ <p>Arguments</p>
492
+ <ul>
493
+ <li>attribute_name (String) : name of the global attribute</li>
494
+ <li>value (Numeric, String, Array of Numeric, or NArray) : value of the attribute</li>
495
+ <li>atttype (nil or String) : data type of the attribute value.
496
+ nil lets it automatically determined from the value.
497
+ "char" (or "string"), "byte", "sint", "int", "sfloat", or "float"
498
+ specifies the type explicitly (1,1,2,4,4,8 bytes, respectively)</li>
499
+ </ul>
500
+ <p>Return value</p>
501
+ <ul>
502
+ <li>created attribute (NetCDFAtt object)</li>
503
+ </ul>
504
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
505
+ <ul>
506
+ <li>nc_put_att_&lt;type&gt;</li>
507
+ </ul></dd>
508
+ <dt><h4><a name="label:29" id="label:29"><code>def_var(<var>name</var>, <var>vartype</var>, <var>dimensions</var>)</code></a></h4></dt><!-- RDLabel: "def_var" -->
509
+ <dd>
510
+ <p>Defines a variable</p>
511
+ <p>Arguments</p>
512
+ <ul>
513
+ <li>name (String) : Name of the variable to define</li>
514
+ <li>vartype (String or Fixnum) : data type of the variable ("char", "byte", "sint",
515
+ "sint", "int", "sfloat", or "float"), or a NArray typecodes(Fixnum)</li>
516
+ <li>dimensions (Array) : Dimensions of the variable. An Array of
517
+ NetCDFDim, in the order from the fastest varying dimension to
518
+ the slowest varying one; its length becomes the rank of the
519
+ variable.</li>
520
+ </ul>
521
+ <p>Return value</p>
522
+ <ul>
523
+ <li>defined variable (NetCDFVar object)</li>
524
+ </ul>
525
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
526
+ <ul>
527
+ <li>nc_def_var</li>
528
+ </ul></dd>
529
+ <dt><h4><a name="label:30" id="label:30"><code>def_var_with_dim(<var>name</var>, <var>vartype</var>, <var>shape_ul0</var>, <var>dimnames</var>)</code></a></h4></dt><!-- RDLabel: "def_var_with_dim" -->
530
+ <dd>
531
+ <p>Same as def_var but defines dimensions first if needed.
532
+ Raise exception if it conflicts with the lengths of existing dimensions.</p>
533
+ <p>Arguments</p>
534
+ <ul>
535
+ <li>name (String) : Name of the variable to define</li>
536
+ <li>vartype (String) : data type of the variable ("char", "byte", "sint",
537
+ "sint", "int", "sfloat", or "float")</li>
538
+ <li>shape_ul0 (Array of Integer) : Shape of the variable, i.e.,
539
+ lengths of dimensions. The unlimited dimension is specified by zero.
540
+ The length of shape_ul0 determines the rank of the variable.</li>
541
+ <li>dimnames (Array of String) : Names of the dimensions. Its length
542
+ (=&gt;rank) must be equal to that of shape_ul0</li>
543
+ </ul>
544
+ <p>Return value</p>
545
+ <ul>
546
+ <li>defined variable (NetCDFVar object)</li>
547
+ </ul>
548
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
549
+ <ul>
550
+ <li>(nc_def_var)</li>
551
+ </ul></dd>
552
+ <dt><h4><a name="label:31" id="label:31"><code>var(<var>var_name</var>)</code></a></h4></dt><!-- RDLabel: "var" -->
553
+ <dd>
554
+ <p>Opens an existing variable in the file</p>
555
+ <p>Arguments</p>
556
+ <ul>
557
+ <li>var_name (String) : Name of the variable to open</li>
558
+ </ul>
559
+ <p>Return value</p>
560
+ <ul>
561
+ <li>a NetCDFVar object; nil if the variable does not exist</li>
562
+ </ul>
563
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
564
+ <ul>
565
+ <li>nc_inq_varid</li>
566
+ </ul></dd>
567
+ <dt><h4><a name="label:32" id="label:32"><code>vars(<var>names</var>)</code></a></h4></dt><!-- RDLabel: "vars" -->
568
+ <dd>
569
+ <p>Opens existing variables in the file</p>
570
+ <p>Arguments</p>
571
+ <ul>
572
+ <li>names (nil or Array of String): Names of the variables to open;
573
+ all variables are returned if nil (default).</li>
574
+ </ul>
575
+ <p>Return value</p>
576
+ <ul>
577
+ <li>Array of NetCDFVar objects; exception is raised if names has a
578
+ non-existent name</li>
579
+ </ul>
580
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
581
+ <ul>
582
+ <li>nc_inq_varid</li>
583
+ </ul></dd>
584
+ <dt><h4><a name="label:33" id="label:33"><code>dim(<var>dimension_name</var>)</code></a></h4></dt><!-- RDLabel: "dim" -->
585
+ <dd>
586
+ <p>Opens an existing dimension in the file</p>
587
+ <p>Arguments</p>
588
+ <ul>
589
+ <li>dimension_name (String) : Name of the dimension to open</li>
590
+ </ul>
591
+ <p>Return value</p>
592
+ <ul>
593
+ <li>a NetCDFDim object; nil if the dimension does not exist</li>
594
+ </ul>
595
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
596
+ <ul>
597
+ <li>nc_inq_dimid</li>
598
+ </ul></dd>
599
+ <dt><h4><a name="label:34" id="label:34"><code>dims(<var>names</var>)</code></a></h4></dt><!-- RDLabel: "dims" -->
600
+ <dd>
601
+ <p>Opens existing dimensions in the file</p>
602
+ <p>Arguments</p>
603
+ <ul>
604
+ <li>names (nil or Array of String): Names of the dimensions to open;
605
+ all dimensions are returned if nil (default).</li>
606
+ </ul>
607
+ <p>Return value</p>
608
+ <ul>
609
+ <li>Array of NetCDFDim objects; exception is raised if names has a
610
+ non-existent name</li>
611
+ </ul>
612
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
613
+ <ul>
614
+ <li>nc_inq_dimid</li>
615
+ </ul></dd>
616
+ <dt><h4><a name="label:35" id="label:35"><code>att(<var>attribute_name</var>)</code></a></h4></dt><!-- RDLabel: "att" -->
617
+ <dd>
618
+ <p>Opens an existing global attribute in the file</p>
619
+ <p>Arguments</p>
620
+ <ul>
621
+ <li>attribute_name (String) : Name of the global attribute to open</li>
622
+ </ul>
623
+ <p>Return value</p>
624
+ <ul>
625
+ <li>a NetCDFAtt object if the attribute exists; nil if not</li>
626
+ </ul>
627
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
628
+ <ul>
629
+ <li>(nc_inq_attid used for inquiry)</li>
630
+ </ul></dd>
631
+ <dt><h4><a name="label:36" id="label:36"><code>fill=(<var>filemode</var>)</code></a></h4></dt><!-- RDLabel: "fill=" -->
632
+ <dd>
633
+ <p>Sets a fill mode. (Default behavior of NetCDF is FILL.)</p>
634
+ <p>Arguments</p>
635
+ <ul>
636
+ <li>fillmode (true or false)</li>
637
+ </ul>
638
+ <p>Return value</p>
639
+ <ul>
640
+ <li>nil</li>
641
+ </ul>
642
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
643
+ <ul>
644
+ <li>nc_set_fill</li>
645
+ </ul></dd>
646
+ <dt><h4><a name="label:37" id="label:37"><code>each_dim{ ... }</code></a></h4></dt><!-- RDLabel: "each_dim" -->
647
+ <dd>
648
+ <p>Iterator regarding the dimensions in the file.
649
+ Ex.: {|i| print i.name,"\n"} prints names of all dimensions</p>
650
+ <p>Arguments</p>
651
+ <ul>
652
+ <li>{ ... } : Block for the iterator. A "do end" block is the alternative.</li>
653
+ </ul>
654
+ <p>Return value</p>
655
+ <ul>
656
+ <li>self</li>
657
+ </ul>
658
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
659
+ <ul>
660
+ <li>(dependent on nc_inq_ndims)</li>
661
+ </ul></dd>
662
+ <dt><h4><a name="label:38" id="label:38"><code>each_var{ ... }</code></a></h4></dt><!-- RDLabel: "each_var" -->
663
+ <dd>
664
+ <p>Iterator regarding the variables in the file.
665
+ Ex.: {|i| print i.name,"\n"} prints names of all variables</p>
666
+ <p>Arguments</p>
667
+ <ul>
668
+ <li>{ ... } : Block for the iterator. A "do end" block is the alternative.</li>
669
+ </ul>
670
+ <p>Return value</p>
671
+ <ul>
672
+ <li>self</li>
673
+ </ul>
674
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
675
+ <ul>
676
+ <li>(dependent on nc_inq_nvars)</li>
677
+ </ul></dd>
678
+ <dt><h4><a name="label:39" id="label:39"><code>each_att{ ... }</code></a></h4></dt><!-- RDLabel: "each_att" -->
679
+ <dd>
680
+ <p>Iterator regarding the global attributes of the file.
681
+ Ex.: {|i| print i.name,"\n"} prints names of all of them.</p>
682
+ <p>Arguments</p>
683
+ <ul>
684
+ <li>{ ... } : Block for the iterator. A "do end" block is the alternative.</li>
685
+ </ul>
686
+ <p>Return value</p>
687
+ <ul>
688
+ <li>self</li>
689
+ </ul>
690
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
691
+ <ul>
692
+ <li>(dependent on nc_inq_natts, nc_inq_attname)</li>
693
+ </ul></dd>
694
+ <dt><h4><a name="label:40" id="label:40"><code>dim_names</code></a></h4></dt><!-- RDLabel: "dim_names" -->
695
+ <dd>
696
+ <p>Returns the names of all dimensions in the file</p>
697
+ <p>Arguments</p>
698
+ <ul>
699
+ <li>(none)</li>
700
+ </ul>
701
+ <p>Return value</p>
702
+ <ul>
703
+ <li>Array of NetCDFDim</li>
704
+ </ul>
705
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
706
+ <ul>
707
+ <li>(nc_inq_ndims, nc_inq_dimname)</li>
708
+ </ul></dd>
709
+ <dt><h4><a name="label:41" id="label:41"><code>var_names</code></a></h4></dt><!-- RDLabel: "var_names" -->
710
+ <dd>
711
+ <p>Returns the names of all variables in the file</p>
712
+ <p>Arguments</p>
713
+ <ul>
714
+ <li>(none)</li>
715
+ </ul>
716
+ <p>Return value</p>
717
+ <ul>
718
+ <li>Array of String</li>
719
+ </ul>
720
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
721
+ <ul>
722
+ <li>(dependent on nc_inq_nvars, nc_inq_varname)</li>
723
+ </ul></dd>
724
+ <dt><h4><a name="label:42" id="label:42"><code>att_names</code></a></h4></dt><!-- RDLabel: "att_names" -->
725
+ <dd>
726
+ <p>Returns the names of all the global attributes of the file</p>
727
+ <p>Arguments</p>
728
+ <ul>
729
+ <li>(none)</li>
730
+ </ul>
731
+ <p>Return value</p>
732
+ <ul>
733
+ <li>Array of NetCDFAtt</li>
734
+ </ul>
735
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
736
+ <ul>
737
+ <li>(dependent on nc_inq_natts, nc_inq_attname)</li>
738
+ </ul></dd>
739
+ </dl>
740
+ <p>---------------------------------------------</p>
741
+ <h1><a name="label:43" id="label:43">class NetCDFDim</a></h1><!-- RDLabel: "class NetCDFDim" -->
742
+ <h3><a name="label:44" id="label:44">Class Methods</a></h3><!-- RDLabel: "Class Methods" -->
743
+ <h3><a name="label:45" id="label:45">Instance Methods</a></h3><!-- RDLabel: "Instance Methods" -->
744
+ <dl>
745
+ <dt><h4><a name="label:46" id="label:46"><code>length</code></a></h4></dt><!-- RDLabel: "length" -->
746
+ <dd>
747
+ <p>Returns the length of the dimension</p>
748
+ <p>Arguments</p>
749
+ <ul>
750
+ <li>(none)</li>
751
+ </ul>
752
+ <p>Return value</p>
753
+ <ul>
754
+ <li>Integer</li>
755
+ </ul>
756
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
757
+ <ul>
758
+ <li>nc_inq_dimlen</li>
759
+ </ul></dd>
760
+ <dt><h4><a name="label:47" id="label:47"><code>length_ul0</code></a></h4></dt><!-- RDLabel: "length_ul0" -->
761
+ <dd>
762
+ <p>Same as length but returns 0 for the unlimited dimension</p>
763
+ <p>Arguments</p>
764
+ <ul>
765
+ <li>(none)</li>
766
+ </ul>
767
+ <p>Return value</p>
768
+ <ul>
769
+ <li>Integer</li>
770
+ </ul>
771
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
772
+ <ul>
773
+ <li>nc_inq_dimlen</li>
774
+ </ul></dd>
775
+ <dt><h4><a name="label:48" id="label:48"><code>name=(<var>dimension_newname</var>)</code></a></h4></dt><!-- RDLabel: "name=" -->
776
+ <dd>
777
+ <p>Rename the dimension</p>
778
+ <p>Arguments</p>
779
+ <ul>
780
+ <li>dimension_newname (String) : new name</li>
781
+ </ul>
782
+ <p>Return value</p>
783
+ <ul>
784
+ <li>nil</li>
785
+ </ul>
786
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
787
+ <ul>
788
+ <li>nc_rename_dim</li>
789
+ </ul></dd>
790
+ <dt><h4><a name="label:49" id="label:49"><code>name</code></a></h4></dt><!-- RDLabel: "name" -->
791
+ <dd>
792
+ <p>Returns the name of the dimension</p>
793
+ <p>Arguments</p>
794
+ <ul>
795
+ <li>(none)</li>
796
+ </ul>
797
+ <p>Return value</p>
798
+ <ul>
799
+ <li>String</li>
800
+ </ul>
801
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
802
+ <ul>
803
+ <li>nc_inq_dimname</li>
804
+ </ul></dd>
805
+ <dt><h4><a name="label:50" id="label:50"><code>unlimited?</code></a></h4></dt><!-- RDLabel: "unlimited?" -->
806
+ <dd>
807
+ <p>Inquires whether the dimension is unlimited or not</p>
808
+ <p>Arguments</p>
809
+ <ul>
810
+ <li>(none)</li>
811
+ </ul>
812
+ <p>Return value</p>
813
+ <ul>
814
+ <li>true or false</li>
815
+ </ul>
816
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
817
+ <ul>
818
+ <li>(dependent on nc_inq_unlimdim)</li>
819
+ </ul></dd>
820
+ </dl>
821
+ <p>---------------------------------------------</p>
822
+ <h1><a name="label:51" id="label:51">class NetCDFVar</a></h1><!-- RDLabel: "class NetCDFVar" -->
823
+ <h3><a name="label:52" id="label:52">Class Methods</a></h3><!-- RDLabel: "Class Methods" -->
824
+ <dl>
825
+ <dt><h4><a name="label:53" id="label:53"><code>NetCDFVar.new(<var>file</var>,<var>varname</var>,<var>mode</var>="<var>r</var>",<var>share</var>=<var>false</var>)</code></a></h4></dt><!-- RDLabel: "NetCDFVar.new" -->
826
+ <dd>
827
+ <p>open a NetCDF variable. This can also be done with NetCDF#var
828
+ (instance method of NetCDF class), which is recommended over
829
+ this method.</p>
830
+ <p>Arguments</p>
831
+ <ul>
832
+ <li>file (NetCDF or String) : a NetCDF file object (NetCDF)
833
+ or the path of a NetCDF file (String).</li>
834
+ <li>varname (String) : name of the variable in the file</li>
835
+ <li>mode (String) : IO mode -- used if file is a String (see NetCDF.open)</li>
836
+ <li>share (true or false) : Whether to use the "shared" mode or
837
+ not -- used if file is a String (see NetCDF.open)</li>
838
+ </ul>
839
+ <p>Return value</p>
840
+ <ul>
841
+ <li>a NetCDFVar object</li>
842
+ </ul>
843
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF </p>
844
+ <ul>
845
+ <li>(dependent on nc_open, nc_create, nc_inq_varid etc.)</li>
846
+ </ul></dd>
847
+ <dt><h4><a name="label:54" id="label:54"><code>NetCDFVar.unpack_type=(<var>na_type</var>)</code></a></h4></dt><!-- RDLabel: "NetCDFVar.unpack_type=" -->
848
+ <dd>
849
+ <p>Fix the NArray type to be used in <a href="#label:81">unpack</a>.</p>
850
+ <p>Arguments</p>
851
+ <ul>
852
+ <li>na_type (Integer) : NArray::BYTE, NArray::SINT, NArray::INT,
853
+ NArray::SFLOAT, or NArray::FLOAT</li>
854
+ </ul>
855
+ <p>Return value</p>
856
+ <ul>
857
+ <li>na_type (the argument)</li>
858
+ </ul></dd>
859
+ <dt><h4><a name="label:55" id="label:55"><code>NetCDFVar.unpack_type</code></a></h4></dt><!-- RDLabel: "NetCDFVar.unpack_type" -->
860
+ <dd>
861
+ <p>Returns the NArray type set by <a href="#label:54">NetCDFVar.unpack_type=</a>.</p>
862
+ <p>Return value</p>
863
+ <ul>
864
+ <li>nil, NArray::BYTE, NArray::SINT, NArray::INT,
865
+ NArray::SFLOAT, or NArray::FLOAT</li>
866
+ </ul></dd>
867
+ </dl>
868
+ <h3><a name="label:56" id="label:56">Instance Methods</a></h3><!-- RDLabel: "Instance Methods" -->
869
+ <dl>
870
+ <dt><h4><a name="label:57" id="label:57"><code>dim(<var>dim_num</var>)</code></a></h4></dt><!-- RDLabel: "dim" -->
871
+ <dd>
872
+ <p>Inquires the dim_num-th dimension of the variable (dim_num=0,1,2,..)</p>
873
+ <p>Arguments</p>
874
+ <ul>
875
+ <li>dim_num (Fixnum) : 0,1,... 0 is the fastest varying dimension.</li>
876
+ </ul>
877
+ <p>Return value</p>
878
+ <ul>
879
+ <li>a NetCDFDim object</li>
880
+ </ul>
881
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
882
+ <ul>
883
+ <li>(dependent on nc_inq_vardimid)</li>
884
+ </ul></dd>
885
+ <dt><h4><a name="label:58" id="label:58"><code>dims</code></a></h4></dt><!-- RDLabel: "dims" -->
886
+ <dd>
887
+ <p>Returns an array of all the dimensions of the variable</p>
888
+ <p>Arguments</p>
889
+ <ul>
890
+ <li>(none)</li>
891
+ </ul>
892
+ <p>Return value</p>
893
+ <ul>
894
+ <li>Array of NetCDFDim objects.</li>
895
+ </ul>
896
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
897
+ <ul>
898
+ <li>nc_inq_vardimid</li>
899
+ </ul></dd>
900
+ <dt><h4><a name="label:59" id="label:59"><code>shape_ul0</code></a></h4></dt><!-- RDLabel: "shape_ul0" -->
901
+ <dd>
902
+ <p>Returns the shape of the variable, but the length of the unlimited dimension is set to zero.
903
+ Good to define another variable.</p>
904
+ <p>Arguments</p>
905
+ <ul>
906
+ <li>(none)</li>
907
+ </ul>
908
+ <p>Return value</p>
909
+ <ul>
910
+ <li>Array. [length of 0th dim, length of 1st dim,.. ]</li>
911
+ </ul>
912
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
913
+ <ul>
914
+ <li>(dependent on nc_inq_vardimid, nc_inq_unlimdim etc)</li>
915
+ </ul></dd>
916
+ <dt><h4><a name="label:60" id="label:60"><code>shape_current</code></a></h4></dt><!-- RDLabel: "shape_current" -->
917
+ <dd>
918
+ <p>Returns the current shape of the variable.</p>
919
+ <p>Arguments</p>
920
+ <ul>
921
+ <li>(none)</li>
922
+ </ul>
923
+ <p>Return value</p>
924
+ <ul>
925
+ <li>Array. [length of 0th dim, length of 1st dim,.. ]</li>
926
+ </ul>
927
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
928
+ <ul>
929
+ <li>(dependent on nc_inq_vardimid etc)</li>
930
+ </ul></dd>
931
+ <dt><h4><a name="label:61" id="label:61"><code>each_att{ ... }</code></a></h4></dt><!-- RDLabel: "each_att" -->
932
+ <dd>
933
+ <p>Iterator regarding the global attributes of the variables.
934
+ Ex.: {|i| print i.name,"\n"} prints names of all of them.</p>
935
+ <p>Arguments</p>
936
+ <ul>
937
+ <li>{ ... } : Block for the iterator. A "do end" block is the alternative.</li>
938
+ </ul>
939
+ <p>Return value</p>
940
+ <ul>
941
+ <li>self</li>
942
+ </ul>
943
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
944
+ <ul>
945
+ <li>(dependent on nc_inq_natts, nc_inq_attname)</li>
946
+ </ul></dd>
947
+ <dt><h4><a name="label:62" id="label:62"><code>dim_names</code></a></h4></dt><!-- RDLabel: "dim_names" -->
948
+ <dd>
949
+ <p>Returns the names of all the dimensions of the variable</p>
950
+ <p>Arguments</p>
951
+ <ul>
952
+ <li>(none)</li>
953
+ </ul>
954
+ <p>Return value</p>
955
+ <ul>
956
+ <li>Array of String</li>
957
+ </ul>
958
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
959
+ <ul>
960
+ <li>(dependent on nc_inq_varndims, nc_inq_vardimid, nc_inq_dimname)</li>
961
+ </ul></dd>
962
+ <dt><h4><a name="label:63" id="label:63"><code>att_names</code></a></h4></dt><!-- RDLabel: "att_names" -->
963
+ <dd>
964
+ <p>Returns the names of all the attributes of the variable</p>
965
+ <p>Arguments</p>
966
+ <ul>
967
+ <li>(none)</li>
968
+ </ul>
969
+ <p>Return value</p>
970
+ <ul>
971
+ <li>Array of String</li>
972
+ </ul>
973
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
974
+ <ul>
975
+ <li>(dependent on nc_inq_natts, nc_inq_attname)</li>
976
+ </ul></dd>
977
+ <dt><h4><a name="label:64" id="label:64"><code>name</code></a></h4></dt><!-- RDLabel: "name" -->
978
+ <dd>
979
+ <p>Returns the name of the variable</p>
980
+ <p>Arguments</p>
981
+ <ul>
982
+ <li>(none)</li>
983
+ </ul>
984
+ <p>Return value</p>
985
+ <ul>
986
+ <li>String</li>
987
+ </ul>
988
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
989
+ <ul>
990
+ <li>nc_inq_varname</li>
991
+ </ul></dd>
992
+ <dt><h4><a name="label:65" id="label:65"><code>name=(<var>variable_newname</var>)</code></a></h4></dt><!-- RDLabel: "name=" -->
993
+ <dd>
994
+ <p>Rename the variable</p>
995
+ <p>Arguments</p>
996
+ <ul>
997
+ <li>variable_newname (String) : new name</li>
998
+ </ul>
999
+ <p>Return value</p>
1000
+ <ul>
1001
+ <li>nil</li>
1002
+ </ul>
1003
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1004
+ <ul>
1005
+ <li>nc_rename_var</li>
1006
+ </ul></dd>
1007
+ <dt><h4><a name="label:66" id="label:66"><code>ndims</code></a></h4></dt><!-- RDLabel: "ndims" -->
1008
+ <dd>
1009
+ <p>Number of dimensions of the variable (which is rank of the variable).</p>
1010
+ <p>Arguments</p>
1011
+ <ul>
1012
+ <li>(none)</li>
1013
+ </ul>
1014
+ <p>Return value</p>
1015
+ <ul>
1016
+ <li>Integer</li>
1017
+ </ul>
1018
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1019
+ <ul>
1020
+ <li>nc_inq_varndims</li>
1021
+ </ul></dd>
1022
+ <dt><h4><a name="label:67" id="label:67"><code>rank</code></a></h4></dt><!-- RDLabel: "rank" -->
1023
+ <dd>
1024
+ <p>Aliased to ndims</p></dd>
1025
+ <dt><h4><a name="label:68" id="label:68"><code>ntype</code></a></h4></dt><!-- RDLabel: "ntype" -->
1026
+ <dd>
1027
+ <p>Aliased to vartype</p></dd>
1028
+ <dt><h4><a name="label:69" id="label:69"><code>vartype</code></a></h4></dt><!-- RDLabel: "vartype" -->
1029
+ <dd>
1030
+ <p>Inquires the data value type of the variable</p>
1031
+ <p>Arguments</p>
1032
+ <ul>
1033
+ <li>(none)</li>
1034
+ </ul>
1035
+ <p>Return value</p>
1036
+ <ul>
1037
+ <li>String ("char","byte","sint","int","sfloat", or "float")</li>
1038
+ </ul>
1039
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1040
+ <ul>
1041
+ <li>nc_inq_vartype</li>
1042
+ </ul></dd>
1043
+ <dt><h4><a name="label:70" id="label:70"><code>typecode</code></a></h4></dt><!-- RDLabel: "typecode" -->
1044
+ <dd>
1045
+ <p>Inquires the data type of the variable (returns a typecode of NArray)</p>
1046
+ <p>Arguments</p>
1047
+ <ul>
1048
+ <li>(none)</li>
1049
+ </ul>
1050
+ <p>Return value</p>
1051
+ <ul>
1052
+ <li>a Fixnum (NArray:BYTE, NArray:SINT, NArray:LINT, NArray:SFLOAT, NArray:SFLOAT, NArray:DFLOAT)</li>
1053
+ </ul>
1054
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1055
+ <ul>
1056
+ <li>nc_inq_vartype</li>
1057
+ </ul></dd>
1058
+ <dt><h4><a name="label:71" id="label:71"><code>natts</code></a></h4></dt><!-- RDLabel: "natts" -->
1059
+ <dd>
1060
+ <p>Returns the number of the attributes of the variable</p>
1061
+ <p>Arguments</p>
1062
+ <ul>
1063
+ <li>(none)</li>
1064
+ </ul>
1065
+ <p>Return value</p>
1066
+ <ul>
1067
+ <li>Integer</li>
1068
+ </ul>
1069
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1070
+ <ul>
1071
+ <li>nc_inq_varnatts</li>
1072
+ </ul></dd>
1073
+ <dt><h4><a name="label:72" id="label:72"><code>file</code></a></h4></dt><!-- RDLabel: "file" -->
1074
+ <dd>
1075
+ <p>Inquires the file that the variable is in</p>
1076
+ <p>Arguments</p>
1077
+ <ul>
1078
+ <li>(none)</li>
1079
+ </ul>
1080
+ <p>Return value</p>
1081
+ <ul>
1082
+ <li>a NetCDF object</li>
1083
+ </ul>
1084
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1085
+ <ul>
1086
+ <li>(none)</li>
1087
+ </ul></dd>
1088
+ <dt><h4><a name="label:73" id="label:73"><code>att(<var>attribute_name</var>)</code></a></h4></dt><!-- RDLabel: "att" -->
1089
+ <dd>
1090
+ <p>Returns the attribute specified by its name</p>
1091
+ <p>Arguments</p>
1092
+ <ul>
1093
+ <li>attribute_name (String) : Name of the attribute</li>
1094
+ </ul>
1095
+ <p>Return value</p>
1096
+ <ul>
1097
+ <li>a NetCDFAtt object if the attribute exists; nil if not</li>
1098
+ </ul>
1099
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1100
+ <ul>
1101
+ <li>(nc_inq_attid is used for inquiry)</li>
1102
+ </ul></dd>
1103
+ <dt><h4><a name="label:74" id="label:74"><code>put_att(<var>attribute_name</var>, <var>value</var>, <var>atttype</var>=<var>nil</var>)</code></a></h4></dt><!-- RDLabel: "put_att" -->
1104
+ <dd>
1105
+ <p>Sets an attribute</p>
1106
+ <p>Arguments</p>
1107
+ <ul>
1108
+ <li>attribute_name (String) : name of the attribute</li>
1109
+ <li>value (Numeric, String, Array of Numeric, or NArray) : value of the attribute</li>
1110
+ <li>atttype (nil or String) : data type of the attribute value.
1111
+ nil lets it automatically determined from the value.
1112
+ "char" (="string"), "byte", "sint", "int", "sfloat", or "float"
1113
+ specifies the type explicitly (1,1,2,4,4,8 bytes, respectively)</li>
1114
+ </ul>
1115
+ <p>Return value</p>
1116
+ <ul>
1117
+ <li>a NetCDFAtt object</li>
1118
+ </ul>
1119
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1120
+ <ul>
1121
+ <li>nc_put_att_&lt;type&gt;</li>
1122
+ </ul></dd>
1123
+ <dt><h4><a name="label:75" id="label:75"><code>put(<var>value</var>, <var>option</var>=<var>nil</var>)</code></a></h4></dt><!-- RDLabel: "put" -->
1124
+ <dd>
1125
+ <p>Aliased to <a href="#label:76">simple_put</a></p></dd>
1126
+ <dt><h4><a name="label:76" id="label:76"><code>simple_put(<var>value</var>, <var>option</var>=<var>nil</var>)</code></a></h4></dt><!-- RDLabel: "simple_put" -->
1127
+ <dd>
1128
+ <p>Set the values of the variable</p>
1129
+ <p>Arguments</p>
1130
+ <ul>
1131
+ <li>value : value to set (Numeric, Array of Numeric (1D only), or
1132
+ NArray (possibly multi-D)). If it is a Numeric or length==1, the value
1133
+ is set uniformly.</li>
1134
+ <li><p>option (Hash) : Optional argument to limit the portion of the
1135
+ variable to output values. If omitted, the whole variable is
1136
+ subject to the output. This argument accepts a Hash whose keys
1137
+ contain either "index" or a combination of "start","end", and
1138
+ "stride". The value of "index" points the index of a scalar
1139
+ portion of the variable. The other case is used to designate a
1140
+ regularly ordered subset, where "start" and "end" specifies
1141
+ bounds in each dimension and "stride" specifies intervals in
1142
+ it. As in Array "start", "end", and "index" can take negative
1143
+ values to specify index backward from the end. However,
1144
+ "stride" has to be positive, so reversing the array must be
1145
+ done afterwards if you like.</p>
1146
+ <p>Example: If the variable is 2D:</p>
1147
+ <p>{"start"=&gt;[2,5],"end"=&gt;[6,-1],"stride"=&gt;[2,4]} -- Specifies a
1148
+ subset made as follows: the 1st dimension from the element 2
1149
+ to the element 6 (note that the count starts with 0, so that
1150
+ the element 2 is the 3rd one) with an interval of 2;
1151
+ the 2nd dimension from the element 6 to the last element
1152
+ (designated by -1) with an interval of 5.</p>
1153
+ <p>{"index"=&gt;[0,0]}: Scalar of the fist element</p>
1154
+ <p>{"index"=&gt;[0,-2]}: Scalar from the 1st element of with
1155
+ respect to the 1st dimension and the 2nd element from the last
1156
+ with respect to the 2nd dimension</p></li>
1157
+ </ul>
1158
+ <p>Return value</p>
1159
+ <ul>
1160
+ <li>nil</li>
1161
+ </ul>
1162
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1163
+ <ul>
1164
+ <li>nc_put_var_&lt;type&gt;, nc_put_vars_&lt;type&gt;, nc_put_var1_&lt;type&gt;</li>
1165
+ </ul></dd>
1166
+ <dt><h4><a name="label:77" id="label:77"><code>pack(<var>na</var>)</code></a></h4></dt><!-- RDLabel: "pack" -->
1167
+ <dd>
1168
+ <p>Pack a NArray (etc) using the attributes scale_factor and/or add_offset of self.</p>
1169
+ <p>If scale_factor and/or add_offset is defined, returns
1170
+ (na-add_offset)/scale_factor. Returns na if not.</p>
1171
+ <p>Arguments</p>
1172
+ <ul>
1173
+ <li>na : a numeric array to pack (NArray, NArrayMiss, or Array)</li>
1174
+ </ul>
1175
+ <p>Return value</p>
1176
+ <ul>
1177
+ <li>a NArray or NArrayMiss</li>
1178
+ </ul></dd>
1179
+ <dt><h4><a name="label:78" id="label:78"><code>scaled_put(<var>value</var>, <var>option</var>=<var>nil</var>)</code></a></h4></dt><!-- RDLabel: "scaled_put" -->
1180
+ <dd>
1181
+ <p>Same as <a href="#label:76">simple_put</a> but interprets the attributes scale_factor and/or add_offset using <a href="#label:77">pack</a>.</p>
1182
+ <p>See the document for <a href="#label:76">simple_put</a> for arguments etc.</p></dd>
1183
+ <dt><h4><a name="label:79" id="label:79"><code>get(<var>option</var>=<var>nil</var>)</code></a></h4></dt><!-- RDLabel: "get" -->
1184
+ <dd>
1185
+ <p>Aliased to <a href="#label:80">simple_get</a>.</p></dd>
1186
+ <dt><h4><a name="label:80" id="label:80"><code>simple_get(<var>option</var>=<var>nil</var>)</code></a></h4></dt><!-- RDLabel: "simple_get" -->
1187
+ <dd>
1188
+ <p>Returns values of the variable</p>
1189
+ <p>Arguments</p>
1190
+ <ul>
1191
+ <li>option (Hash) : Optional argument to limit the portion of the
1192
+ variable to get values. Its usage is the same as in the method
1193
+ put.</li>
1194
+ </ul>
1195
+ <p>Return value</p>
1196
+ <ul>
1197
+ <li>an NArray object</li>
1198
+ </ul>
1199
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1200
+ <ul>
1201
+ <li>nc_get_var_&lt;type&gt;, nc_get_vars_&lt;type&gt;, nc_get_var1_&lt;type&gt;</li>
1202
+ </ul></dd>
1203
+ <dt><h4><a name="label:81" id="label:81"><code>unpack(<var>na</var>)</code></a></h4></dt><!-- RDLabel: "unpack" -->
1204
+ <dd>
1205
+ <p>Unpack a NArray (etc) using the attributes scale_factor and/or add_offset of self.</p>
1206
+ <p>If scale_factor and/or add_offset is defined, returns
1207
+ na * scale_factor + add_offset. Returns na if not.
1208
+ Type conversion is made by the coercing -- for example
1209
+ if na is sint and scale_factor and add_offset is sfloat,
1210
+ return value is sfloat. The type of the return value can be specified
1211
+ explicitly with <a href="#label:54">NetCDFVar.unpack_type=</a>.</p>
1212
+ <p>Arguments</p>
1213
+ <ul>
1214
+ <li>na : a numeric array to unpack (NArray, or NArrayMiss)</li>
1215
+ </ul>
1216
+ <p>Return value</p>
1217
+ <ul>
1218
+ <li>a NArray or NArrayMiss</li>
1219
+ </ul></dd>
1220
+ <dt><h4><a name="label:82" id="label:82"><code>scaled_get(<var>option</var>=<var>nil</var>)</code></a></h4></dt><!-- RDLabel: "scaled_get" -->
1221
+ <dd>
1222
+ <p>Same as <a href="#label:80">simple_get</a> but interprets the attributes scale_factor and/or add_offset using <a href="#label:81">unpack</a>.</p>
1223
+ <p>See the document for <a href="#label:80">simple_get</a> for arguments etc.</p></dd>
1224
+ <dt><h4><a name="label:83" id="label:83"><code>[]</code></a></h4></dt><!-- RDLabel: "[]" -->
1225
+ <dd>
1226
+ <p>Same as NetCDFVar#get but a subset is specified as in the method [] of NArray. </p>
1227
+ <p>In addition to the subset specifications supported by NArray,
1228
+ ranges with steps are supported, which is specified
1229
+ like {0..-1, 3}, i.e., a 1-element Hash with the key and value
1230
+ representing the range (Range) and the step (Integer), respectively.
1231
+ Unlike NArray, 1-dimensional indexing of multi-dimensional
1232
+ variables is not support.</p></dd>
1233
+ <dt><h4><a name="label:84" id="label:84"><code>[] = </code></a></h4></dt><!-- RDLabel: "[]=" -->
1234
+ <dd>
1235
+ <p>Same as NetCDFVar#put but a subset is specified as in the method []= of NArray. </p>
1236
+ <p>In addition to the subset specifications supported by NArray,
1237
+ ranges with steps are supported, which is specified
1238
+ like {0..-1, 3}, i.e., a 1-element Hash with the key and value
1239
+ representing the range (Range) and the step (Integer), respectively.
1240
+ Unlike NArray, 1-dimensional indexing of multi-dimensional
1241
+ variables is not support.</p></dd>
1242
+ </dl>
1243
+ <h3><a name="label:85" id="label:85">Instance Methods added by requiring "numru/netcdf_miss"</a></h3><!-- RDLabel: "Instance Methods added by requiring "numru/netcdf_miss"" -->
1244
+ <dl>
1245
+ <dt><h4><a name="label:86" id="label:86"><code>get_with_miss(<var>option</var>=<var>nil</var>)</code></a></h4></dt><!-- RDLabel: "get_with_miss" -->
1246
+ <dd>
1247
+ <p>Same as <a href="#label:79">get</a> but interprets data missing.</p>
1248
+ <p>Data missing is specified by the standard attributes valid_range,
1249
+ (valid_min and/or valid_max), or missing_value, with the precedence being
1250
+ this order. Unlike the
1251
+ recommendation in the NetCDF User's guide, missing_value is
1252
+ interpreted if present. If missing_value and valid_* present
1253
+ simultaneously, missing_value must be outside the valid range.
1254
+ Otherwise, exception is raised.</p>
1255
+ <p>If data missing is specified as stated above, this method returns a NArrayMiss.
1256
+ If not, it returns a NArray. Thus, you can use this whether
1257
+ data missing is defined or not. </p>
1258
+ <p>Arguments</p>
1259
+ <ul>
1260
+ <li>See <a href="#label:79">get</a>.</li>
1261
+ </ul>
1262
+ <p>Return value</p>
1263
+ <ul>
1264
+ <li>an NArrayMiss (if data missing is specified) or an NArray
1265
+ (if data missing is NOT specified)</li>
1266
+ </ul>
1267
+ <p>Possible exception in addition to NetcdfError.</p>
1268
+ <ul>
1269
+ <li>missing_value is in the valid range (see above).</li>
1270
+ </ul>
1271
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1272
+ <ul>
1273
+ <li>See <a href="#label:79">get</a>. This method is written in Ruby.</li>
1274
+ </ul>
1275
+ <p>EXAMPLE</p>
1276
+ <ul>
1277
+ <li><p>The following is an example to replace <a href="#label:79">get</a> with <a href="#label:86">get_with_miss</a>.
1278
+ It will also make <a href="#label:83">[]</a> interpret data missing,
1279
+ since it calls <code>get</code> internally.</p>
1280
+ <pre>file = NetCDF.open('hogehoge.nc')
1281
+ var = file.var('var')
1282
+ def var.get(*args); get_with_miss(*args); end
1283
+ p var.get # --&gt; interprets data missing if defined
1284
+ p var[0..-1,0] # --&gt; interprets data missing if defined (assumed 2D)</pre></li>
1285
+ </ul></dd>
1286
+ <dt><h4><a name="label:87" id="label:87"><code>get_with_miss_and_scaling(<var>option</var>=<var>nil</var>)</code></a></h4></dt><!-- RDLabel: "get_with_miss_and_scaling" -->
1287
+ <dd>
1288
+ <p>Same as <a href="#label:86">get_with_miss</a> but handles data scaling too using <a href="#label:81">unpack</a>.</p>
1289
+ <p>Missing data handling using valid_* / missing_value is applied
1290
+ basically to packed data, which is consistent with most
1291
+ conventions. However, it is applied to unpacked data
1292
+ if and only if the type of valid_* / missing_value is not the same as
1293
+ the packed data and is the samed as the unpacked data.
1294
+ This treatment can handle all conventions.</p>
1295
+ <p>EXAMPLE</p>
1296
+ <ul>
1297
+ <li>See above. The same thing applies.</li>
1298
+ </ul></dd>
1299
+ <dt><h4><a name="label:88" id="label:88"><code>put_with_miss(<var>value</var>, <var>option</var>=<var>nil</var>)</code></a></h4></dt><!-- RDLabel: "put_with_miss" -->
1300
+ <dd>
1301
+ <p>Same as <a href="#label:75">put</a> but interprets data missing.</p>
1302
+ <p>If <code>value</code> is an NArray, the methods behaves as <a href="#label:75">put</a>.
1303
+ Data missing in <code>value</code> is interpreted if it is an NArrayMiss
1304
+ and data missing is specified by attributes in <code>self</code>
1305
+ (see <a href="#label:86">get_with_miss</a> ).
1306
+ Namely, the data which are "invalid" in the <code>value</code> is replaced
1307
+ with a missing value when written in the file.
1308
+ (missing_value or _FillValue or a value outside
1309
+ the valid range). No check is made whether "valid" values in the
1310
+ NArrayMiss is within the valid range of <code>self</code>.</p>
1311
+ <p>Arguments</p>
1312
+ <ul>
1313
+ <li>value : NArrayMiss or what is allowed in <a href="#label:75">put</a>.</li>
1314
+ <li>option (Hash) : See <a href="#label:75">put</a>.</li>
1315
+ </ul>
1316
+ <p>Return value</p>
1317
+ <ul>
1318
+ <li>nil</li>
1319
+ </ul>
1320
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1321
+ <ul>
1322
+ <li>See <a href="#label:75">put</a>. This method is written in Ruby.</li>
1323
+ </ul>
1324
+ <p>EXAMPLE</p>
1325
+ <ul>
1326
+ <li><p>The following is an example to replace <a href="#label:75">put</a> with <a href="#label:88">put_with_miss</a>.
1327
+ It will also make <a href="#label:84">[]=</a> interpret data missing,
1328
+ since it calls <code>put</code> internally.</p>
1329
+ <pre>file = NetCDF.open('hogehoge.nc')
1330
+ var = file.var('var')
1331
+ def var.put(*args); put_with_miss(*args); end
1332
+ var.put = narray_miss # --&gt; interprets data missing if defined
1333
+ var[0..-1,0] = narray_miss # --&gt; interprets data missing if defined (assumed 2D)</pre></li>
1334
+ </ul></dd>
1335
+ <dt><h4><a name="label:89" id="label:89"><code>put_with_miss_and_scaling(<var>value</var>, <var>option</var>=<var>nil</var>)</code></a></h4></dt><!-- RDLabel: "put_with_miss_and_scaling" -->
1336
+ <dd>
1337
+ <p>Same as <a href="#label:88">put_with_miss</a> but handles data scaling too using <a href="#label:77">pack</a>.</p>
1338
+ <p>Missing data handling using valid_* / missing_value is applied
1339
+ basically to packed data, which is consistent with most
1340
+ conventions. However, it is applied to unpacked data
1341
+ if and only if the type of valid_* / missing_value is not the same as
1342
+ the packed data and is the samed as the unpacked data.
1343
+ This treatment can handle all conventions.</p>
1344
+ <p>EXAMPLE</p>
1345
+ <ul>
1346
+ <li>See above. The same thing applies.</li>
1347
+ </ul></dd>
1348
+ </dl>
1349
+ <p>---------------------------------------------</p>
1350
+ <h1><a name="label:90" id="label:90">class NetCDFAtt</a></h1><!-- RDLabel: "class NetCDFAtt" -->
1351
+ <h3><a name="label:91" id="label:91">Class Methods</a></h3><!-- RDLabel: "Class Methods" -->
1352
+ <h3><a name="label:92" id="label:92">Instance Methods</a></h3><!-- RDLabel: "Instance Methods" -->
1353
+ <dl>
1354
+ <dt><h4><a name="label:93" id="label:93"><code>name</code></a></h4></dt><!-- RDLabel: "name" -->
1355
+ <dd>
1356
+ <p>Returns the name of the attribute</p>
1357
+ <p>Arguments</p>
1358
+ <ul>
1359
+ <li>(none)</li>
1360
+ </ul>
1361
+ <p>Return value</p>
1362
+ <ul>
1363
+ <li>String</li>
1364
+ </ul>
1365
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1366
+ <ul>
1367
+ <li>(none)</li>
1368
+ </ul></dd>
1369
+ <dt><h4><a name="label:94" id="label:94"><code>name=(<var>attribute_newname</var>)</code></a></h4></dt><!-- RDLabel: "name=" -->
1370
+ <dd>
1371
+ <p>Rename the attribute</p>
1372
+ <p>Arguments</p>
1373
+ <ul>
1374
+ <li>attribute_newname (String) : New name</li>
1375
+ </ul>
1376
+ <p>Return value</p>
1377
+ <ul>
1378
+ <li>nil</li>
1379
+ </ul>
1380
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1381
+ <ul>
1382
+ <li>nc_rename_att</li>
1383
+ </ul></dd>
1384
+ <dt><h4><a name="label:95" id="label:95"><code>copy(<var>var_or_file</var>)</code></a></h4></dt><!-- RDLabel: "copy" -->
1385
+ <dd>
1386
+ <p>Copies an attribute to a variable or a file. If file, becomes an global attribute</p>
1387
+ <p>Arguments</p>
1388
+ <ul>
1389
+ <li>var_or_file (NetCDFVar or NetCDF)</li>
1390
+ </ul>
1391
+ <p>Return value</p>
1392
+ <ul>
1393
+ <li>Resultant new attribute (NetCDFAtt)</li>
1394
+ </ul>
1395
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1396
+ <ul>
1397
+ <li>nc_copy_att</li>
1398
+ </ul></dd>
1399
+ <dt><h4><a name="label:96" id="label:96"><code>delete</code></a></h4></dt><!-- RDLabel: "delete" -->
1400
+ <dd>
1401
+ <p>Delete an attribute</p>
1402
+ <p>Arguments</p>
1403
+ <ul>
1404
+ <li>(none)</li>
1405
+ </ul>
1406
+ <p>Return value</p>
1407
+ <ul>
1408
+ <li>nil</li>
1409
+ </ul>
1410
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1411
+ <ul>
1412
+ <li>nc_del_att</li>
1413
+ </ul></dd>
1414
+ <dt><h4><a name="label:97" id="label:97"><code>put(<var>value</var>, <var>atttype</var>=<var>nil</var>)</code></a></h4></dt><!-- RDLabel: "put" -->
1415
+ <dd>
1416
+ <p>Sets the value of the attribute</p>
1417
+ <p>Arguments</p>
1418
+ <ul>
1419
+ <li>value (Numeric, String, Array of Numeric, or NArray) : value of the attribute</li>
1420
+ <li>atttype (nil or String) : data type of the attribute value.
1421
+ nil lets it automatically determined from the value.
1422
+ "char" (="string"), "byte", "sint", "int", "sfloat", or "float"
1423
+ specifies the type explicitly (1,1,2,4,4,8 bytes, respectively)</li>
1424
+ </ul>
1425
+ <p>Return value</p>
1426
+ <ul>
1427
+ <li>nil</li>
1428
+ </ul>
1429
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1430
+ <ul>
1431
+ <li>nc_put_att_&lt;type&gt;</li>
1432
+ </ul></dd>
1433
+ <dt><h4><a name="label:98" id="label:98"><code>get</code></a></h4></dt><!-- RDLabel: "get" -->
1434
+ <dd>
1435
+ <p>Returns the values of the attribute</p>
1436
+ <p>Arguments</p>
1437
+ <ul>
1438
+ <li>(none)</li>
1439
+ </ul>
1440
+ <p>Return value</p>
1441
+ <ul>
1442
+ <li>String or an NArray object (NOTE: even a scalar is returned as
1443
+ an NArray of length 1)</li>
1444
+ </ul>
1445
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1446
+ <ul>
1447
+ <li>nc_get_att_&lt;type&gt;</li>
1448
+ </ul></dd>
1449
+ <dt><h4><a name="label:99" id="label:99"><code>atttype</code></a></h4></dt><!-- RDLabel: "atttype" -->
1450
+ <dd>
1451
+ <p>Inquires the type of attribute values</p>
1452
+ <p>Arguments</p>
1453
+ <ul>
1454
+ <li>(none)</li>
1455
+ </ul>
1456
+ <p>Return value</p>
1457
+ <ul>
1458
+ <li>"char","byte","sint","int","sfloat","float"</li>
1459
+ </ul>
1460
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1461
+ <ul>
1462
+ <li>nc_inq_atttype</li>
1463
+ </ul></dd>
1464
+ <dt><h4><a name="label:100" id="label:100"><code>atttype</code></a></h4></dt><!-- RDLabel: "atttype" -->
1465
+ <dd>
1466
+ <p>Inquires the type of attribute values (returns a NArray typecode)</p>
1467
+ <p>Arguments</p>
1468
+ <ul>
1469
+ <li>(none)</li>
1470
+ </ul>
1471
+ <p>Return value</p>
1472
+ <ul>
1473
+ <li>a Fixnum (NArray:BYTE, NArray:SINT, NArray:LINT, NArray:SFLOAT, NArray:SFLOAT, NArray:DFLOAT)</li>
1474
+ </ul>
1475
+ <p>Corresponding (dependent) function(s) in the C library of NetCDF</p>
1476
+ <ul>
1477
+ <li>nc_inq_atttype</li>
1478
+ </ul></dd>
1479
+ </dl>
1480
+
1481
+ </body>
1482
+ </html>