mdarray 0.5.5.2-java → 0.5.6-java
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/config.rb +29 -95
- data/doc/BinaryOperator.html +20 -21
- data/doc/BitwiseOperators.html +18 -8
- data/doc/BitwiseOperators/BinaryAnd.html +189 -0
- data/doc/BitwiseOperators/BinaryLeftShift.html +189 -0
- data/doc/BitwiseOperators/BinaryOnesComplement.html +189 -0
- data/doc/BitwiseOperators/BinaryOr.html +189 -0
- data/doc/BitwiseOperators/BinaryRightShift.html +189 -0
- data/doc/BitwiseOperators/BinaryXor.html +189 -0
- data/doc/BooleanFunctions.html +18 -8
- data/doc/BooleanFunctions/And.html +189 -0
- data/doc/BooleanFunctions/Not.html +189 -0
- data/doc/BooleanFunctions/Or.html +189 -0
- data/doc/BooleanMDArray.html +10 -10
- data/doc/ByteMDArray.html +73 -14
- data/doc/CernDoubleFunctions.html +208 -0
- data/doc/CernFloatFunctions.html +208 -0
- data/doc/CernFunctions.html +828 -0
- data/doc/CernIntFunctions.html +208 -0
- data/doc/CernLongFunctions.html +208 -0
- data/doc/CharMDArray.html +181 -0
- data/doc/Colt.html +18 -20
- data/doc/ComparisonOperators.html +18 -8
- data/doc/ComparisonOperators/Eq.html +189 -0
- data/doc/ComparisonOperators/Ge.html +189 -0
- data/doc/ComparisonOperators/Gt.html +189 -0
- data/doc/ComparisonOperators/Le.html +189 -0
- data/doc/ComparisonOperators/Lt.html +189 -0
- data/doc/Const.html +107 -47
- data/doc/Csv.html +325 -113
- data/doc/Csv/Dimension.html +771 -0
- data/doc/Csv/Dimensions.html +654 -0
- data/doc/DDescriptive.html +573 -625
- data/doc/DoubleMDArray.html +40 -172
- data/doc/DoubleStatList.html +19 -20
- data/doc/FastBinaryOperator.html +166 -148
- data/doc/FastUnaryOperator.html +104 -109
- data/doc/FloatMDArray.html +55 -16
- data/doc/FunctionCreation.html +53 -273
- data/doc/FunctionMap.html +381 -93
- data/doc/GenericFunctions.html +18 -8
- data/doc/GenericFunctions/Null.html +187 -0
- data/doc/IntMDArray.html +77 -16
- data/doc/Java/CernJetMathTdouble/DoubleFunctions.html +120 -0
- data/doc/Java/CernJetMathTfloat/FloatFunctions.html +120 -0
- data/doc/Java/CernJetMathTint/IntFunctions.html +120 -0
- data/doc/Java/CernJetMathTlong/LongFunctions.html +120 -0
- data/doc/LazyBinaryOperator.html +714 -0
- data/doc/LazyMDArray.html +990 -0
- data/doc/LazyMDArray/BinaryComp.html +282 -0
- data/doc/LazyMDArray/UnaryComp.html +280 -0
- data/doc/LazyUnaryOperator.html +537 -0
- data/doc/LongMDArray.html +59 -15
- data/doc/MDArray.html +3223 -2181
- data/doc/MDArray/Counter.html +321 -1233
- data/doc/MDArray/IteratorFast.html +177 -116
- data/doc/MDArray/IteratorFastBoolean.html +37 -41
- data/doc/MDArray/IteratorFastByte.html +46 -39
- data/doc/MDArray/IteratorFastChar.html +37 -41
- data/doc/MDArray/IteratorFastDouble.html +37 -41
- data/doc/MDArray/IteratorFastFloat.html +37 -41
- data/doc/MDArray/IteratorFastInt.html +37 -41
- data/doc/MDArray/IteratorFastLong.html +37 -41
- data/doc/MDArray/IteratorFastShort.html +37 -41
- data/doc/MDArray/Section.html +561 -0
- data/doc/Nashorn.html +1407 -0
- data/doc/NetCDF.html +749 -0
- data/doc/NetCDF/Attribute.html +875 -0
- data/doc/NetCDF/AttributeWriter.html +286 -0
- data/doc/NetCDF/CDMNode.html +460 -0
- data/doc/NetCDF/Dimension.html +559 -0
- data/doc/NetCDF/DimensionWriter.html +642 -0
- data/doc/NetCDF/File.html +1593 -0
- data/doc/NetCDF/FileParent.html +674 -0
- data/doc/NetCDF/FileWriter.html +2875 -0
- data/doc/NetCDF/Group.html +685 -0
- data/doc/NetCDF/GroupWriter.html +851 -0
- data/doc/NetCDF/TimeVariable.html +646 -0
- data/doc/NetCDF/Variable.html +2994 -0
- data/doc/NetCDF/VariableWriter.html +420 -0
- data/doc/NonNumericalMDArray.html +11 -11
- data/doc/NumericFunctions.html +38 -30
- data/doc/NumericFunctions/Abs.html +189 -0
- data/doc/NumericFunctions/Add.html +189 -0
- data/doc/NumericFunctions/Ceil.html +189 -0
- data/doc/NumericFunctions/Cube.html +189 -0
- data/doc/NumericFunctions/Div.html +189 -0
- data/doc/NumericFunctions/Floor.html +189 -0
- data/doc/NumericFunctions/Fourth.html +189 -0
- data/doc/NumericFunctions/IsZero.html +189 -0
- data/doc/NumericFunctions/Max.html +189 -0
- data/doc/NumericFunctions/Min.html +189 -0
- data/doc/NumericFunctions/Mul.html +189 -0
- data/doc/NumericFunctions/Power.html +189 -0
- data/doc/NumericFunctions/Square.html +189 -0
- data/doc/NumericFunctions/Sub.html +189 -0
- data/doc/NumericFunctions/Truncate.html +189 -0
- data/doc/NumericalMDArray.html +14 -15
- data/doc/Operator.html +318 -109
- data/doc/Proc.html +120 -129
- data/doc/RubyBinaryOperator.html +66 -70
- data/doc/RubyFunctions.html +572 -27
- data/doc/RubyMath.html +18 -8
- data/doc/RubyMath/Acos.html +189 -0
- data/doc/RubyMath/Acosh.html +189 -0
- data/doc/RubyMath/Asin.html +189 -0
- data/doc/RubyMath/Asinh.html +189 -0
- data/doc/RubyMath/Atan.html +189 -0
- data/doc/RubyMath/Atan2.html +189 -0
- data/doc/RubyMath/Atanh.html +189 -0
- data/doc/RubyMath/Cbrt.html +189 -0
- data/doc/RubyMath/Cos.html +189 -0
- data/doc/RubyMath/Cosh.html +189 -0
- data/doc/RubyMath/Erf.html +189 -0
- data/doc/RubyMath/Erfc.html +189 -0
- data/doc/RubyMath/Exp.html +189 -0
- data/doc/RubyMath/Gamma.html +189 -0
- data/doc/RubyMath/Hypot.html +189 -0
- data/doc/RubyMath/Ldexp.html +189 -0
- data/doc/RubyMath/Log.html +189 -0
- data/doc/RubyMath/Log10.html +189 -0
- data/doc/RubyMath/Log2.html +189 -0
- data/doc/RubyMath/Neg.html +189 -0
- data/doc/RubyMath/Sin.html +189 -0
- data/doc/RubyMath/Sinh.html +189 -0
- data/doc/RubyMath/Sqrt.html +189 -0
- data/doc/RubyMath/Tan.html +189 -0
- data/doc/RubyMath/Tanh.html +189 -0
- data/doc/RubyStats.html +8 -8
- data/doc/RubyUnaryOperator.html +61 -65
- data/doc/ShortMDArray.html +69 -14
- data/doc/Sol.html +700 -0
- data/doc/Sol/BarChart.html +181 -0
- data/doc/Sol/BaseChart.html +800 -0
- data/doc/Sol/Bootstrap.html +1137 -0
- data/doc/Sol/Bridge.html +586 -0
- data/doc/Sol/Chart.html +1162 -0
- data/doc/Sol/CoordinateChart.html +679 -0
- data/doc/Sol/Dashboard.html +2094 -0
- data/doc/Sol/Dashboard/DCFX.html +786 -0
- data/doc/Sol/Dashboard/MyHandle.html +338 -0
- data/doc/Sol/Dashboard/MyService.html +202 -0
- data/doc/Sol/Dashboard/MyTask.html +291 -0
- data/doc/Sol/Interval.html +1213 -0
- data/doc/Sol/LineChart.html +346 -0
- data/doc/Sol/LinearScale.html +334 -0
- data/doc/Sol/Margins.html +219 -0
- data/doc/Sol/OrdinalScale.html +263 -0
- data/doc/Sol/Scale.html +462 -0
- data/doc/Sol/Stack.html +199 -0
- data/doc/Sol/TimeScale.html +397 -0
- data/doc/StatList.html +110 -125
- data/doc/StringMDArray.html +10 -10
- data/doc/StructureMDArray.html +10 -10
- data/doc/UnaryOperator.html +20 -21
- data/doc/UserFunction.html +51 -49
- data/doc/_index.html +881 -106
- data/doc/class_list.html +8 -3
- data/doc/css/style.css +2 -1
- data/doc/file.README.html +455 -104
- data/doc/file_list.html +7 -2
- data/doc/frames.html +5 -7
- data/doc/index.html +455 -104
- data/doc/js/app.js +7 -2
- data/doc/js/full_list.js +11 -3
- data/doc/method_list.html +3170 -1233
- data/doc/top-level-namespace.html +31 -8
- data/lib/colt/matrix/algebra.rb +5 -5
- data/lib/mdarray.rb +6 -3
- data/lib/mdarray/csv.rb +25 -5
- data/lib/mdarray/fast_operators.rb +1 -1
- data/lib/mdarray/function_creation.rb +3 -1
- data/lib/mdarray/hierarchy.rb +2 -0
- data/lib/mdarray/operators.rb +1 -1
- data/lib/mdarray/ruby_functions.rb +8 -4
- data/lib/mdarray/ruby_math.rb +0 -28
- data/test/colt/matrix/test_matrix2d_floatingalgebra.rb +31 -7
- data/test/complete.rb +4 -4
- data/test/mdarray/PETR4_2014.csv +249 -0
- data/test/mdarray/VALE_2014.csv +253 -0
- data/test/mdarray/VALE_PETR4.csv +501 -0
- data/test/mdarray/arithmetic_casting.rb +1 -0
- data/test/mdarray/test_access.rb +1 -0
- data/test/mdarray/test_boolean.rb +1 -0
- data/test/mdarray/test_comparison.rb +1 -0
- data/test/mdarray/test_complete.rb +2 -5
- data/test/mdarray/test_counter.rb +1 -0
- data/test/mdarray/test_creation.rb +1 -0
- data/test/mdarray/test_csv.rb +51 -0
- data/test/mdarray/test_error.rb +1 -0
- data/test/mdarray/test_non_numeric.rb +1 -1
- data/test/mdarray/test_operator.rb +31 -14
- data/test/mdarray/test_performance.rb +2 -1
- data/test/mdarray/test_printing.rb +1 -0
- data/test/mdarray/test_sections.rb +1 -0
- data/test/mdarray/test_shape.rb +1 -0
- data/test/mdarray/test_trigonometry.rb +1 -0
- data/test/mdarray/test_views.rb +1 -0
- data/vendor/mdarray.jar +0 -0
- data/vendor/{netcdfAll-4.5_0.jar → netcdfAll-4.6.jar} +0 -0
- data/vendor/slf4j-jdk14-1.7.12.jar +0 -0
- data/version.rb +1 -1
- metadata +247 -139
- data/lib/env.rb +0 -12
- data/lib/mdarray/lazy_mdarray.rb +0 -315
- data/lib/mdarray/lazy_operators.rb +0 -174
- data/test/env.rb +0 -8
- data/test/mdarray/test_lazy.rb +0 -306
data/doc/Const.html
CHANGED
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Class: Const
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.
|
|
9
|
+
— Documentation by YARD 0.8.7.6
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css"
|
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
|
14
14
|
|
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css"
|
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
|
16
16
|
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
|
19
19
|
relpath = '';
|
|
20
|
-
framesUrl = "frames.html#!"
|
|
20
|
+
framesUrl = "frames.html#!Const.html";
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
|
|
@@ -151,6 +151,30 @@
|
|
|
151
151
|
<li class="public ">
|
|
152
152
|
<span class="summary_signature">
|
|
153
153
|
|
|
154
|
+
<a href="#get-instance_method" title="#get (instance method)">- (Object) <strong>get</strong>(index) </a>
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
</span>
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
<span class="summary_desc"><div class='inline'>
|
|
169
|
+
<p>---------------------------------------------------------------------------------------.</p>
|
|
170
|
+
</div></span>
|
|
171
|
+
|
|
172
|
+
</li>
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
<li class="public ">
|
|
176
|
+
<span class="summary_signature">
|
|
177
|
+
|
|
154
178
|
<a href="#get_current-instance_method" title="#get_current (instance method)">- (Object) <strong>get_current</strong> </a>
|
|
155
179
|
|
|
156
180
|
|
|
@@ -166,7 +190,7 @@
|
|
|
166
190
|
|
|
167
191
|
|
|
168
192
|
<span class="summary_desc"><div class='inline'>
|
|
169
|
-
<p
|
|
193
|
+
<p>---------------------------------------------------------------------------------------.</p>
|
|
170
194
|
</div></span>
|
|
171
195
|
|
|
172
196
|
</li>
|
|
@@ -190,7 +214,7 @@
|
|
|
190
214
|
|
|
191
215
|
|
|
192
216
|
<span class="summary_desc"><div class='inline'>
|
|
193
|
-
<p
|
|
217
|
+
<p>---------------------------------------------------------------------------------------.</p>
|
|
194
218
|
</div></span>
|
|
195
219
|
|
|
196
220
|
</li>
|
|
@@ -214,7 +238,7 @@
|
|
|
214
238
|
|
|
215
239
|
|
|
216
240
|
<span class="summary_desc"><div class='inline'>
|
|
217
|
-
<p
|
|
241
|
+
<p>---------------------------------------------------------------------------------------.</p>
|
|
218
242
|
</div></span>
|
|
219
243
|
|
|
220
244
|
</li>
|
|
@@ -240,7 +264,7 @@
|
|
|
240
264
|
|
|
241
265
|
|
|
242
266
|
<span class="summary_desc"><div class='inline'>
|
|
243
|
-
<p
|
|
267
|
+
<p>---------------------------------------------------------------------------------------.</p>
|
|
244
268
|
</div></span>
|
|
245
269
|
|
|
246
270
|
</li>
|
|
@@ -263,8 +287,8 @@
|
|
|
263
287
|
|
|
264
288
|
</h3><div class="docstring">
|
|
265
289
|
<div class="discussion">
|
|
266
|
-
<hr
|
|
267
|
-
<hr
|
|
290
|
+
<hr>
|
|
291
|
+
<hr>
|
|
268
292
|
|
|
269
293
|
|
|
270
294
|
</div>
|
|
@@ -285,10 +309,9 @@
|
|
|
285
309
|
<td>
|
|
286
310
|
<pre class="code"><span class="info file"># File 'lib/mdarray/operators.rb', line 39</span>
|
|
287
311
|
|
|
288
|
-
<span class='
|
|
289
|
-
<span class='
|
|
290
|
-
<span class='
|
|
291
|
-
</pre>
|
|
312
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
|
313
|
+
<span class='ivar'>@value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
|
314
|
+
<span class='kw'>end</span></pre>
|
|
292
315
|
</td>
|
|
293
316
|
</tr>
|
|
294
317
|
</table>
|
|
@@ -334,10 +357,9 @@
|
|
|
334
357
|
<td>
|
|
335
358
|
<pre class="code"><span class="info file"># File 'lib/mdarray/operators.rb', line 33</span>
|
|
336
359
|
|
|
337
|
-
<span class='
|
|
338
|
-
<span class='
|
|
339
|
-
<span class='
|
|
340
|
-
</pre>
|
|
360
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_value'>value</span>
|
|
361
|
+
<span class='ivar'>@value</span>
|
|
362
|
+
<span class='kw'>end</span></pre>
|
|
341
363
|
</td>
|
|
342
364
|
</tr>
|
|
343
365
|
</table>
|
|
@@ -351,7 +373,48 @@
|
|
|
351
373
|
|
|
352
374
|
|
|
353
375
|
<div class="method_details first">
|
|
354
|
-
<h3 class="signature first" id="
|
|
376
|
+
<h3 class="signature first" id="get-instance_method">
|
|
377
|
+
|
|
378
|
+
- (<tt>Object</tt>) <strong>get</strong>(index)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
</h3><div class="docstring">
|
|
385
|
+
<div class="discussion">
|
|
386
|
+
<hr>
|
|
387
|
+
<hr>
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
</div>
|
|
391
|
+
</div>
|
|
392
|
+
<div class="tags">
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
</div><table class="source_code">
|
|
396
|
+
<tr>
|
|
397
|
+
<td>
|
|
398
|
+
<pre class="lines">
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
55
|
|
402
|
+
56
|
|
403
|
+
57</pre>
|
|
404
|
+
</td>
|
|
405
|
+
<td>
|
|
406
|
+
<pre class="code"><span class="info file"># File 'lib/mdarray/operators.rb', line 55</span>
|
|
407
|
+
|
|
408
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
|
|
409
|
+
<span class='ivar'>@value</span>
|
|
410
|
+
<span class='kw'>end</span></pre>
|
|
411
|
+
</td>
|
|
412
|
+
</tr>
|
|
413
|
+
</table>
|
|
414
|
+
</div>
|
|
415
|
+
|
|
416
|
+
<div class="method_details ">
|
|
417
|
+
<h3 class="signature " id="get_current-instance_method">
|
|
355
418
|
|
|
356
419
|
- (<tt>Object</tt>) <strong>get_current</strong>
|
|
357
420
|
|
|
@@ -361,8 +424,8 @@
|
|
|
361
424
|
|
|
362
425
|
</h3><div class="docstring">
|
|
363
426
|
<div class="discussion">
|
|
364
|
-
<hr
|
|
365
|
-
<hr
|
|
427
|
+
<hr>
|
|
428
|
+
<hr>
|
|
366
429
|
|
|
367
430
|
|
|
368
431
|
</div>
|
|
@@ -376,17 +439,16 @@
|
|
|
376
439
|
<pre class="lines">
|
|
377
440
|
|
|
378
441
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
442
|
+
71
|
|
443
|
+
72
|
|
444
|
+
73</pre>
|
|
382
445
|
</td>
|
|
383
446
|
<td>
|
|
384
|
-
<pre class="code"><span class="info file"># File 'lib/mdarray/operators.rb', line
|
|
447
|
+
<pre class="code"><span class="info file"># File 'lib/mdarray/operators.rb', line 71</span>
|
|
385
448
|
|
|
386
|
-
<span class='
|
|
387
|
-
<span class='
|
|
388
|
-
<span class='
|
|
389
|
-
</pre>
|
|
449
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get_current'>get_current</span>
|
|
450
|
+
<span class='ivar'>@value</span>
|
|
451
|
+
<span class='kw'>end</span></pre>
|
|
390
452
|
</td>
|
|
391
453
|
</tr>
|
|
392
454
|
</table>
|
|
@@ -403,8 +465,8 @@
|
|
|
403
465
|
|
|
404
466
|
</h3><div class="docstring">
|
|
405
467
|
<div class="discussion">
|
|
406
|
-
<hr
|
|
407
|
-
<hr
|
|
468
|
+
<hr>
|
|
469
|
+
<hr>
|
|
408
470
|
|
|
409
471
|
|
|
410
472
|
</div>
|
|
@@ -425,10 +487,9 @@
|
|
|
425
487
|
<td>
|
|
426
488
|
<pre class="code"><span class="info file"># File 'lib/mdarray/operators.rb', line 47</span>
|
|
427
489
|
|
|
428
|
-
<span class='
|
|
429
|
-
<span class='
|
|
430
|
-
<span class='
|
|
431
|
-
</pre>
|
|
490
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get_iterator_fast'>get_iterator_fast</span>
|
|
491
|
+
<span class='kw'>return</span> <span class='kw'>self</span>
|
|
492
|
+
<span class='kw'>end</span></pre>
|
|
432
493
|
</td>
|
|
433
494
|
</tr>
|
|
434
495
|
</table>
|
|
@@ -445,8 +506,8 @@
|
|
|
445
506
|
|
|
446
507
|
</h3><div class="docstring">
|
|
447
508
|
<div class="discussion">
|
|
448
|
-
<hr
|
|
449
|
-
<hr
|
|
509
|
+
<hr>
|
|
510
|
+
<hr>
|
|
450
511
|
|
|
451
512
|
|
|
452
513
|
</div>
|
|
@@ -460,17 +521,16 @@
|
|
|
460
521
|
<pre class="lines">
|
|
461
522
|
|
|
462
523
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
524
|
+
63
|
|
525
|
+
64
|
|
526
|
+
65</pre>
|
|
466
527
|
</td>
|
|
467
528
|
<td>
|
|
468
|
-
<pre class="code"><span class="info file"># File 'lib/mdarray/operators.rb', line
|
|
529
|
+
<pre class="code"><span class="info file"># File 'lib/mdarray/operators.rb', line 63</span>
|
|
469
530
|
|
|
470
|
-
<span class='
|
|
471
|
-
<span class='
|
|
472
|
-
<span class='
|
|
473
|
-
</pre>
|
|
531
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get_next'>get_next</span>
|
|
532
|
+
<span class='ivar'>@value</span>
|
|
533
|
+
<span class='kw'>end</span></pre>
|
|
474
534
|
</td>
|
|
475
535
|
</tr>
|
|
476
536
|
</table>
|
|
@@ -481,9 +541,9 @@
|
|
|
481
541
|
</div>
|
|
482
542
|
|
|
483
543
|
<div id="footer">
|
|
484
|
-
Generated on
|
|
544
|
+
Generated on Tue Jul 14 18:09:10 2015 by
|
|
485
545
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
486
|
-
0.8.
|
|
546
|
+
0.8.7.6 (ruby-1.9.3).
|
|
487
547
|
</div>
|
|
488
548
|
|
|
489
549
|
</body>
|
data/doc/Csv.html
CHANGED
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Class: Csv
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.
|
|
9
|
+
— Documentation by YARD 0.8.7.6
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css"
|
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
|
14
14
|
|
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css"
|
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
|
16
16
|
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
|
19
19
|
relpath = '';
|
|
20
|
-
framesUrl = "frames.html#!"
|
|
20
|
+
framesUrl = "frames.html#!Csv.html";
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
|
|
@@ -99,6 +99,16 @@
|
|
|
99
99
|
</dl>
|
|
100
100
|
<div class="clear"></div>
|
|
101
101
|
|
|
102
|
+
<h2>Defined Under Namespace</h2>
|
|
103
|
+
<p class="children">
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Csv/Dimension.html" title="Csv::Dimension (class)">Dimension</a></span>, <span class='object_link'><a href="Csv/Dimensions.html" title="Csv::Dimensions (class)">Dimensions</a></span>
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
</p>
|
|
102
112
|
|
|
103
113
|
|
|
104
114
|
|
|
@@ -243,6 +253,30 @@
|
|
|
243
253
|
<li class="public ">
|
|
244
254
|
<span class="summary_signature">
|
|
245
255
|
|
|
256
|
+
<a href="#read_file-class_method" title="read_file (class method)">+ (Object) <strong>read_file</strong>(filename, options = {}) </a>
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
</span>
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
<span class="summary_desc"><div class='inline'>
|
|
271
|
+
<p>------------------------------------------------------------------------------------.</p>
|
|
272
|
+
</div></span>
|
|
273
|
+
|
|
274
|
+
</li>
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
<li class="public ">
|
|
278
|
+
<span class="summary_signature">
|
|
279
|
+
|
|
246
280
|
<a href="#read_numeric-class_method" title="read_numeric (class method)">+ (Object) <strong>read_numeric</strong>(filename, headers = false) </a>
|
|
247
281
|
|
|
248
282
|
|
|
@@ -258,7 +292,7 @@
|
|
|
258
292
|
|
|
259
293
|
|
|
260
294
|
<span class="summary_desc"><div class='inline'>
|
|
261
|
-
<p
|
|
295
|
+
<p>------------------------------------------------------------------------------------.</p>
|
|
262
296
|
</div></span>
|
|
263
297
|
|
|
264
298
|
</li>
|
|
@@ -299,17 +333,16 @@
|
|
|
299
333
|
<pre class="lines">
|
|
300
334
|
|
|
301
335
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
336
|
+
34
|
|
337
|
+
35
|
|
338
|
+
36</pre>
|
|
305
339
|
</td>
|
|
306
340
|
<td>
|
|
307
|
-
<pre class="code"><span class="info file"># File 'lib/mdarray/csv.rb', line
|
|
341
|
+
<pre class="code"><span class="info file"># File 'lib/mdarray/csv.rb', line 34</span>
|
|
308
342
|
|
|
309
|
-
<span class='
|
|
310
|
-
<span class='
|
|
311
|
-
<span class='
|
|
312
|
-
</pre>
|
|
343
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_epoch'>epoch</span>
|
|
344
|
+
<span class='ivar'>@epoch</span>
|
|
345
|
+
<span class='kw'>end</span></pre>
|
|
313
346
|
</td>
|
|
314
347
|
</tr>
|
|
315
348
|
</table>
|
|
@@ -348,17 +381,16 @@
|
|
|
348
381
|
<pre class="lines">
|
|
349
382
|
|
|
350
383
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
384
|
+
27
|
|
385
|
+
28
|
|
386
|
+
29</pre>
|
|
354
387
|
</td>
|
|
355
388
|
<td>
|
|
356
|
-
<pre class="code"><span class="info file"># File 'lib/mdarray/csv.rb', line
|
|
389
|
+
<pre class="code"><span class="info file"># File 'lib/mdarray/csv.rb', line 27</span>
|
|
357
390
|
|
|
358
|
-
<span class='
|
|
359
|
-
<span class='
|
|
360
|
-
<span class='
|
|
361
|
-
</pre>
|
|
391
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_col_sep'>col_sep</span>
|
|
392
|
+
<span class='ivar'>@col_sep</span>
|
|
393
|
+
<span class='kw'>end</span></pre>
|
|
362
394
|
</td>
|
|
363
395
|
</tr>
|
|
364
396
|
</table>
|
|
@@ -392,17 +424,16 @@
|
|
|
392
424
|
<pre class="lines">
|
|
393
425
|
|
|
394
426
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
427
|
+
29
|
|
428
|
+
30
|
|
429
|
+
31</pre>
|
|
398
430
|
</td>
|
|
399
431
|
<td>
|
|
400
|
-
<pre class="code"><span class="info file"># File 'lib/mdarray/csv.rb', line
|
|
432
|
+
<pre class="code"><span class="info file"># File 'lib/mdarray/csv.rb', line 29</span>
|
|
401
433
|
|
|
402
|
-
<span class='
|
|
403
|
-
<span class='
|
|
404
|
-
<span class='
|
|
405
|
-
</pre>
|
|
434
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_quote_char'>quote_char</span>
|
|
435
|
+
<span class='ivar'>@quote_char</span>
|
|
436
|
+
<span class='kw'>end</span></pre>
|
|
406
437
|
</td>
|
|
407
438
|
</tr>
|
|
408
439
|
</table>
|
|
@@ -436,17 +467,16 @@
|
|
|
436
467
|
<pre class="lines">
|
|
437
468
|
|
|
438
469
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
470
|
+
28
|
|
471
|
+
29
|
|
472
|
+
30</pre>
|
|
442
473
|
</td>
|
|
443
474
|
<td>
|
|
444
|
-
<pre class="code"><span class="info file"># File 'lib/mdarray/csv.rb', line
|
|
475
|
+
<pre class="code"><span class="info file"># File 'lib/mdarray/csv.rb', line 28</span>
|
|
445
476
|
|
|
446
|
-
<span class='
|
|
447
|
-
<span class='
|
|
448
|
-
<span class='
|
|
449
|
-
</pre>
|
|
477
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_row_sep'>row_sep</span>
|
|
478
|
+
<span class='ivar'>@row_sep</span>
|
|
479
|
+
<span class='kw'>end</span></pre>
|
|
450
480
|
</td>
|
|
451
481
|
</tr>
|
|
452
482
|
</table>
|
|
@@ -460,7 +490,186 @@
|
|
|
460
490
|
|
|
461
491
|
|
|
462
492
|
<div class="method_details first">
|
|
463
|
-
<h3 class="signature first" id="
|
|
493
|
+
<h3 class="signature first" id="read_file-class_method">
|
|
494
|
+
|
|
495
|
+
+ (<tt>Object</tt>) <strong>read_file</strong>(filename, options = {})
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
</h3><div class="docstring">
|
|
502
|
+
<div class="discussion">
|
|
503
|
+
<hr>
|
|
504
|
+
<hr>
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
</div>
|
|
508
|
+
</div>
|
|
509
|
+
<div class="tags">
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
</div><table class="source_code">
|
|
513
|
+
<tr>
|
|
514
|
+
<td>
|
|
515
|
+
<pre class="lines">
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
198
|
|
519
|
+
199
|
|
520
|
+
200
|
|
521
|
+
201
|
|
522
|
+
202
|
|
523
|
+
203
|
|
524
|
+
204
|
|
525
|
+
205
|
|
526
|
+
206
|
|
527
|
+
207
|
|
528
|
+
208
|
|
529
|
+
209
|
|
530
|
+
210
|
|
531
|
+
211
|
|
532
|
+
212
|
|
533
|
+
213
|
|
534
|
+
214
|
|
535
|
+
215
|
|
536
|
+
216
|
|
537
|
+
217
|
|
538
|
+
218
|
|
539
|
+
219
|
|
540
|
+
220
|
|
541
|
+
221
|
|
542
|
+
222
|
|
543
|
+
223
|
|
544
|
+
224
|
|
545
|
+
225
|
|
546
|
+
226
|
|
547
|
+
227
|
|
548
|
+
228
|
|
549
|
+
229
|
|
550
|
+
230
|
|
551
|
+
231
|
|
552
|
+
232
|
|
553
|
+
233
|
|
554
|
+
234
|
|
555
|
+
235
|
|
556
|
+
236
|
|
557
|
+
237
|
|
558
|
+
238
|
|
559
|
+
239
|
|
560
|
+
240
|
|
561
|
+
241
|
|
562
|
+
242
|
|
563
|
+
243
|
|
564
|
+
244
|
|
565
|
+
245
|
|
566
|
+
246
|
|
567
|
+
247
|
|
568
|
+
248
|
|
569
|
+
249
|
|
570
|
+
250
|
|
571
|
+
251
|
|
572
|
+
252
|
|
573
|
+
253
|
|
574
|
+
254
|
|
575
|
+
255
|
|
576
|
+
256
|
|
577
|
+
257
|
|
578
|
+
258
|
|
579
|
+
259
|
|
580
|
+
260
|
|
581
|
+
261
|
|
582
|
+
262
|
|
583
|
+
263
|
|
584
|
+
264
|
|
585
|
+
265
|
|
586
|
+
266
|
|
587
|
+
267
|
|
588
|
+
268
|
|
589
|
+
269</pre>
|
|
590
|
+
</td>
|
|
591
|
+
<td>
|
|
592
|
+
<pre class="code"><span class="info file"># File 'lib/mdarray/csv.rb', line 198</span>
|
|
593
|
+
|
|
594
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_read_file'>read_file</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
595
|
+
|
|
596
|
+
<span class='id identifier rubyid_buffer'>buffer</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
|
597
|
+
<span class='id identifier rubyid_heading'>heading</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
|
598
|
+
<span class='id identifier rubyid_lines'>lines</span> <span class='op'>=</span> <span class='int'>0</span>
|
|
599
|
+
<span class='id identifier rubyid_columns'>columns</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
600
|
+
|
|
601
|
+
<span class='comment'># user has to set the headers to true if the file has headers, however, we will force
|
|
602
|
+
</span> <span class='comment'># it to false for reading in order to get an array for each line.
|
|
603
|
+
</span> <span class='id identifier rubyid_hds'>hds</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:headers</span><span class='rbracket'>]</span>
|
|
604
|
+
<span class='comment'># Get the dimensions on the file
|
|
605
|
+
</span> <span class='id identifier rubyid_dimensions_names'>dimensions_names</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:dimensions</span><span class='rparen'>)</span>
|
|
606
|
+
<span class='id identifier rubyid_dimensions'>dimensions</span> <span class='op'>=</span> <span class='const'>Dimensions</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_dimensions_names'>dimensions_names</span><span class='rparen'>)</span>
|
|
607
|
+
|
|
608
|
+
<span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>converters:</span> <span class='lbracket'>[</span><span class='symbol'>:numeric</span><span class='comma'>,</span> <span class='symbol'>:date</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>return_headers:</span> <span class='kw'>true</span><span class='rbrace'>}</span> <span class='comment'>#, headers: false}
|
|
609
|
+
</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
|
|
610
|
+
|
|
611
|
+
<span class='comment'># open the file for reading
|
|
612
|
+
</span> <span class='const'>CSV</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_csv'>csv</span><span class='op'>|</span>
|
|
613
|
+
|
|
614
|
+
<span class='comment'># if file has headers then read the first line
|
|
615
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_hds'>hds</span>
|
|
616
|
+
<span class='id identifier rubyid_i'>i</span> <span class='op'>=</span> <span class='int'>0</span>
|
|
617
|
+
<span class='id identifier rubyid_header'>header</span> <span class='op'>=</span> <span class='id identifier rubyid_csv'>csv</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span><span class='period'>.</span><span class='id identifier rubyid_to_hash'>to_hash</span>
|
|
618
|
+
<span class='id identifier rubyid_header'>header</span><span class='period'>.</span><span class='id identifier rubyid_each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
|
|
619
|
+
<span class='id identifier rubyid_header'>header</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_i'>i</span>
|
|
620
|
+
<span class='id identifier rubyid_i'>i</span> <span class='op'>+=</span> <span class='int'>1</span>
|
|
621
|
+
<span class='kw'>end</span>
|
|
622
|
+
<span class='kw'>end</span>
|
|
623
|
+
|
|
624
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Dimension(s) </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dimensions_names'>dimensions_names</span><span class='rbrace'>}</span><span class='tstring_content'> are not all in the header </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_header'>header</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>\
|
|
625
|
+
</span>if <span class='op'>!</span><span class='lparen'>(</span><span class='id identifier rubyid_dimensions_names'>dimensions_names</span> <span class='op'>-</span> <span class='id identifier rubyid_header'>header</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
|
626
|
+
|
|
627
|
+
<span class='id identifier rubyid_dimensions'>dimensions</span><span class='period'>.</span><span class='id identifier rubyid_dimensions'>dimensions</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Columns</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_header'>header</span>
|
|
628
|
+
|
|
629
|
+
<span class='id identifier rubyid_csv'>csv</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span>
|
|
630
|
+
<span class='comment'># columns is initialized with the first row.size
|
|
631
|
+
</span> <span class='id identifier rubyid_columns'>columns</span> <span class='op'>||=</span> <span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
|
|
632
|
+
<span class='id identifier rubyid_lines'>lines</span> <span class='op'>+=</span> <span class='int'>1</span>
|
|
633
|
+
<span class='comment'># every row should have the same number of columns
|
|
634
|
+
</span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>!=</span> <span class='id identifier rubyid_columns'>columns</span><span class='rparen'>)</span>
|
|
635
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Data does not have the same number of columns for all lines</span><span class='tstring_end'>"</span></span>
|
|
636
|
+
<span class='kw'>end</span>
|
|
637
|
+
<span class='comment'># delete dimensions from data and store them on their proper dimension
|
|
638
|
+
</span> <span class='id identifier rubyid_dimensions_names'>dimensions_names</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='op'>|</span>
|
|
639
|
+
<span class='id identifier rubyid_dimensions'>dimensions</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
|
640
|
+
<span class='kw'>end</span>
|
|
641
|
+
|
|
642
|
+
<span class='comment'># p row
|
|
643
|
+
</span> <span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_data'>data</span><span class='op'>|</span>
|
|
644
|
+
<span class='comment'># if it is a Date, then convert it to seconds since epoch
|
|
645
|
+
</span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Date</span><span class='rparen'>)</span>
|
|
646
|
+
<span class='id identifier rubyid_buffer'>buffer</span> <span class='op'><<</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_time'>to_time</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
|
647
|
+
<span class='kw'>end</span>
|
|
648
|
+
<span class='comment'># if it is numeric then just add it to the buffer
|
|
649
|
+
</span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Numeric</span><span class='rparen'>)</span>
|
|
650
|
+
<span class='id identifier rubyid_buffer'>buffer</span> <span class='op'><<</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
|
651
|
+
<span class='kw'>end</span>
|
|
652
|
+
<span class='kw'>end</span>
|
|
653
|
+
|
|
654
|
+
<span class='kw'>end</span>
|
|
655
|
+
|
|
656
|
+
<span class='comment'># reset all dimensions
|
|
657
|
+
</span> <span class='id identifier rubyid_dimensions_names'>dimensions_names</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='op'>|</span>
|
|
658
|
+
<span class='id identifier rubyid_dimensions'>dimensions</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_reset'>reset</span>
|
|
659
|
+
<span class='kw'>end</span>
|
|
660
|
+
|
|
661
|
+
<span class='lbracket'>[</span><span class='id identifier rubyid_lines'>lines</span><span class='comma'>,</span> <span class='id identifier rubyid_columns'>columns</span><span class='comma'>,</span> <span class='id identifier rubyid_buffer'>buffer</span><span class='comma'>,</span> <span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_dimensions'>dimensions</span><span class='rbracket'>]</span>
|
|
662
|
+
|
|
663
|
+
<span class='kw'>end</span>
|
|
664
|
+
|
|
665
|
+
<span class='kw'>end</span></pre>
|
|
666
|
+
</td>
|
|
667
|
+
</tr>
|
|
668
|
+
</table>
|
|
669
|
+
</div>
|
|
670
|
+
|
|
671
|
+
<div class="method_details ">
|
|
672
|
+
<h3 class="signature " id="read_numeric-class_method">
|
|
464
673
|
|
|
465
674
|
+ (<tt>Object</tt>) <strong>read_numeric</strong>(filename, headers = false)
|
|
466
675
|
|
|
@@ -470,8 +679,8 @@
|
|
|
470
679
|
|
|
471
680
|
</h3><div class="docstring">
|
|
472
681
|
<div class="discussion">
|
|
473
|
-
<hr
|
|
474
|
-
<hr
|
|
682
|
+
<hr>
|
|
683
|
+
<hr>
|
|
475
684
|
|
|
476
685
|
|
|
477
686
|
</div>
|
|
@@ -485,91 +694,94 @@
|
|
|
485
694
|
<pre class="lines">
|
|
486
695
|
|
|
487
696
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
697
|
+
275
|
|
698
|
+
276
|
|
699
|
+
277
|
|
700
|
+
278
|
|
701
|
+
279
|
|
702
|
+
280
|
|
703
|
+
281
|
|
704
|
+
282
|
|
705
|
+
283
|
|
706
|
+
284
|
|
707
|
+
285
|
|
708
|
+
286
|
|
709
|
+
287
|
|
710
|
+
288
|
|
711
|
+
289
|
|
712
|
+
290
|
|
713
|
+
291
|
|
714
|
+
292
|
|
715
|
+
293
|
|
716
|
+
294
|
|
717
|
+
295
|
|
718
|
+
296
|
|
719
|
+
297
|
|
720
|
+
298
|
|
721
|
+
299
|
|
722
|
+
300
|
|
723
|
+
301
|
|
724
|
+
302
|
|
725
|
+
303
|
|
726
|
+
304
|
|
727
|
+
305
|
|
728
|
+
306
|
|
729
|
+
307
|
|
730
|
+
308
|
|
731
|
+
309
|
|
732
|
+
310
|
|
733
|
+
311
|
|
734
|
+
312
|
|
735
|
+
313
|
|
736
|
+
314
|
|
737
|
+
315
|
|
738
|
+
316</pre>
|
|
528
739
|
</td>
|
|
529
740
|
<td>
|
|
530
|
-
<pre class="code"><span class="info file"># File 'lib/mdarray/csv.rb', line
|
|
741
|
+
<pre class="code"><span class="info file"># File 'lib/mdarray/csv.rb', line 275</span>
|
|
531
742
|
|
|
532
|
-
<span class='
|
|
743
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_read_numeric'>read_numeric</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
|
533
744
|
|
|
534
|
-
<span class='
|
|
535
|
-
<span class='
|
|
536
|
-
<span class='
|
|
745
|
+
<span class='id identifier rubyid_buffer'>buffer</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
|
746
|
+
<span class='id identifier rubyid_heading'>heading</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
|
747
|
+
<span class='id identifier rubyid_lines'>lines</span> <span class='op'>=</span> <span class='int'>0</span>
|
|
748
|
+
<span class='id identifier rubyid_columns'>columns</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
537
749
|
|
|
538
|
-
<span class='
|
|
539
|
-
<span class='lbrace
|
|
540
|
-
<span class='comment
|
|
541
|
-
<span class='
|
|
750
|
+
<span class='const'>CSV</span><span class='period'>.</span><span class='id identifier rubyid_foreach'>foreach</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span>
|
|
751
|
+
<span class='lbrace'>{</span><span class='label'>return_headers:</span> <span class='kw'>false</span><span class='comma'>,</span>
|
|
752
|
+
<span class='comment'># headers: true,
|
|
753
|
+
</span> <span class='label'>converters:</span> <span class='lbracket'>[</span><span class='symbol'>:numeric</span><span class='comma'>,</span> <span class='symbol'>:date</span><span class='rbracket'>]</span><span class='rbrace'>}</span> <span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span>
|
|
542
754
|
|
|
543
|
-
<span class='
|
|
544
|
-
<span class='
|
|
545
|
-
<span class='
|
|
546
|
-
|
|
755
|
+
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
|
756
|
+
<span class='id identifier rubyid_headers'>headers</span> <span class='op'>=</span> <span class='kw'>false</span>
|
|
757
|
+
<span class='id identifier rubyid_heading'>heading</span> <span class='op'><<</span> <span class='id identifier rubyid_row'>row</span>
|
|
758
|
+
<span class='kw'>next</span>
|
|
759
|
+
<span class='kw'>end</span>
|
|
547
760
|
|
|
548
|
-
<span class='
|
|
549
|
-
<span class='
|
|
761
|
+
<span class='id identifier rubyid_columns'>columns</span> <span class='op'>||=</span> <span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
|
|
762
|
+
<span class='id identifier rubyid_lines'>lines</span> <span class='op'>+=</span> <span class='int'>1</span>
|
|
550
763
|
|
|
551
|
-
<span class='
|
|
764
|
+
<span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_data'>data</span><span class='op'>|</span>
|
|
552
765
|
|
|
553
|
-
<span class='
|
|
554
|
-
<span class='
|
|
555
|
-
<span class='
|
|
766
|
+
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>!=</span> <span class='id identifier rubyid_columns'>columns</span><span class='rparen'>)</span>
|
|
767
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Data does not have the same number of columns for all lines</span><span class='tstring_end'>"</span></span>
|
|
768
|
+
<span class='kw'>end</span>
|
|
556
769
|
|
|
557
|
-
<span class='comment
|
|
558
|
-
<span class='
|
|
559
|
-
<span class='
|
|
560
|
-
<span class='
|
|
770
|
+
<span class='comment'># if it is a Date, then convert it to seconds since epoch
|
|
771
|
+
</span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Date</span><span class='rparen'>)</span>
|
|
772
|
+
<span class='id identifier rubyid_buffer'>buffer</span> <span class='op'><<</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_to_time'>to_time</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
|
773
|
+
<span class='kw'>end</span>
|
|
561
774
|
|
|
562
|
-
<span class='
|
|
563
|
-
<span class='
|
|
564
|
-
<span class='
|
|
565
|
-
<span class='
|
|
775
|
+
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Numeric</span><span class='rparen'>)</span>
|
|
776
|
+
<span class='id identifier rubyid_buffer'>buffer</span> <span class='op'><<</span> <span class='id identifier rubyid_data'>data</span>
|
|
777
|
+
<span class='kw'>end</span>
|
|
778
|
+
<span class='kw'>end</span>
|
|
566
779
|
|
|
567
|
-
<span class='
|
|
780
|
+
<span class='kw'>end</span>
|
|
568
781
|
|
|
569
|
-
<span class='
|
|
782
|
+
<span class='lbracket'>[</span><span class='id identifier rubyid_lines'>lines</span><span class='comma'>,</span> <span class='id identifier rubyid_columns'>columns</span><span class='comma'>,</span> <span class='id identifier rubyid_buffer'>buffer</span><span class='comma'>,</span> <span class='id identifier rubyid_heading'>heading</span><span class='rbracket'>]</span>
|
|
570
783
|
|
|
571
|
-
<span class='
|
|
572
|
-
</pre>
|
|
784
|
+
<span class='kw'>end</span></pre>
|
|
573
785
|
</td>
|
|
574
786
|
</tr>
|
|
575
787
|
</table>
|
|
@@ -580,9 +792,9 @@
|
|
|
580
792
|
</div>
|
|
581
793
|
|
|
582
794
|
<div id="footer">
|
|
583
|
-
Generated on
|
|
795
|
+
Generated on Tue Jul 14 18:09:00 2015 by
|
|
584
796
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
585
|
-
0.8.
|
|
797
|
+
0.8.7.6 (ruby-1.9.3).
|
|
586
798
|
</div>
|
|
587
799
|
|
|
588
800
|
</body>
|