carray-netcdf 1.0.0
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/API.html +238 -0
- data/API.md +270 -0
- data/README.md +3 -0
- data/carray-netcdf.gemspec +23 -0
- data/examples/test.rb +1 -0
- data/extconf.rb +11 -0
- data/lib/carray-netcdf.rb +2 -0
- data/lib/io/netcdf.rb +533 -0
- data/rb_netcdflib.c +1914 -0
- metadata +52 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9ce02ff5fab4bb7e3920bd11317c9709e68d56ce
|
4
|
+
data.tar.gz: 78f48636de46a5b1bd7f91b11747b76033bd1f79
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 57f23cc65af411dc64aeedca1276659afc198e57b7bbc914eb9f26d42746b00ce4815b3d2ad0efcdba331f11b42f09e9e6e156cf5ab212cbe5805feb0388f3d5
|
7
|
+
data.tar.gz: 13852779407b6cd82d3fa1960d3f29bfe6b15cf53728b6dd641d8c183a8d02b979575a4f18c60a06b67b4012e6c1cd56521d340ce02e5c5c0a89f67ee9d12bc8
|
data/API.html
ADDED
@@ -0,0 +1,238 @@
|
|
1
|
+
|
2
|
+
<html>
|
3
|
+
<head><title>API.md</title></head>
|
4
|
+
<body>
|
5
|
+
<h1>CArray/NetCDF library API document</h1>
|
6
|
+
|
7
|
+
<h2>1. Loading library</h2>
|
8
|
+
|
9
|
+
<pre><code>gem install carray-netcdf
|
10
|
+
|
11
|
+
require "carray-netcdf"
|
12
|
+
</code></pre>
|
13
|
+
|
14
|
+
<h2>2. Methods </h2>
|
15
|
+
|
16
|
+
<p>This API provides the way of calling functions</p>
|
17
|
+
|
18
|
+
<pre><code>include NC
|
19
|
+
nc_funcname(...)
|
20
|
+
|
21
|
+
NC.funcname(...)
|
22
|
+
</code></pre>
|
23
|
+
|
24
|
+
<h3>2.1. Data types</h3>
|
25
|
+
|
26
|
+
<pre><code>data_type = NC.ca_type(xtype)
|
27
|
+
xtype = NC.nc_type(data_type)
|
28
|
+
</code></pre>
|
29
|
+
|
30
|
+
<h3>2.2. NetCDF File</h3>
|
31
|
+
|
32
|
+
<pre><code>fd = nc_create(FILENAME[, mode=NC_CLOBBER])
|
33
|
+
|
34
|
+
mode : NC_CLOBBER - permit overwrite
|
35
|
+
NC_NOCLOBBER - inhibit overwrite
|
36
|
+
NC_SHARE - no buffering
|
37
|
+
|
38
|
+
fd = nc_open(FILENAME[, mode=NC_NOWRITE])
|
39
|
+
|
40
|
+
mode : NC_NOWRITE - readonly
|
41
|
+
NC_WRTIE - writable
|
42
|
+
NC_SHARE - no buffering
|
43
|
+
|
44
|
+
nc_close(fd)
|
45
|
+
|
46
|
+
nc_redef(fd)
|
47
|
+
nc_enddef(fd)
|
48
|
+
|
49
|
+
nc_sync(fd)
|
50
|
+
|
51
|
+
ndims = nc_inq_ndims(fd)
|
52
|
+
nvars = nc_inq_nvars(fd)
|
53
|
+
natts = nc_inq_natts(fd)
|
54
|
+
unlimdim = nc_inq_unlimdim(fd)
|
55
|
+
|
56
|
+
oldmode = nc_set_fill(mode)
|
57
|
+
|
58
|
+
mode : NC_FILL
|
59
|
+
NC_NOFILL
|
60
|
+
</code></pre>
|
61
|
+
|
62
|
+
<h3>2.3. NetCDF Dimension</h3>
|
63
|
+
|
64
|
+
<pre><code>dimid = nc_def_dim(fd, dimname, len)
|
65
|
+
dimid = nc_inq_dimid(fd, dimname) => Integer | nil
|
66
|
+
|
67
|
+
dimname = nc_inq_dimname(fd, dimid)
|
68
|
+
dimlen = nc_inq_dimlen(fd, dimid)
|
69
|
+
|
70
|
+
nc_rename_dim(fd, dimid, newname)
|
71
|
+
</code></pre>
|
72
|
+
|
73
|
+
<h3>2.4. NetCDF Variable</h3>
|
74
|
+
|
75
|
+
<pre><code>varid = nc_def_var(fd, varname, type, dim)
|
76
|
+
varid = nc_inq_varid(fd, varname) => Integer | nil
|
77
|
+
|
78
|
+
vartype = nc_inq_vartype(fd, varid)
|
79
|
+
varndims = nc_inq_varndims(fd, varid)
|
80
|
+
vardimid = nc_inq_varndimid(fd, varid) => Array of dimids
|
81
|
+
|
82
|
+
nc_put_var1(fd, varid, [i,j,..], val)
|
83
|
+
nc_put_var(fd, varid, ca)
|
84
|
+
nc_put_vara(fd, varid, start, count, ca)
|
85
|
+
nc_put_vars(fd, varid, start, count, stride, ca)
|
86
|
+
nc_put_varm(fd, varid, start, count, stride, imap, ca)
|
87
|
+
|
88
|
+
+ with data_type conversion
|
89
|
+
|
90
|
+
val = nc_get_var1(fd, varid, [i,j,..])
|
91
|
+
ca = nc_get_var(fd, varid) [useful]
|
92
|
+
ca = nc_get_vara(fd, varid, start, count) [useful]
|
93
|
+
ca = nc_get_vars(fd, varid, start, count, stride) [useful]
|
94
|
+
ca = nc_get_varm(fd, varid, start, count, stride, imap) [useful]
|
95
|
+
|
96
|
+
+ no data_type conversion
|
97
|
+
|
98
|
+
nc_get_var(fd, varid, ca) [pedantic]
|
99
|
+
nc_get_vara(fd, varid, start, count, ca) [pedantic]
|
100
|
+
nc_get_vars(fd, varid, start, count, stride, ca) [pedantic]
|
101
|
+
nc_get_varm(fd, varid, start, count, stride, imap, ca) [pedantic]
|
102
|
+
|
103
|
+
+ with data_type conversion.
|
104
|
+
|
105
|
+
nc_rename_var(fd, varid, newname)
|
106
|
+
</code></pre>
|
107
|
+
|
108
|
+
<h3>2.5. NetCDF Attribute</h3>
|
109
|
+
|
110
|
+
<pre><code>varnatts = nc_inq_varnatts(fd, varid)
|
111
|
+
attid = nc_inq_attid(fd, varid, attname)
|
112
|
+
|
113
|
+
attname = nc_inq_attname(fd, varid, attid)
|
114
|
+
atttype = nc_inq_atttype(fd, varid, attname)
|
115
|
+
attlen = nc_inq_attlen(fd, varid, attname)
|
116
|
+
|
117
|
+
nc_put_att(fd, varid, attname, val)
|
118
|
+
|
119
|
+
varid : NC_GLOBAL for global att
|
120
|
+
val : String -> NC_CHAR
|
121
|
+
Integer -> NC_INT
|
122
|
+
Float -> NC_DOUBLE
|
123
|
+
CArray -> NC.nc_type(val.data_type)
|
124
|
+
|
125
|
+
|
126
|
+
val = nc_get_att(fd, varid, attname) => String | Numeric | CArray | nil
|
127
|
+
|
128
|
+
varid : NC_GLOBAL for global att
|
129
|
+
|
130
|
+
nc_get_att(fd, varid, attname, ca) [pedantic]
|
131
|
+
|
132
|
+
nc_rename_att(fd, varid, attname, newname)
|
133
|
+
nc_del_att(fd, varid, attname)
|
134
|
+
|
135
|
+
nc_copy_att(fd1, varid1, attname, fd2, varid2)
|
136
|
+
</code></pre>
|
137
|
+
|
138
|
+
<h3>2.6 Constants</h3>
|
139
|
+
|
140
|
+
<pre><code>NC_NAT
|
141
|
+
NC_BYTE
|
142
|
+
NC_SHORT
|
143
|
+
NC_INT
|
144
|
+
NC_FLOAT
|
145
|
+
NC_DOUBLE
|
146
|
+
|
147
|
+
NC_NOERR - status of API routines
|
148
|
+
|
149
|
+
NC_CLOBBER - permit overwrite [nc_create]
|
150
|
+
NC_NOCLOBBER - inhibit overwrite [nc_create]
|
151
|
+
NC_NOWRITE - readonly [nc_open]
|
152
|
+
NC_WRITE - writable [nc_open]
|
153
|
+
NC_SHARE - no buffering [nc_create, nc_open]
|
154
|
+
|
155
|
+
NC_GLOBAL - varid for global attributes
|
156
|
+
|
157
|
+
NC_NOFILL - nc_set_fill(fd, varid, NC_NOFILL)
|
158
|
+
NC_FILL - nc_set_fill(fd, varid, NC_FILL)
|
159
|
+
|
160
|
+
NC_MAX_NAME
|
161
|
+
NC_MAX_VAR_DIMS
|
162
|
+
NC_MAX_DIMS
|
163
|
+
|
164
|
+
NC_LOCK - ???
|
165
|
+
NC_SIZEHINT_DEFAULT - ???
|
166
|
+
</code></pre>
|
167
|
+
|
168
|
+
<h2>3. NCFile interface</h2>
|
169
|
+
|
170
|
+
<p>NCFile interface provides the way of <em>READ-ONLY</em> access to the netcdf file.</p>
|
171
|
+
|
172
|
+
<h3>3.1. NCFile</h3>
|
173
|
+
|
174
|
+
<pre><code>nc = NCFile.open(FILENAME)
|
175
|
+
|
176
|
+
nc = NCFile.new(file_id)
|
177
|
+
file_id: return value of nc_open in read-only mode
|
178
|
+
</code></pre>
|
179
|
+
|
180
|
+
<h3>3.2. Dimensions</h3>
|
181
|
+
|
182
|
+
<pre><code>nc.has_dim?(DIMNAME)
|
183
|
+
nc.dims - Array of dimension
|
184
|
+
|
185
|
+
dim = nc.dim(DIMNAME) - NCDim object or nil
|
186
|
+
dim.to_i - size of dimension
|
187
|
+
dim.to_ca
|
188
|
+
</code></pre>
|
189
|
+
|
190
|
+
<h3>3.3. Variables</h3>
|
191
|
+
|
192
|
+
<pre><code>nc.has_var?(VARNAME)
|
193
|
+
nc.vars - Array of variables
|
194
|
+
|
195
|
+
var = nc[VARNAME] - NCVar object or nil
|
196
|
+
var.is_dim? - true if dimension variable
|
197
|
+
var.to_ca - get array as CArray object
|
198
|
+
var[...] - Cooked value array with CArray-like indexing
|
199
|
+
var.get!(...) - same as [...]
|
200
|
+
var.get(...) - Non-cooked value array with CArray-like indexing
|
201
|
+
|
202
|
+
var.get_var1(...) - interface to original get function
|
203
|
+
var.get_var()
|
204
|
+
var.get_vara(start, count)
|
205
|
+
var.get_vars(start, count, stride)
|
206
|
+
var.get_varm(start, count, stride, imap)
|
207
|
+
var.get_var1!(...)
|
208
|
+
var.get_var!()
|
209
|
+
var.get_vara!(start, count)
|
210
|
+
var.get_vars!(start, count, stride)
|
211
|
+
var.get_varm!(start, count, stride, imap)
|
212
|
+
</code></pre>
|
213
|
+
|
214
|
+
<h3>3.4. Attributes</h3>
|
215
|
+
|
216
|
+
<p>All attributes are already read in initializing process of NCFile object.</p>
|
217
|
+
|
218
|
+
<pre><code>nc.attributes - Hash
|
219
|
+
dim.attributes
|
220
|
+
var.attributes
|
221
|
+
|
222
|
+
nc.attribute(ATTNAME) - accessor
|
223
|
+
dim.attribute(ATTNAME)
|
224
|
+
var.attribute(ATTNAME)
|
225
|
+
</code></pre>
|
226
|
+
|
227
|
+
<h3>3.5. Iteration</h3>
|
228
|
+
|
229
|
+
<p>No iteration methods is provided, but accessor methods for dims, vars, attributes can be used.</p>
|
230
|
+
|
231
|
+
<pre><code>ex)
|
232
|
+
|
233
|
+
nc.attributes.each {|key, value| ... }
|
234
|
+
nc.dims.each {|dim| ... }
|
235
|
+
nc.vars.each {|var| ... }
|
236
|
+
</code></pre>
|
237
|
+
</body>
|
238
|
+
</html>
|
data/API.md
ADDED
@@ -0,0 +1,270 @@
|
|
1
|
+
CArray/NetCDF library API document
|
2
|
+
==================================
|
3
|
+
|
4
|
+
1. Loading library
|
5
|
+
------------------
|
6
|
+
|
7
|
+
gem install carray-netcdf
|
8
|
+
|
9
|
+
require "carray-netcdf"
|
10
|
+
|
11
|
+
2. Methods
|
12
|
+
----------
|
13
|
+
|
14
|
+
This API provides the way of calling functions
|
15
|
+
|
16
|
+
include NC
|
17
|
+
nc_funcname(...)
|
18
|
+
|
19
|
+
NC.funcname(...)
|
20
|
+
|
21
|
+
### 2.1. Data types
|
22
|
+
|
23
|
+
data_type = NC.ca_type(xtype)
|
24
|
+
xtype = NC.nc_type(data_type)
|
25
|
+
|
26
|
+
### 2.2. NetCDF File
|
27
|
+
|
28
|
+
fd = nc_create(FILENAME[, mode=NC_CLOBBER])
|
29
|
+
|
30
|
+
mode : NC_CLOBBER - permit overwrite
|
31
|
+
NC_NOCLOBBER - inhibit overwrite
|
32
|
+
NC_SHARE - no buffering
|
33
|
+
|
34
|
+
fd = nc_open(FILENAME[, mode=NC_NOWRITE])
|
35
|
+
|
36
|
+
mode : NC_NOWRITE - readonly
|
37
|
+
NC_WRTIE - writable
|
38
|
+
NC_SHARE - no buffering
|
39
|
+
|
40
|
+
nc_close(fd)
|
41
|
+
|
42
|
+
nc_redef(fd)
|
43
|
+
nc_enddef(fd)
|
44
|
+
|
45
|
+
nc_sync(fd)
|
46
|
+
|
47
|
+
ndims = nc_inq_ndims(fd)
|
48
|
+
nvars = nc_inq_nvars(fd)
|
49
|
+
natts = nc_inq_natts(fd)
|
50
|
+
unlimdim = nc_inq_unlimdim(fd)
|
51
|
+
|
52
|
+
oldmode = nc_set_fill(mode)
|
53
|
+
|
54
|
+
mode : NC_FILL
|
55
|
+
NC_NOFILL
|
56
|
+
|
57
|
+
### 2.3. NetCDF Dimension
|
58
|
+
|
59
|
+
dimid = nc_def_dim(fd, dimname, len)
|
60
|
+
dimid = nc_inq_dimid(fd, dimname) => Integer | nil
|
61
|
+
|
62
|
+
dimname = nc_inq_dimname(fd, dimid)
|
63
|
+
dimlen = nc_inq_dimlen(fd, dimid)
|
64
|
+
|
65
|
+
nc_rename_dim(fd, dimid, newname)
|
66
|
+
|
67
|
+
### 2.4. NetCDF Variable
|
68
|
+
|
69
|
+
varid = nc_def_var(fd, varname, type, dim)
|
70
|
+
varid = nc_inq_varid(fd, varname) => Integer | nil
|
71
|
+
|
72
|
+
vartype = nc_inq_vartype(fd, varid)
|
73
|
+
varndims = nc_inq_varndims(fd, varid)
|
74
|
+
vardimid = nc_inq_varndimid(fd, varid) => Array of dimids
|
75
|
+
|
76
|
+
nc_put_var1(fd, varid, [i,j,..], val)
|
77
|
+
nc_put_var(fd, varid, ca)
|
78
|
+
nc_put_vara(fd, varid, start, count, ca)
|
79
|
+
nc_put_vars(fd, varid, start, count, stride, ca)
|
80
|
+
nc_put_varm(fd, varid, start, count, stride, imap, ca)
|
81
|
+
|
82
|
+
+ with data_type conversion
|
83
|
+
|
84
|
+
val = nc_get_var1(fd, varid, [i,j,..])
|
85
|
+
ca = nc_get_var(fd, varid) [useful]
|
86
|
+
ca = nc_get_vara(fd, varid, start, count) [useful]
|
87
|
+
ca = nc_get_vars(fd, varid, start, count, stride) [useful]
|
88
|
+
ca = nc_get_varm(fd, varid, start, count, stride, imap) [useful]
|
89
|
+
|
90
|
+
+ no data_type conversion
|
91
|
+
|
92
|
+
nc_get_var(fd, varid, ca) [pedantic]
|
93
|
+
nc_get_vara(fd, varid, start, count, ca) [pedantic]
|
94
|
+
nc_get_vars(fd, varid, start, count, stride, ca) [pedantic]
|
95
|
+
nc_get_varm(fd, varid, start, count, stride, imap, ca) [pedantic]
|
96
|
+
|
97
|
+
+ with data_type conversion.
|
98
|
+
|
99
|
+
nc_rename_var(fd, varid, newname)
|
100
|
+
|
101
|
+
### 2.5. NetCDF Attribute
|
102
|
+
|
103
|
+
varnatts = nc_inq_varnatts(fd, varid)
|
104
|
+
attid = nc_inq_attid(fd, varid, attname)
|
105
|
+
|
106
|
+
attname = nc_inq_attname(fd, varid, attid)
|
107
|
+
atttype = nc_inq_atttype(fd, varid, attname)
|
108
|
+
attlen = nc_inq_attlen(fd, varid, attname)
|
109
|
+
|
110
|
+
nc_put_att(fd, varid, attname, val)
|
111
|
+
|
112
|
+
varid : NC_GLOBAL for global att
|
113
|
+
val : String -> NC_CHAR
|
114
|
+
Integer -> NC_INT
|
115
|
+
Float -> NC_DOUBLE
|
116
|
+
CArray -> NC.nc_type(val.data_type)
|
117
|
+
|
118
|
+
|
119
|
+
val = nc_get_att(fd, varid, attname) => String | Numeric | CArray | nil
|
120
|
+
|
121
|
+
varid : NC_GLOBAL for global att
|
122
|
+
|
123
|
+
nc_get_att(fd, varid, attname, ca) [pedantic]
|
124
|
+
|
125
|
+
nc_rename_att(fd, varid, attname, newname)
|
126
|
+
nc_del_att(fd, varid, attname)
|
127
|
+
|
128
|
+
nc_copy_att(fd1, varid1, attname, fd2, varid2)
|
129
|
+
|
130
|
+
### 2.6 Constants
|
131
|
+
|
132
|
+
NC_NAT
|
133
|
+
NC_BYTE
|
134
|
+
NC_SHORT
|
135
|
+
NC_INT
|
136
|
+
NC_FLOAT
|
137
|
+
NC_DOUBLE
|
138
|
+
|
139
|
+
NC_NOERR - status of API routines
|
140
|
+
|
141
|
+
NC_CLOBBER - permit overwrite [nc_create]
|
142
|
+
NC_NOCLOBBER - inhibit overwrite [nc_create]
|
143
|
+
NC_NOWRITE - readonly [nc_open]
|
144
|
+
NC_WRITE - writable [nc_open]
|
145
|
+
NC_SHARE - no buffering [nc_create, nc_open]
|
146
|
+
|
147
|
+
NC_GLOBAL - varid for global attributes
|
148
|
+
|
149
|
+
NC_NOFILL - nc_set_fill(fd, varid, NC_NOFILL)
|
150
|
+
NC_FILL - nc_set_fill(fd, varid, NC_FILL)
|
151
|
+
|
152
|
+
NC_MAX_NAME
|
153
|
+
NC_MAX_VAR_DIMS
|
154
|
+
NC_MAX_DIMS
|
155
|
+
|
156
|
+
NC_LOCK - ???
|
157
|
+
NC_SIZEHINT_DEFAULT - ???
|
158
|
+
|
159
|
+
3. NCFile interface
|
160
|
+
-------------------
|
161
|
+
|
162
|
+
NCFile interface provides the way of *READ-ONLY* access to the netcdf file.
|
163
|
+
|
164
|
+
### 3.1. NCFile
|
165
|
+
|
166
|
+
nc = NCFile.open(FILENAME)
|
167
|
+
|
168
|
+
nc = NCFile.new(file_id)
|
169
|
+
file_id: return value of nc_open in read-only mode
|
170
|
+
|
171
|
+
### 3.2. Dimensions
|
172
|
+
|
173
|
+
nc.has_dim?(DIMNAME)
|
174
|
+
nc.dims - Array of dimension
|
175
|
+
|
176
|
+
dim = nc.dim(DIMNAME) - NCDim object or nil
|
177
|
+
dim.to_i - size of dimension
|
178
|
+
dim.to_ca
|
179
|
+
|
180
|
+
### 3.3. Variables
|
181
|
+
|
182
|
+
nc.has_var?(VARNAME)
|
183
|
+
nc.vars - Array of variables
|
184
|
+
|
185
|
+
var = nc.var(VARNAME) - NCVar object or nil
|
186
|
+
var.is_dim? - true if dimension variable
|
187
|
+
var.to_ca - get array as CArray object
|
188
|
+
var[...] - Cooked value array with CArray-like indexing
|
189
|
+
var.get!(...) - same as [...]
|
190
|
+
var.get(...) - Non-cooked value array with CArray-like indexing
|
191
|
+
|
192
|
+
var.get_var1(...) - interface to original get function
|
193
|
+
var.get_var()
|
194
|
+
var.get_vara(start, count)
|
195
|
+
var.get_vars(start, count, stride)
|
196
|
+
var.get_varm(start, count, stride, imap)
|
197
|
+
var.get_var1!(...)
|
198
|
+
var.get_var!()
|
199
|
+
var.get_vara!(start, count)
|
200
|
+
var.get_vars!(start, count, stride)
|
201
|
+
var.get_varm!(start, count, stride, imap)
|
202
|
+
|
203
|
+
### 3.4. Attributes
|
204
|
+
|
205
|
+
All attributes are already read in initializing process of NCFile object.
|
206
|
+
|
207
|
+
nc.attributes - Hash
|
208
|
+
dim.attributes
|
209
|
+
var.attributes
|
210
|
+
|
211
|
+
nc.attribute(ATTNAME) - accessor
|
212
|
+
dim.attribute(ATTNAME)
|
213
|
+
var.attribute(ATTNAME)
|
214
|
+
|
215
|
+
|
216
|
+
### 3.5. Iteration
|
217
|
+
|
218
|
+
No iteration methods is provided, but accessor methods for dims, vars, attributes can be used.
|
219
|
+
|
220
|
+
ex)
|
221
|
+
|
222
|
+
nc.attributes.each {|key, value| ... }
|
223
|
+
nc.dims.each {|dim| ... }
|
224
|
+
nc.vars.each {|var| ... }
|
225
|
+
|
226
|
+
4. NCFileWriter interface
|
227
|
+
-------------------------
|
228
|
+
|
229
|
+
It provides simple interface to create netcdf file.
|
230
|
+
If you want the detailed controling to create netcdf, use nc_function API.
|
231
|
+
|
232
|
+
out = NCFileWrite.new("test.nc")
|
233
|
+
|
234
|
+
out.define(
|
235
|
+
dims: { ### dimension
|
236
|
+
lon: 230, name: Integer
|
237
|
+
lat: 120,
|
238
|
+
time: 24
|
239
|
+
},
|
240
|
+
vars: { ### variables
|
241
|
+
temp: { name: definition
|
242
|
+
type: NC::NC_FLOAT, type: Integer
|
243
|
+
dims: ["time", "lat", "lon"], dims: Array of dim names
|
244
|
+
attributes: { attributes: Hash
|
245
|
+
long_name: "air temperature",
|
246
|
+
units: "degC"
|
247
|
+
}
|
248
|
+
}
|
249
|
+
},
|
250
|
+
attributes: { ### global attributes (Hash)
|
251
|
+
creator: "foobar"
|
252
|
+
}
|
253
|
+
)
|
254
|
+
|
255
|
+
out["lon"] = lon
|
256
|
+
out["lat"] = lat
|
257
|
+
out["time"] = time
|
258
|
+
out["temp"][nil] = temp ### CArray index can be used
|
259
|
+
out.write ### call nc_close
|
260
|
+
|
261
|
+
|
262
|
+
nc = NCFile.open("test.nc")
|
263
|
+
nc.definition ### return definition Hash
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
Gem::Specification::new do |s|
|
3
|
+
version = "1.0.0"
|
4
|
+
|
5
|
+
files = Dir.glob("**/*") - [
|
6
|
+
Dir.glob("carray-*.gem"),
|
7
|
+
].flatten
|
8
|
+
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.name = "carray-netcdf"
|
11
|
+
s.summary = "Extension for manipulating NetCDF3 file with CArray"
|
12
|
+
s.description = <<-HERE
|
13
|
+
Extension for manipulating NetCDF3 file with CArray
|
14
|
+
HERE
|
15
|
+
s.version = version
|
16
|
+
s.author = "Hiroki Motoyoshi"
|
17
|
+
s.email = ""
|
18
|
+
s.homepage = 'https://github.com/himotoyoshi/carray-netcdf'
|
19
|
+
s.files = files
|
20
|
+
s.extensions = [ "extconf.rb" ]
|
21
|
+
s.has_rdoc = false
|
22
|
+
s.required_ruby_version = ">= 1.8.1"
|
23
|
+
end
|
data/examples/test.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "carray-netcdf"
|
data/extconf.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require "mkmf"
|
2
|
+
require "carray/mkmf"
|
3
|
+
|
4
|
+
$CFLAGS += " -Wall"
|
5
|
+
|
6
|
+
dir_config("netcdf", possible_includes("netcdf","netcdf3","netcdf-3"), possible_libs)
|
7
|
+
|
8
|
+
if have_carray() and have_header("netcdf.h") and have_library("netcdf")
|
9
|
+
create_makefile("carray/netcdflib")
|
10
|
+
end
|
11
|
+
|