extcsv 0.12.3 → 0.12.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8481302a2791dcfde67455ac5c5caa0f4fcd885e
4
+ data.tar.gz: c5f36f0d41ae84806444d0e5e05b435c8b041b6c
5
+ SHA512:
6
+ metadata.gz: 81375361f68acd261b6712ebd3a53e60aa4b619fae3033466a8ff59906d9f55ce94b708131ac045908289ff3e819f8963a76b950ba80706eccd3402a1c446d41
7
+ data.tar.gz: 750cc4cf43f319d4799383a9b56489b2655ab71e398f248fb661b6f750997fc96ed596e774f5f1e3e8154f889fa8c4f67346393aa741d1e4ba92c5ef27e3c529
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009, Ralf Mueller (stark.dreamdetective@googlemail.com)
1
+ Copyright (c) 2009-2013, Ralf Mueller (stark.dreamdetective@googlemail.com)
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
data/gemspec CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  spec = Gem::Specification.new do |s|
4
4
  s.name = "extcsv"
5
- s.version = "0.12.3"
5
+ s.version = "0.12.4"
6
6
  s.date = Time.new.strftime("%Y-%m-%d")
7
7
  s.author = "Ralf Mueller"
8
8
  s.email = "stark.dreamdetective@gmail.com"
data/lib/extcsv.rb CHANGED
@@ -573,16 +573,16 @@ class ExtCsv < OpenStruct
573
573
  end
574
574
 
575
575
  # String output. See ExtCsvExporter.to_string
576
- def to_string(stype,sort=true)
577
- header = sort ? datacolumns.sort : datacolumns
576
+ def to_string(stype,header=nil,sort=true)
577
+ header = sort ? datacolumns.sort : datacolumns if header.nil?
578
578
  ExtCsvExporter.new("extcsv",
579
579
  ([header] +
580
580
  datasets(*header)).transpose
581
581
  ).to_string(stype)
582
582
  end
583
- def to_file(filename, filetype="txt")
583
+ def to_file(filename, filetype="txt", columns)
584
584
  File.open(filename,"w") do |f|
585
- f << to_string(filetype)
585
+ f << to_string(filetype,columns)
586
586
  end
587
587
  end
588
588
 
@@ -167,7 +167,7 @@ module ExtCsvDiagram
167
167
  colors = []
168
168
  step = (@@ColorUp - @@ColorLow)/(nColors-1)
169
169
  nColors.times {|i| colors << "#"+(@@ColorLow + i*step).to_s(16)}
170
- olors
170
+ colors
171
171
  end
172
172
 
173
173
  def ExtCsvDiagram.addDataToPlot(plot,obj,xColumn,yColumn,groupBy,options)
data/test/test_extcsv.rb CHANGED
@@ -38,20 +38,10 @@ class TestExtCsv < Test::Unit::TestCase
38
38
  test_simple = ExtCsv.new(IMPORT_TYPE,"ssv",ERG_CSV_DATA)
39
39
  end
40
40
  def test_create_bsv
41
- test_bsv = ExtCsv.new(IMPORT_TYPE,"bsv","/home/ram/src/git/extcsv/extcsv/trunk/test/data/bsv.txt")
41
+ test_bsv = ExtCsv.new(IMPORT_TYPE,"bsv",TEST_DATA_DIR + "bsv.txt")
42
42
  assert_equal([1,5,11,55].map(&:to_s),test_bsv.a)
43
43
  assert_equal(4,test_bsv.datacolumns.size)
44
44
  assert_equal("d",test_bsv.datacolumns[-1])
45
- if 'thingol' == `hostname`.chomp
46
- cmt = ExtCsv.new(IMPORT_TYPE,"bsv","/home/ram/tmp/gmt/jp_00.cmt")
47
- pp cmt.size
48
- cmt_ = cmt.selectBy(:lon => "> 140",:lat => "> 30")
49
- pp cmt_.sizea
50
- filename = "bsv_from_bsv.txt"
51
- cmt_.to_file(filename)
52
- cmtFromCsv = ExtCsv.new(IMPORT_TYPE,"bsv",filename)
53
- cmtFromCsv.datacolumns.each {|col| assert_equal(cmtFromCsv.send(col),cmt_.send(col)) }
54
- end
55
45
  end
56
46
  def test_create_by_hash
57
47
  simple = ExtCsv.new("hash","txt",{:col1 => ["80.0"],:col2 => ["625.0"]})
@@ -268,7 +258,7 @@ class TestExtCsv < Test::Unit::TestCase
268
258
  def test_operate
269
259
  simple = ExtCsv.new(IMPORT_TYPE,"txt",TEST_DATA)
270
260
  simple_operated = simple.operate_on(:col1,"* 10")
271
- assert_not_equal(simple.col1, simple_operated)
261
+ assert(simple.col1 != simple_operated.col1, "unexpected equality")
272
262
  thiscol1 = 80.0
273
263
  col1s = simple.col1.dup
274
264
  simple_op_with_ifclause = simple.operate_on(:col1, '* 10 if self.col1[i].to_f == ' + thiscol1.to_s)
@@ -1,5 +1,5 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
- require 'test/unit'
2
+ require 'minitest/autorun'
3
3
  require 'extcsv'
4
4
  require 'extcsv_diagram'
5
5
  require 'pp'
@@ -7,7 +7,7 @@ require 'pp'
7
7
  ################################################################################
8
8
  # Author:: Ralf M�ller
9
9
  ################################################################################
10
- class TestExtCsvDisplay < Test::Unit::TestCase
10
+ class TestExtCsvDisplay < Minitest::Test
11
11
  include ExtCsvDiagram
12
12
 
13
13
  TEST_DIR = "test"
@@ -15,17 +15,6 @@ class TestExtCsvDisplay < Test::Unit::TestCase
15
15
  TEST_DATA_NEW = TEST_DIR + "/data/file01.txt"
16
16
  DATALOGGER_DATA = TEST_DIR + ""
17
17
  IMPORT_TYPE = "file"
18
- ICON = "/home/ram/src/git/icon/experiments/xom.r8563.tsrel_R2B02_linDesity/xomFldminT.dat"
19
- ICON = "/home/ram/src/git/icon/experiments/xom.r8563.tsrel_R2B02_200mThickness/xomFldmin.dat"
20
- ICON = "/home/ram/src/git/icon/experiments/xom.r8563.tsrel_R2B02_500mThickness/xomFldmin.dat"
21
- ICON = "/home/ram/src/git/icon/experiments/xom.r8563.tsrel_R2B02/xomFldmaxVert_Mixing_V.dat"
22
- ICON = "/home/ram/src/git/icon/experiments/xom.r8563.tsrel_R2B02_200mThickness/xomFldmaxVert_Mixing_V.dat"
23
- ICON = "/home/ram/src/git/icon/experiments/xom.r8563.tsrel_R2B02_500mThickness/xomFldmaxVert_Mixing_V.dat"
24
- ICON = "/home/ram/src/git/icon/experiments/xom.r8563.tsrel_R2B02_dev/xomFldmaxVert_Mixing_V.dat"
25
- ICON = "/home/ram/src/git/icon/experiments/xom.r8563.tsrel_R2B02_dev/xomFldmaxT.dat"
26
- VAR = "Vert_Mixing_Vel"
27
- VAR = "Vert_Mixing_V"
28
- VAR = "T"
29
18
 
30
19
  def test_simple
31
20
  f=ExtCsv.new("file","txt",TEST_DATA)
@@ -34,34 +23,21 @@ class TestExtCsvDisplay < Test::Unit::TestCase
34
23
  def test_colors
35
24
  pp ExtCsvDiagram.colors(21)
36
25
  end
37
- def _test_icon
38
- icon = ExtCsv.new(IMPORT_TYPE,"psv",ICON)
39
-
40
- icon.datetime = []
41
- icon.date.each_with_index{|date,i| icon.datetime << [date,icon.time[i]].join(' ') }
42
-
43
- puts "SIZE: #{icon.size}"
44
- [:date,:time,:depth,VAR.downcase.to_sym].each {|col| puts [col.to_s,icon.send(col).max].join('[max]: ') }
45
- ExtCsvDiagram.plot_xy(icon,"datetime",VAR.downcase,'ICON OCE_BASE: Mean. Temperatur (uneven levels, r8656, full run: 2001-2012)',
46
- :label_position => 'below',:skipColumnCheck => true,
47
- :type => 'lines',:groupBy => ["depth"],
48
- # :yrange => '[0.0001:10]',
49
- # :xrange => "",
50
- :onlyGroupTitle => true,
51
- # :addSettings => ["logscale y"],
52
- # :terminal => "png",
53
- :ylabel => "#{VAR} [degC]",
54
- :input_time_format => "'%Y%m%d %H:%M:%S'",
55
- :filename => "icon-OCE_BASE_uneven-r8656-fullrun-Mean#{VAR}",
56
- :output_time_format => "'%m.%y'",:size => "800,600")
57
-
58
- end
59
26
  def test_plotxy
60
27
  f = ExtCsv.new(IMPORT_TYPE,"txt",TEST_DATA)
61
28
  ExtCsvDiagram.plot_xy(f,"step","col5",'test',
62
29
  :label_position => 'outside',
63
30
  :groupBy => [:col4],
64
31
  :type => 'lines')
32
+ f = ExtCsv.new('file',"txt","#{ENV['HOME']}/data/icon/oce.txt")
33
+
34
+ assert(f.size > 0,'no data in input or file missing!')
35
+ f.add(:datetime,[f.date,f.time].transpose.map {|v| v.join(' ')})
36
+ pp f.datetime
37
+ ExtCsvDiagram.plot_xy(f.selectBy(:level => 3000),'datetime',
38
+ 'temp','icon text input',
39
+ :input_time_format => "'%Y-%m-%d %H:%M:%S'",
40
+ :output_time_format => "'%d.%m'")
65
41
  end
66
42
  def test_gnuplot
67
43
  test_file = TEST_DATA
@@ -70,7 +46,7 @@ class TestExtCsvDisplay < Test::Unit::TestCase
70
46
  qpol_drift = ExtCsv.new(IMPORT_TYPE,"txt",drift_test_file)
71
47
 
72
48
  f = qpol.selectBy(:col4 => /(5|4)/)
73
- assert_not_equal(0,f.size)
49
+ assert(0 < f.size,'Fount sero data!')
74
50
  ExtCsvDiagram.plot(f,["col4"],"col1",
75
51
  ["col5"],nil,[],'',
76
52
  :graph_title => "SIZEMODE",
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extcsv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.3
5
- prerelease:
4
+ version: 0.12.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ralf Mueller
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-26 00:00:00.000000000 Z
11
+ date: 2016-03-02 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description:
15
14
  email: stark.dreamdetective@gmail.com
@@ -17,57 +16,56 @@ executables: []
17
16
  extensions: []
18
17
  extra_rdoc_files: []
19
18
  files:
19
+ - LICENSE
20
+ - gemspec
20
21
  - lib/extcsv.rb
21
- - lib/lsmodel.rb
22
22
  - lib/extcsv_diagram.rb
23
+ - lib/lsmodel.rb
23
24
  - rakefile
24
- - gemspec
25
- - LICENSE
26
- - test/test_lsmodel.rb
27
- - test/test_extcsv.rb
28
- - test/test_extcsv_diagram.rb
29
- - test/data/file04.csv
30
- - test/data/file05.csv
31
25
  - test/data/bsv.txt
32
- - test/data/file02.txt
33
26
  - test/data/file00.txt
34
- - test/data/file03.txt
35
27
  - test/data/file01.txt
28
+ - test/data/file02.txt
29
+ - test/data/file03.txt
30
+ - test/data/file04.csv
31
+ - test/data/file05.csv
36
32
  - test/data/german.txt
33
+ - test/test_extcsv.rb
34
+ - test/test_extcsv_diagram.rb
35
+ - test/test_lsmodel.rb
37
36
  homepage: http://extcsv.rubyforge.org
38
37
  licenses: []
38
+ metadata: {}
39
39
  post_install_message:
40
40
  rdoc_options: []
41
41
  require_paths:
42
42
  - lib
43
43
  required_ruby_version: !ruby/object:Gem::Requirement
44
- none: false
45
44
  requirements:
46
- - - ! '>='
45
+ - - ">="
47
46
  - !ruby/object:Gem::Version
48
47
  version: '0'
49
48
  required_rubygems_version: !ruby/object:Gem::Requirement
50
- none: false
51
49
  requirements:
52
- - - ! '>='
50
+ - - ">="
53
51
  - !ruby/object:Gem::Version
54
52
  version: '0'
55
53
  requirements: []
56
54
  rubyforge_project: extcsv
57
- rubygems_version: 1.8.23
55
+ rubygems_version: 2.5.1
58
56
  signing_key:
59
- specification_version: 3
60
- summary: ! 'Let CSV-like files behave like DB-tables: selection, data operations on
57
+ specification_version: 4
58
+ summary: 'Let CSV-like files behave like DB-tables: selection, data operations on
61
59
  columns. Easy plotting with gnuplot and modelling'
62
60
  test_files:
63
61
  - test/test_lsmodel.rb
64
62
  - test/test_extcsv.rb
65
63
  - test/test_extcsv_diagram.rb
66
- - test/data/file04.csv
67
64
  - test/data/file05.csv
68
- - test/data/bsv.txt
69
- - test/data/file02.txt
65
+ - test/data/file04.csv
70
66
  - test/data/file00.txt
71
- - test/data/file03.txt
72
67
  - test/data/file01.txt
68
+ - test/data/file03.txt
73
69
  - test/data/german.txt
70
+ - test/data/file02.txt
71
+ - test/data/bsv.txt