cdp 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/gemspec +22 -0
- data/lib/cdp.rb +54 -0
- metadata +63 -0
data/gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
3
|
+
|
4
|
+
spec = Gem::Specification.new do |s|
|
5
|
+
s.name = "cdp"
|
6
|
+
s.version = '0.0.1'
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.files = ["lib/cdp.rb"] + ["gemspec"]
|
9
|
+
# s.test_file = "test/test_cdo.rb"
|
10
|
+
s.description = "Climate Data Processing helpers"
|
11
|
+
s.summary = "---"
|
12
|
+
s.author = "Ralf Mueller"
|
13
|
+
s.email = "stark.dreamdetective@gmail.com"
|
14
|
+
# s.homepage = "https://code.zmaw.de/projects/cdo/wiki/Cdo%7Brbpy%7D"
|
15
|
+
# s.extra_rdoc_files = ["README.rdoc","COPYING"]
|
16
|
+
s.license = "BSD"
|
17
|
+
s.has_rdoc = false
|
18
|
+
s.required_ruby_version = ">= 1.9"
|
19
|
+
s.add_dependency("cdo")
|
20
|
+
end
|
21
|
+
|
22
|
+
# vim:ft=ruby
|
data/lib/cdp.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'cdo'
|
2
|
+
module CDP
|
3
|
+
|
4
|
+
def CDP.setCDO
|
5
|
+
#===============================================================================
|
6
|
+
# setup of CDO on different machines
|
7
|
+
hostname = Socket.gethostname
|
8
|
+
case hostname
|
9
|
+
when /thingol/
|
10
|
+
Cdo.setCdo(ENV['HOME']+"/local/bin/cdo-dev")
|
11
|
+
when /lizard/
|
12
|
+
Cdo.setCdo(ENV['HOME']+"/local/rhel55-x64/bin/cdo")
|
13
|
+
when /blizzard/
|
14
|
+
Cdo.setCdo(ENV['HOME']+"/local/bin/cdo")
|
15
|
+
else
|
16
|
+
puts "Use default Cdo:#{Cdo.getCdo} (version:#{Cdo.version})"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def CDP.setDEBUG
|
21
|
+
Cdo.checkCdo
|
22
|
+
Cdo.debug = true unless ENV['DEBUG'].nil?
|
23
|
+
end
|
24
|
+
|
25
|
+
#===============================================================================
|
26
|
+
# compute the experiments from the data directories and link the corresponding files
|
27
|
+
def CDP.splitFilesIntoExperiments(files)
|
28
|
+
gridFile = files.pop
|
29
|
+
experiments = files.map {|f| File.basename(File.dirname(f))}.uniq.sort_by {|f| f.length}.reverse
|
30
|
+
# take the larges part of the filenames as experiment name if the files are in
|
31
|
+
# the current directory
|
32
|
+
if experiments == ["."] then
|
33
|
+
n = files.map(&:size).min.times.map {|i|
|
34
|
+
if files.map {|f| f[0,i-1]}.uniq.size == 1
|
35
|
+
1
|
36
|
+
else
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
}.find_all {|v| not v.nil?}.size-1
|
40
|
+
uniqName = files[0][0,n]
|
41
|
+
experiments = [uniqName]
|
42
|
+
end
|
43
|
+
experimentFiles, experimentAnalyzedData = {},{}
|
44
|
+
experiments.each {|experiment|
|
45
|
+
experimentFiles[experiment] = files.grep(/#{experiment}/)
|
46
|
+
experimentFiles[experiment].each {|file| files.delete(file)}
|
47
|
+
experimentFiles[experiment].sort!
|
48
|
+
|
49
|
+
experimentAnalyzedData[experiment] = []
|
50
|
+
}
|
51
|
+
|
52
|
+
[gridFile,experimentFiles,experimentAnalyzedData]
|
53
|
+
end
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cdp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ralf Mueller
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: cdo
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: Climate Data Processing helpers
|
31
|
+
email: stark.dreamdetective@gmail.com
|
32
|
+
executables: []
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- lib/cdp.rb
|
37
|
+
- gemspec
|
38
|
+
homepage:
|
39
|
+
licenses:
|
40
|
+
- BSD
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '1.9'
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 1.8.23
|
60
|
+
signing_key:
|
61
|
+
specification_version: 3
|
62
|
+
summary: ! '---'
|
63
|
+
test_files: []
|