carray-netcdf 1.0.8 → 1.0.13
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 +4 -4
- data/Rakefile +12 -0
- data/carray-netcdf.gemspec +2 -2
- data/{extconf.rb → ext/extconf.rb} +0 -0
- data/{rb_netcdflib.c → ext/rb_netcdflib.c} +18 -7
- data/lib/io/netcdf.rb +25 -17
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f3e60226c628ade3bb1c17f553e5cd2ab593370eb89d00246f7139ed2e6b44f
|
4
|
+
data.tar.gz: 68fba916f7cacf44bb63af2e01374886401d66f52c870a67ab0c949a348da6b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d03a0d7d42e11f09363a21686cb45fde2e28b641af8848ce7d87f68465f3184cb34db1aeb3d6454fa18ebee978bb2e028dcf8dda737e7e2b65d2ad21cf743f88
|
7
|
+
data.tar.gz: 50073e499670da6e882f8ce3a43d84a32dfd1cb53b496cbd6bfb795ee18867cc1f4124bc9c438d3c4aeef55a95148f011c1182ec3bd08a015a1fdc21fade7687
|
data/Rakefile
ADDED
data/carray-netcdf.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
Gem::Specification::new do |s|
|
3
|
-
version = "1.0.
|
3
|
+
version = "1.0.13"
|
4
4
|
|
5
5
|
files = Dir.glob("**/*") - [
|
6
6
|
Dir.glob("carray-*.gem"),
|
@@ -17,7 +17,7 @@ Gem::Specification::new do |s|
|
|
17
17
|
s.email = ""
|
18
18
|
s.homepage = 'https://github.com/himotoyoshi/carray-netcdf'
|
19
19
|
s.files = files
|
20
|
-
s.extensions = [ "extconf.rb" ]
|
20
|
+
s.extensions = [ "ext/extconf.rb" ]
|
21
21
|
s.executables << 'ncdef2yaml'
|
22
22
|
s.required_ruby_version = ">= 1.8.1"
|
23
23
|
end
|
File without changes
|
@@ -1950,11 +1950,11 @@ rb_nc_get_vara (int argc, VALUE *argv, VALUE mod)
|
|
1950
1950
|
}
|
1951
1951
|
Data_Get_Struct(data, CArray, ca);
|
1952
1952
|
|
1953
|
-
if ( ca->
|
1953
|
+
if ( ca->ndim != ndims ) {
|
1954
1954
|
rb_raise(rb_eRuntimeError, "rank mismatch");
|
1955
1955
|
}
|
1956
1956
|
|
1957
|
-
for (i=0; i<ca->
|
1957
|
+
for (i=0; i<ca->ndim; i++) {
|
1958
1958
|
if ( ca->dim[i] != (ca_size_t) count[i] ) {
|
1959
1959
|
rb_raise(rb_eRuntimeError, "dim[%i] mismatch", i);
|
1960
1960
|
}
|
@@ -2090,11 +2090,11 @@ rb_nc_get_vars (int argc, VALUE *argv, VALUE mod)
|
|
2090
2090
|
|
2091
2091
|
Data_Get_Struct(data, CArray, ca);
|
2092
2092
|
|
2093
|
-
if ( ca->
|
2093
|
+
if ( ca->ndim != ndims ) {
|
2094
2094
|
rb_raise(rb_eRuntimeError, "rank mismatch");
|
2095
2095
|
}
|
2096
2096
|
|
2097
|
-
for (i=0; i<ca->
|
2097
|
+
for (i=0; i<ca->ndim; i++) {
|
2098
2098
|
if ( ca->dim[i] != (ca_size_t) count[i] ) {
|
2099
2099
|
rb_raise(rb_eRuntimeError, "dim[%i] mismatch", i);
|
2100
2100
|
}
|
@@ -2235,11 +2235,11 @@ rb_nc_get_varm (int argc, VALUE *argv, VALUE mod)
|
|
2235
2235
|
|
2236
2236
|
Data_Get_Struct(data, CArray, ca);
|
2237
2237
|
|
2238
|
-
if ( ca->
|
2238
|
+
if ( ca->ndim != ndims ) {
|
2239
2239
|
rb_raise(rb_eRuntimeError, "rank mismatch");
|
2240
2240
|
}
|
2241
2241
|
|
2242
|
-
for (i=0; i<ca->
|
2242
|
+
for (i=0; i<ca->ndim; i++) {
|
2243
2243
|
if ( ca->dim[i] != (ca_size_t) count[i] ) {
|
2244
2244
|
rb_raise(rb_eRuntimeError, "dim[%i] mismatch", i);
|
2245
2245
|
}
|
@@ -2577,24 +2577,35 @@ Init_netcdflib ()
|
|
2577
2577
|
rb_define_const(mNetCDF, "NC_NOCLOBBER", INT2NUM(NC_NOCLOBBER));
|
2578
2578
|
rb_define_const(mNetCDF, "NC_DISKLESS", INT2NUM(NC_DISKLESS));
|
2579
2579
|
rb_define_const(mNetCDF, "NC_MMAP", INT2NUM(NC_MMAP));
|
2580
|
+
#if defined(NC_64BIT_DATA)
|
2580
2581
|
rb_define_const(mNetCDF, "NC_64BIT_DATA", INT2NUM(NC_64BIT_DATA));
|
2582
|
+
#endif
|
2583
|
+
#if defined(NC_CDF5)
|
2581
2584
|
rb_define_const(mNetCDF, "NC_CDF5", INT2NUM(NC_CDF5));
|
2585
|
+
#endif
|
2582
2586
|
rb_define_const(mNetCDF, "NC_CLASSIC_MODEL", INT2NUM(NC_CLASSIC_MODEL));
|
2583
2587
|
rb_define_const(mNetCDF, "NC_LOCK", INT2NUM(NC_LOCK));
|
2584
2588
|
rb_define_const(mNetCDF, "NC_SHARE", INT2NUM(NC_SHARE));
|
2585
2589
|
rb_define_const(mNetCDF, "NC_NETCDF4", INT2NUM(NC_NETCDF4));
|
2586
2590
|
rb_define_const(mNetCDF, "NC_MPIIO", INT2NUM(NC_MPIIO));
|
2591
|
+
#if defined(NC_INMEMORY)
|
2587
2592
|
rb_define_const(mNetCDF, "NC_INMEMORY", INT2NUM(NC_INMEMORY));
|
2593
|
+
#endif
|
2588
2594
|
rb_define_const(mNetCDF, "NC_PNETCDF", INT2NUM(NC_PNETCDF));
|
2589
2595
|
|
2590
2596
|
rb_define_const(mNetCDF, "NC_FORMAT_CLASSIC", INT2NUM(NC_FORMAT_CLASSIC));
|
2597
|
+
#if defined(NC_FORMAT_64BIT_OFFSET)
|
2591
2598
|
rb_define_const(mNetCDF, "NC_FORMAT_64BIT_OFFSET", INT2NUM(NC_FORMAT_64BIT_OFFSET));
|
2599
|
+
#endif
|
2592
2600
|
rb_define_const(mNetCDF, "NC_FORMAT_64BIT", INT2NUM(NC_FORMAT_64BIT));
|
2593
2601
|
rb_define_const(mNetCDF, "NC_FORMAT_NETCDF4", INT2NUM(NC_FORMAT_NETCDF4));
|
2594
2602
|
rb_define_const(mNetCDF, "NC_FORMAT_NETCDF4_CLASSIC", INT2NUM(NC_FORMAT_NETCDF4_CLASSIC));
|
2603
|
+
#if defined(NC_FORMAT_64BIT_DATA)
|
2595
2604
|
rb_define_const(mNetCDF, "NC_FORMAT_64BIT_DATA", INT2NUM(NC_FORMAT_64BIT_DATA));
|
2605
|
+
#endif
|
2606
|
+
#if defined(NC_FORMAT_CDF5)
|
2596
2607
|
rb_define_const(mNetCDF, "NC_FORMAT_CDF5", INT2NUM(NC_FORMAT_CDF5));
|
2597
|
-
|
2608
|
+
#endif
|
2598
2609
|
|
2599
2610
|
rb_define_const(mNetCDF, "NC_SIZEHINT_DEFAULT", INT2NUM(NC_SIZEHINT_DEFAULT));
|
2600
2611
|
|
data/lib/io/netcdf.rb
CHANGED
@@ -235,6 +235,7 @@ class NCVar < NCObject
|
|
235
235
|
when CA_REG_ALL
|
236
236
|
out = get_var()
|
237
237
|
when CA_REG_BLOCK
|
238
|
+
use_compact = false
|
238
239
|
start = []
|
239
240
|
count = []
|
240
241
|
stride = []
|
@@ -245,6 +246,7 @@ class NCVar < NCObject
|
|
245
246
|
count << idx[1]
|
246
247
|
stride << idx[2]
|
247
248
|
else
|
249
|
+
use_compact = true
|
248
250
|
start << idx
|
249
251
|
count << 1
|
250
252
|
stride << 1
|
@@ -255,17 +257,15 @@ class NCVar < NCObject
|
|
255
257
|
else
|
256
258
|
out = get_vars(start, count, stride)
|
257
259
|
end
|
260
|
+
if use_compact and out.is_a?(CArray)
|
261
|
+
out = out.compact
|
262
|
+
end
|
258
263
|
when CA_REG_SELECT, CA_REG_GRID
|
259
264
|
out = get_var[*argv]
|
260
265
|
else
|
261
266
|
raise "invalid index"
|
262
267
|
end
|
263
|
-
|
264
|
-
when CArray
|
265
|
-
return out.compact
|
266
|
-
else
|
267
|
-
return out
|
268
|
-
end
|
268
|
+
return out
|
269
269
|
end
|
270
270
|
|
271
271
|
def get! (*argv)
|
@@ -702,14 +702,14 @@ class NCFileWriter
|
|
702
702
|
if definition.has_key?("variables")
|
703
703
|
definition["variables"].each do |name, var_def|
|
704
704
|
unless var_def.has_key?("type")
|
705
|
-
warn "
|
705
|
+
warn "NCFileWriter: Variable '#{name}' does not have 'type' entry in definition"
|
706
706
|
else
|
707
707
|
unless ["char","byte","short","int","float","double"].include?(var_def["type"])
|
708
708
|
raise "invalid type of NetCDF Variable '#{name}'"
|
709
709
|
end
|
710
710
|
end
|
711
711
|
unless var_def.has_key?("dim")
|
712
|
-
warn "
|
712
|
+
warn "NCFileWriter: Variable '#{name}' does not have 'dim' entry in definition"
|
713
713
|
else
|
714
714
|
unless var_def["dim"].is_a?(Array)
|
715
715
|
raise "'dim' of NetCDF Variable '#{name}' should be an Array"
|
@@ -758,17 +758,25 @@ class NCFileWriter
|
|
758
758
|
def define (definition, define_mode: true)
|
759
759
|
definition = normalize_definition(definition)
|
760
760
|
check_definition(definition)
|
761
|
-
definition["dimensions"].
|
762
|
-
|
763
|
-
|
764
|
-
|
761
|
+
if definition.has_key?("dimensions") and definition["dimensions"].is_a?(Hash)
|
762
|
+
definition["dimensions"].each do |name, len|
|
763
|
+
dim = Dim.new(self, name, len.to_i, define_mode)
|
764
|
+
@dims.push dim
|
765
|
+
@name2dim[name] = dim
|
766
|
+
end
|
767
|
+
else
|
768
|
+
warn "NCFileWriter: No dimensions in definition"
|
765
769
|
end
|
766
|
-
definition["variables"].
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
+
if definition.has_key?("variables") and definition["variables"].is_a?(Hash)
|
771
|
+
definition["variables"].each do |name, info|
|
772
|
+
var = Var.new(self, name, info, @compression, define_mode)
|
773
|
+
@vars.push var
|
774
|
+
@name2var[name] = var
|
775
|
+
end
|
776
|
+
else
|
777
|
+
warn "NCFileWriter: No variables in definition"
|
770
778
|
end
|
771
|
-
if definition.has_key?("attributes")
|
779
|
+
if definition.has_key?("attributes") and definition["attributes"].is_a?(Hash)
|
772
780
|
@attributes = definition["attributes"]
|
773
781
|
if define_mode
|
774
782
|
@attributes.each do |name, value|
|
metadata
CHANGED
@@ -1,34 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carray-netcdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroki Motoyoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: " Extension for manipulating NetCDF3 file with CArray\n"
|
14
14
|
email: ''
|
15
15
|
executables:
|
16
16
|
- ncdef2yaml
|
17
17
|
extensions:
|
18
|
-
- extconf.rb
|
18
|
+
- ext/extconf.rb
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- API.md
|
22
22
|
- README.md
|
23
|
+
- Rakefile
|
23
24
|
- bin/ncdef2yaml
|
24
25
|
- carray-netcdf.gemspec
|
25
26
|
- examples/test.nc
|
26
27
|
- examples/test.rb
|
27
28
|
- examples/time.rb
|
28
|
-
- extconf.rb
|
29
|
+
- ext/extconf.rb
|
30
|
+
- ext/rb_netcdflib.c
|
29
31
|
- lib/carray-netcdf.rb
|
30
32
|
- lib/io/netcdf.rb
|
31
|
-
- rb_netcdflib.c
|
32
33
|
homepage: https://github.com/himotoyoshi/carray-netcdf
|
33
34
|
licenses: []
|
34
35
|
metadata: {}
|
@@ -47,8 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
47
48
|
- !ruby/object:Gem::Version
|
48
49
|
version: '0'
|
49
50
|
requirements: []
|
50
|
-
|
51
|
-
rubygems_version: 2.7.7
|
51
|
+
rubygems_version: 3.1.2
|
52
52
|
signing_key:
|
53
53
|
specification_version: 4
|
54
54
|
summary: Extension for manipulating NetCDF3 file with CArray
|