mdarray 0.5.5.1-java → 0.5.5.2-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b09d88dc54e6026fcc58d8fb89f0f4d37e62a37
4
- data.tar.gz: a39345c9195c40cf34547af94c6bdd561871e549
3
+ metadata.gz: 90a00abf128ebc0ac2bf2394f35c91022014b9bb
4
+ data.tar.gz: ac3d419c19c8930c5f6adad82a3a32028d6a611f
5
5
  SHA512:
6
- metadata.gz: bb22f9ec641ba92ba991a2e3c44356c9cbb2e84b5f1286a977d32055806496886663b8bc07cfd6357509da95c46bc73288d705d72aaa0a7a03f8fb5ede861e0c
7
- data.tar.gz: d5948157d07a7b6c042cc33c305e9baeb5b6fb205a1ee08ca3239fa26adaa0afb3e95c34289285da7cc6cacc51c5aba898a14b5a4666b4b9f22007f420db04f4
6
+ metadata.gz: 70ce2f8d70596ede4382100933657a54505202e10bdaacb70610c46eb81e7f2f62784715c991f2e5fa2f862bd313dda4e77b3a05c4c861f580b109e3a2e1359a
7
+ data.tar.gz: 02f28e8345945bd5639cb3f58eac5115839eb2363c1999f01234007a218a6c08a0406d8fcc249d5f660d815d94f13bd78ac7abb615c5fc9b665f83fb1db4a85a
data/config.rb CHANGED
@@ -11,7 +11,7 @@ require 'rbconfig'
11
11
  # $ENV = 'cygwin'
12
12
 
13
13
  # Dependencies that are not yet installed (still in development)
14
- # $DEPEND = Array.new
14
+ $DEPEND = Array.new
15
15
 
16
16
  ##########################################################################################
17
17
 
@@ -161,4 +161,3 @@ if ($DVLP == true)
161
161
  end
162
162
 
163
163
  end
164
-
@@ -72,18 +72,33 @@ class MDArray
72
72
  storage = parameters[2]
73
73
  end
74
74
 
75
- dtype = DataType.valueOf(type.upcase)
75
+ # Java-NetCDF creates an ArrayObject when given type string. It should create an
76
+ # ArrayString instead. Some string methods in Java-NetCDF expect an ArrayObject
77
+ # instead of an ArrayString, however, other libraries actually expect an ArrayString,
78
+ # so we know have two type: "string" stores internally the data as an ArrayObject,
79
+ # "rstring" stores data internally as an ArrayString
80
+ rtype = (type == "rstring")? "string" : type
81
+ dtype = DataType.valueOf(rtype.upcase)
82
+
76
83
  jshape = shape.to_java :int
77
84
 
78
85
  if (storage)
79
- jstorage = storage.to_java type.downcase.to_sym
80
- nc_array = Java::UcarMa2.Array.factory(dtype, jshape, jstorage)
86
+ jstorage = storage.to_java rtype.downcase.to_sym
87
+ if (type == "rstring")
88
+ # circunvent bug in Java-NetCDF. Type rstring is actually type string but should
89
+ # and should build and ArrayString and not an ObjectString which is currently being
90
+ # build.
91
+ index = Java::UcarMa2.Index.factory(jshape)
92
+ nc_array = Java::UcarMa2.ArrayString.factory(index, jstorage)
93
+ else
94
+ nc_array = Java::UcarMa2.Array.factory(dtype, jshape, jstorage)
95
+ end
81
96
  else
82
97
  nc_array = Java::UcarMa2.Array.factory(dtype, jshape)
83
98
  end
84
99
 
85
- klass = Object.const_get("#{type.capitalize}MDArray")
86
- return klass.new(type, nc_array)
100
+ klass = Object.const_get("#{rtype.capitalize}MDArray")
101
+ return klass.new(rtype, nc_array)
87
102
 
88
103
  end
89
104
 
@@ -200,7 +215,9 @@ class MDArray
200
215
  end
201
216
 
202
217
  #------------------------------------------------------------------------------------
203
- # Builds a string mdarray
218
+ # Builds a string mdarray. Java-NetCDF does not actuallly build a string array when
219
+ # type string is passed, it builds an object array. This is an open issue with
220
+ # Java-NetCDF.
204
221
  # @param shape [Array] the shape of the mdarray as a ruby array
205
222
  # @param storage [Array] a ruby array with the initialization data
206
223
  #------------------------------------------------------------------------------------
@@ -209,6 +226,17 @@ class MDArray
209
226
  self.build("string", shape, storage, layout)
210
227
  end
211
228
 
229
+ #------------------------------------------------------------------------------------
230
+ # Builds a string mdarray. Really builds an string array. Only exists to fix the
231
+ # Java-NetCDF issue described above.
232
+ # @param shape [Array] the shape of the mdarray as a ruby array
233
+ # @param storage [Array] a ruby array with the initialization data
234
+ #------------------------------------------------------------------------------------
235
+
236
+ def self.rstring(shape, storage = nil, layout = :row)
237
+ self.build("rstring", shape, storage, layout)
238
+ end
239
+
212
240
  #------------------------------------------------------------------------------------
213
241
  # Builds a structure mdarray
214
242
  # @param shape [Array] the shape of the mdarray as a ruby array
@@ -108,6 +108,14 @@ end
108
108
  #
109
109
  ##########################################################################################
110
110
 
111
+ class CharMDArray < NonNumericalMDArray
112
+
113
+ end
114
+
115
+ ##########################################################################################
116
+ #
117
+ ##########################################################################################
118
+
111
119
  class StringMDArray < NonNumericalMDArray
112
120
 
113
121
  end
data/lib/mdarray/views.rb CHANGED
@@ -56,13 +56,20 @@ class MDArray
56
56
 
57
57
  end
58
58
 
59
- #------------------------------------------------------------------------------------
60
- #
61
- #------------------------------------------------------------------------------------
59
+ #----------------------------------------------------------------------------------------
60
+ # This method fixes a bug in netcdf-java!!!
61
+ #----------------------------------------------------------------------------------------
62
62
 
63
63
  def reshape!(shape)
64
64
  new_shape = shape.to_java :int
65
- @nc_array = @nc_array.reshapeNoCopy(new_shape)
65
+ # Netcdf-Java bug... reshape of ArrayString becomes an ArrayObject. In principle
66
+ # should not require comparison with ArrayString here
67
+ if (@nc_array.is_a? ArrayString)
68
+ @nc_array = Java::UcarMa2.ArrayString.factory(@nc_array.getIndex(),
69
+ @nc_array.getStorage())
70
+ else
71
+ @nc_array = @nc_array.reshapeNoCopy(new_shape)
72
+ end
66
73
  # when we reshape an array we need to re-initialize its index and local_iterator
67
74
  @local_index = Counter.new(self)
68
75
  @local_iterator = nil
data/target/helper.jar CHANGED
Binary file
@@ -23,6 +23,7 @@ require 'rubygems'
23
23
  require "test/unit"
24
24
  require 'shoulda'
25
25
 
26
+ require_relative '../env'
26
27
  require 'mdarray'
27
28
 
28
29
  class MDArrayTest < Test::Unit::TestCase
@@ -1,3 +1,29 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ ##########################################################################################
4
+ # Copyright © 2013 Rodrigo Botafogo. All Rights Reserved. Permission to use, copy, modify,
5
+ # and distribute this software and its documentation, without fee and without a signed
6
+ # licensing agreement, is hereby granted, provided that the above copyright notice, this
7
+ # paragraph and the following two paragraphs appear in all copies, modifications, and
8
+ # distributions.
9
+ #
10
+ # IN NO EVENT SHALL RODRIGO BOTAFOGO BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
11
+ # INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF
12
+ # THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RODRIGO BOTAFOGO HAS BEEN ADVISED OF THE
13
+ # POSSIBILITY OF SUCH DAMAGE.
14
+ #
15
+ # RODRIGO BOTAFOGO SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
17
+ # SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
18
+ # RODRIGO BOTAFOGO HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
19
+ # OR MODIFICATIONS.
20
+ ##########################################################################################
21
+
22
+ if !(defined? $ENVIR)
23
+ $ENVIR = true
24
+ require_relative '../env.rb'
25
+ end
26
+
1
27
  require 'mdarray'
2
28
 
3
29
  class NetCDF
data/version.rb CHANGED
@@ -1,2 +1,2 @@
1
1
  $gem_name = "mdarray"
2
- $version="0.5.5.1"
2
+ $version="0.5.5.2"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mdarray
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5.1
4
+ version: 0.5.5.2
5
5
  platform: java
6
6
  authors:
7
7
  - Rodrigo Botafogo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-16 00:00:00.000000000 Z
11
+ date: 2014-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: map
@@ -104,31 +104,26 @@ files:
104
104
  - config.rb
105
105
  - lib/env.rb
106
106
  - lib/mdarray.rb
107
+ - lib/colt/colt_mdarray.rb
108
+ - lib/colt/double_descriptive.rb
109
+ - lib/colt/probability.rb
110
+ - lib/colt/stat_list.rb
107
111
  - lib/colt/cern_double_functions.rb
108
112
  - lib/colt/cern_float_functions.rb
109
113
  - lib/colt/cern_int_functions.rb
110
114
  - lib/colt/cern_long_functions.rb
111
115
  - lib/colt/colt.rb
112
- - lib/colt/colt_mdarray.rb
113
- - lib/colt/double_descriptive.rb
114
- - lib/colt/probability.rb
115
- - lib/colt/stat_list.rb
116
116
  - lib/colt/matrix/algebra.rb
117
117
  - lib/colt/matrix/colt_matrix.rb
118
118
  - lib/colt/matrix/creation.rb
119
119
  - lib/colt/matrix/hierarchy.rb
120
120
  - lib/colt/matrix/property.rb
121
121
  - lib/mdarray/access.rb
122
- - lib/mdarray/counter.rb
123
122
  - lib/mdarray/csv.rb
124
123
  - lib/mdarray/fast_operators.rb
125
- - lib/mdarray/function_creation.rb
126
124
  - lib/mdarray/function_map.rb
127
125
  - lib/mdarray/hierarchy.rb
128
- - lib/mdarray/lazy_mdarray.rb
129
126
  - lib/mdarray/lazy_operators.rb
130
- - lib/mdarray/operators.rb
131
- - lib/mdarray/printing.rb
132
127
  - lib/mdarray/proc_util.rb
133
128
  - lib/mdarray/ruby_boolean_functions.rb
134
129
  - lib/mdarray/ruby_functions.rb
@@ -139,7 +134,12 @@ files:
139
134
  - lib/mdarray/ruby_stats.rb
140
135
  - lib/mdarray/section.rb
141
136
  - lib/mdarray/views.rb
137
+ - lib/mdarray/counter.rb
142
138
  - lib/mdarray/creation.rb
139
+ - lib/mdarray/function_creation.rb
140
+ - lib/mdarray/lazy_mdarray.rb
141
+ - lib/mdarray/operators.rb
142
+ - lib/mdarray/printing.rb
143
143
  - lib/netcdf/attribute.rb
144
144
  - lib/netcdf/cdm_node.rb
145
145
  - lib/netcdf/dimension.rb
@@ -158,16 +158,14 @@ files:
158
158
  - test/colt/matrix/test_creation.rb
159
159
  - test/colt/matrix/test_matrix1d_floatingalgebra.rb
160
160
  - test/colt/matrix/test_matrix2d_fixpointalgebra.rb
161
- - test/colt/matrix/test_matrix2d_floatingalgebra.rb
162
161
  - test/colt/matrix/test_operations.rb
163
162
  - test/colt/matrix/test_properties.rb
164
- - test/mdarray/arithmetic_casting.rb
163
+ - test/colt/matrix/test_matrix2d_floatingalgebra.rb
165
164
  - test/mdarray/test_access.rb
166
165
  - test/mdarray/test_boolean.rb
167
166
  - test/mdarray/test_comparison.rb
168
167
  - test/mdarray/test_complete.rb
169
168
  - test/mdarray/test_counter.rb
170
- - test/mdarray/test_creation.rb
171
169
  - test/mdarray/test_error.rb
172
170
  - test/mdarray/test_lazy.rb
173
171
  - test/mdarray/test_non_numeric.rb
@@ -178,6 +176,8 @@ files:
178
176
  - test/mdarray/test_shape.rb
179
177
  - test/mdarray/test_trigonometry.rb
180
178
  - test/mdarray/test_views.rb
179
+ - test/mdarray/arithmetic_casting.rb
180
+ - test/mdarray/test_creation.rb
181
181
  - test/netcdf/netcdfwriter.rb
182
182
  - test/netcdf/test_complete.rb
183
183
  - test/netcdf/test_netcdf.rb