netcdflib 0.9.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.md +158 -0
- data/LICENSE +22 -0
- data/README.md +0 -0
- data/Rakefile +8 -0
- data/ext/extconf.rb +11 -0
- data/ext/rb_netcdflib.c +2716 -0
- data/lib/netcdflib.rb +43 -0
- data/lib/netcdflib/narray.rb +5 -0
- data/lib/netcdflib/numo.rb +5 -0
- data/netcdflib.gemspec +28 -0
- metadata +77 -0
data/lib/netcdflib.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require "carray"
|
2
|
+
require "netcdflib.so"
|
3
|
+
|
4
|
+
module NC
|
5
|
+
|
6
|
+
module_function
|
7
|
+
|
8
|
+
def nc_decode (fd, varid, data)
|
9
|
+
if fill_value = nc_get_att(fd, varid, "_FillValue")
|
10
|
+
data[:eq, fill_value] = UNDEF
|
11
|
+
end
|
12
|
+
if scale_factor = nc_get_att(fd, varid, "scale_factor")
|
13
|
+
data *= scale_factor
|
14
|
+
end
|
15
|
+
if add_offset = nc_get_att(fd, varid, "add_offset")
|
16
|
+
data += add_offset
|
17
|
+
end
|
18
|
+
return data
|
19
|
+
end
|
20
|
+
|
21
|
+
def nc_put_att_simple (fd, varid, name, val)
|
22
|
+
case val
|
23
|
+
when Float
|
24
|
+
nc_put_att(fd, varid, name, CA_DOUBLE(val))
|
25
|
+
when Integer
|
26
|
+
nc_put_att(fd, varid, name, CA_INT(val))
|
27
|
+
else
|
28
|
+
nc_put_att(fd, varid, name, val)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def nc_put_var_all (fd, varid, val)
|
33
|
+
data_type = NC.ca_type(nc_inq_vartype(fd, varid))
|
34
|
+
dim = (0...nc_inq_varndims(fd, varid)).collect do |dimid|
|
35
|
+
nc_inq_dimlen(fd, dimid)
|
36
|
+
end
|
37
|
+
data = CArray.new(data_type, dim) { val }
|
38
|
+
nc_put_var(fd, varid, data)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
|
data/netcdflib.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
Gem::Specification::new do |s|
|
3
|
+
version = "0.9.0"
|
4
|
+
|
5
|
+
files = Dir.glob("**/*") - [
|
6
|
+
Dir.glob("netcdflib-*.gem"),
|
7
|
+
Dir.glob("examples/**/*"),
|
8
|
+
Dir.glob("doc/**/*"),
|
9
|
+
].flatten
|
10
|
+
|
11
|
+
s.platform = Gem::Platform::RUBY
|
12
|
+
s.name = "netcdflib"
|
13
|
+
s.summary = "Extension for manipulating NetCDF3 file"
|
14
|
+
s.description = <<-HERE
|
15
|
+
Extension for manipulating NetCDF3 file.
|
16
|
+
Ruby/CArray is used for binary data passing.
|
17
|
+
Formerly known as 'carray-netcdf'.
|
18
|
+
HERE
|
19
|
+
s.version = version
|
20
|
+
s.license = "MIT"
|
21
|
+
s.author = "Hiroki Motoyoshi"
|
22
|
+
s.email = ""
|
23
|
+
s.homepage = 'https://github.com/himotoyoshi/netcdflib'
|
24
|
+
s.files = files
|
25
|
+
s.extensions = [ "ext/extconf.rb" ]
|
26
|
+
s.required_ruby_version = ">= 2.2.0"
|
27
|
+
s.add_runtime_dependency 'carray', '~> 1.5', '>= 1.5.0'
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: netcdflib
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hiroki Motoyoshi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-07-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: carray
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.5.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.5'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.5.0
|
33
|
+
description: |2
|
34
|
+
Extension for manipulating NetCDF3 file.
|
35
|
+
Ruby/CArray is used for binary data passing.
|
36
|
+
Formerly known as 'carray-netcdf'.
|
37
|
+
email: ''
|
38
|
+
executables: []
|
39
|
+
extensions:
|
40
|
+
- ext/extconf.rb
|
41
|
+
extra_rdoc_files: []
|
42
|
+
files:
|
43
|
+
- API.md
|
44
|
+
- LICENSE
|
45
|
+
- README.md
|
46
|
+
- Rakefile
|
47
|
+
- ext/extconf.rb
|
48
|
+
- ext/rb_netcdflib.c
|
49
|
+
- lib/netcdflib.rb
|
50
|
+
- lib/netcdflib/narray.rb
|
51
|
+
- lib/netcdflib/numo.rb
|
52
|
+
- netcdflib.gemspec
|
53
|
+
homepage: https://github.com/himotoyoshi/netcdflib
|
54
|
+
licenses:
|
55
|
+
- MIT
|
56
|
+
metadata: {}
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 2.2.0
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 2.7.7
|
74
|
+
signing_key:
|
75
|
+
specification_version: 4
|
76
|
+
summary: Extension for manipulating NetCDF3 file
|
77
|
+
test_files: []
|