iconPlot 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/gemspec +1 -1
- data/lib/iconPlot.rb +16 -8
- data/lib/icon_plot.ncl +38 -17
- data/lib/icon_plot_lib.ncl +36 -20
- data/test/test_iconPlot.rb +28 -29
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 721ca643ed23cd01c6f21a952ed38eee1ea291d6
|
4
|
+
data.tar.gz: 451c4f7948551d45b9f5ccd535cf197ebcbeb402
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c08f50348bda047c4425777138502005cf78f94113de4586c8384eb27aa8dd4fcda764eb78c9eb792194bd3b2fb0e7750efb3cdfcb9c6341bfb9ea67442b9549
|
7
|
+
data.tar.gz: ceb46c6e875d0efef1beffb5eabd33e0c4eb88f0af8d8dfeeed6125c20e122878e033ab4ed0480bfef28ccaf4a76d912c279d5b8735d4d61bd04ac423aa94074
|
data/gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
|
3
3
|
|
4
4
|
spec = Gem::Specification.new do |s|
|
5
5
|
s.name = "iconPlot"
|
6
|
-
s.version = '0.0
|
6
|
+
s.version = '0.1.0'
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.files = ["lib/iconPlot.rb"] + ["gemspec"] + ["bin/nclsh"] + Dir.glob("lib/*ncl")
|
9
9
|
s.executables << 'nclsh'
|
data/lib/iconPlot.rb
CHANGED
@@ -2,6 +2,7 @@ require 'fileutils'
|
|
2
2
|
require 'cdo'
|
3
3
|
require 'extcsv'
|
4
4
|
require 'shellwords'
|
5
|
+
require 'parallel'
|
5
6
|
|
6
7
|
class IconPlot < Struct.new(:caller,:plotter,:libdir,:otype,:display,:cdo,:debug,:isIcon)
|
7
8
|
VERSION = '0.0.4'
|
@@ -9,13 +10,15 @@ class IconPlot < Struct.new(:caller,:plotter,:libdir,:otype,:display,:cdo,:debug
|
|
9
10
|
def initialize(*args)
|
10
11
|
super(*args)
|
11
12
|
|
13
|
+
cdoPath = ENV['CDO'].nil? ? 'cdo' : ENV['CDO']
|
14
|
+
|
12
15
|
defaults = {
|
13
16
|
:caller => Gem.bin_path('iconPlot','nclsh'),
|
14
17
|
:plotter => Gem.find_files("icon_plot.ncl")[0],
|
15
18
|
:libdir => File.dirname(Gem.find_files("icon_plot.ncl")[0]),
|
16
19
|
:otype => 'png',
|
17
20
|
:display => 'sxiv',
|
18
|
-
:cdo =>
|
21
|
+
:cdo => Cdo.new(cdo: cdoPath),
|
19
22
|
:isIcon => true,
|
20
23
|
:debug => false
|
21
24
|
}
|
@@ -41,7 +44,12 @@ class IconPlot < Struct.new(:caller,:plotter,:libdir,:otype,:display,:cdo,:debug
|
|
41
44
|
cmd << " -altLibDir=#{self.libdir} #{varIdent} -iFile=#{ifile} -oFile=#{ofile} -oType=#{self.otype}"
|
42
45
|
cmd << " -isIcon" if self.isIcon
|
43
46
|
cmd << " -DEBUG" if self.debug
|
44
|
-
opts.each {|k,v|
|
47
|
+
opts.each {|k,v|
|
48
|
+
v = '"'+v+'"' if (:tStrg == k and not ['"',"'"].include?(v.strip[0]))
|
49
|
+
v = 'True' if v == true
|
50
|
+
v = 'False' if v == false
|
51
|
+
cmd << " -"<< [k,v].join('=')
|
52
|
+
}
|
45
53
|
puts cmd if self.debug
|
46
54
|
out = IO.popen(cmd).read
|
47
55
|
puts out if self.debug
|
@@ -67,8 +75,8 @@ class IconPlot < Struct.new(:caller,:plotter,:libdir,:otype,:display,:cdo,:debug
|
|
67
75
|
warn "Variable cannot be found!"
|
68
76
|
exit -1
|
69
77
|
end
|
70
|
-
|
71
|
-
unit =
|
78
|
+
self.cdo.debug = true
|
79
|
+
unit = self.cdo.showunit(:input => "-selname,#{varname} #{ifile}").first
|
72
80
|
ExtCsvDiagram.plot_xy(icon,"datetime",varname,
|
73
81
|
"ICON: #{operation} on #{varname} (file:#{ifile})", # Change title here
|
74
82
|
:label_position => 'below',:skipColumnCheck => true,
|
@@ -85,7 +93,7 @@ class IconPlot < Struct.new(:caller,:plotter,:libdir,:otype,:display,:cdo,:debug
|
|
85
93
|
def scatterPlot(ifile,ofile,xVarname,yVarname,opts={})
|
86
94
|
# is there a variable which discribes different regions in the ocean
|
87
95
|
regionVar = opts[:regionVar].nil? ? 'rregio_c' : opts[:regionVar]
|
88
|
-
hasRegion =
|
96
|
+
hasRegion = self.cdo.showname(:input => ifile).join.split.include?(regionName)
|
89
97
|
unless hasRegion
|
90
98
|
warn "Variable '#{regionName}' for showing regions is NOT found in the input '#{ifile}'!"
|
91
99
|
warn "Going on without plotting regions!"
|
@@ -100,7 +108,7 @@ class IconPlot < Struct.new(:caller,:plotter,:libdir,:otype,:display,:cdo,:debug
|
|
100
108
|
FileUtils.rm(file) if File.exists?(file)
|
101
109
|
end
|
102
110
|
def show(*files)
|
103
|
-
files.flatten
|
111
|
+
Parallel.map(files.flatten) {|file| out = IO.popen("#{self.display} #{file}").readlines; puts out.join if self.debug }
|
104
112
|
end
|
105
113
|
def defaultPlot(ifile,ofile,opts={})
|
106
114
|
show(scalarPlot(ifile,ofile,'T',opts))
|
@@ -115,8 +123,8 @@ class IconPlot < Struct.new(:caller,:plotter,:libdir,:otype,:display,:cdo,:debug
|
|
115
123
|
|
116
124
|
# read the date
|
117
125
|
IO.popen("echo 'date|time|depth|#{varname}' > #{dataFile}")
|
118
|
-
|
119
|
-
|
126
|
+
self.cdo.debug = true
|
127
|
+
self.cdo.outputkey('date,time,level,value',
|
120
128
|
:input => "-#{operation} -selname,#{varname} #{ifile} >>#{dataFile} 2>/dev/null")
|
121
129
|
|
122
130
|
# postprocessing for correct time values
|
data/lib/icon_plot.ncl
CHANGED
@@ -25,19 +25,38 @@
|
|
25
25
|
else
|
26
26
|
; --- Use the configuration file from the commandline option
|
27
27
|
if ( isvar("configFile") ) then
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
print(configFile)
|
29
|
+
print(""+configFile)
|
30
|
+
if("6.2.1" .eq. get_ncl_version()) then
|
31
|
+
if (fileexists(configFile)) then
|
32
|
+
print("Found configfile:"+configFile)
|
33
|
+
loadscript(configFile)
|
34
|
+
else
|
35
|
+
print("Could NOT find configfile:"+configFile)
|
36
|
+
exit()
|
37
|
+
end if
|
31
38
|
else
|
32
|
-
|
33
|
-
|
39
|
+
if (isfilepresent(configFile)) then
|
40
|
+
print("Found configfile:"+configFile)
|
41
|
+
loadscript(configFile)
|
42
|
+
else
|
43
|
+
print("Could NOT find configfile:"+configFile)
|
44
|
+
exit()
|
45
|
+
end if
|
34
46
|
end if
|
35
47
|
else
|
36
48
|
; --- Use the default config file
|
37
49
|
CONFIGFILE = getenv("HOME")+"/.icon_plot.rc"
|
38
|
-
if (
|
39
|
-
|
40
|
-
|
50
|
+
if("6.2.1" .eq. get_ncl_version()) then
|
51
|
+
if (fileexists(CONFIGFILE)) then
|
52
|
+
print("Found configfile:"+CONFIGFILE)
|
53
|
+
loadscript(CONFIGFILE)
|
54
|
+
end if
|
55
|
+
else
|
56
|
+
if (isfilepresent(CONFIGFILE)) then
|
57
|
+
print("Found configfile:"+CONFIGFILE)
|
58
|
+
loadscript(CONFIGFILE)
|
59
|
+
end if
|
41
60
|
end if
|
42
61
|
end if
|
43
62
|
end if
|
@@ -142,6 +161,7 @@
|
|
142
161
|
print("; hovCut : plot hovmoeller diagram, input is 'levIndex' and 'hovLC' 'hovRC'")
|
143
162
|
print("; hovLC, hovRC : start and end point of a section for hovCut - currently same longitude allowed only,")
|
144
163
|
print("; the Northern and Southern values are used as plotting boundaries; switches to hovCut")
|
164
|
+
print("; makeYLinear : enforce to linearize the yaxis of section and hovmoeller plots (default:False)")
|
145
165
|
print("; mapLine : (logical) draws continent lines on the plot (foreground/transparent)")
|
146
166
|
print("; maskName : variable to mask with. maskName is expected NOT to have time dimension")
|
147
167
|
print("; 'maskName=" + dq + "none" + dq + "' is same as default (no mask variable)")
|
@@ -161,6 +181,7 @@
|
|
161
181
|
print("; markCells : mark cell centers with dots")
|
162
182
|
print("; showNcd : display NDC Grid to find Normalized Device Coordinates on the plot")
|
163
183
|
print("; k2c : if True, perform Kelvin2Celsius shift (default:True)")
|
184
|
+
print("; remapOperator : interpolation operator for internal lonlat representation of icon grid (remapnn,remapcon[default])")
|
164
185
|
print(";")
|
165
186
|
print("; ATMOSPHERE STUFF:")
|
166
187
|
print("; atmLev : chooses vertical plot levels for atmosphere input (h: height,p:pressure,m:modellevel,default:p)")
|
@@ -231,6 +252,7 @@
|
|
231
252
|
if (.not. isvar("withLines")) withLines = True end if
|
232
253
|
if (.not. isvar("withLineLabels")) withLineLabels = False end if
|
233
254
|
if (.not. isvar("k2c")) k2c = True end if
|
255
|
+
if (.not. isvar("remapOperator")) remapOperator = "remapcon" end if
|
234
256
|
if (.not. isvar("isIcon")) isIcon = False end if
|
235
257
|
|
236
258
|
if (.not.isvar("mapType")) mapType = "lonlat" end if
|
@@ -244,6 +266,7 @@
|
|
244
266
|
if (.not.isvar("centerLon")) centerLon = -30. end if
|
245
267
|
if (.not.isvar("centerLat")) centerLat = 20. end if
|
246
268
|
if (.not.isvar("satDist")) satDist = 20. end if
|
269
|
+
if (.not.isvar("makeYLinear")) makeYLinear = False end if
|
247
270
|
if (.not.isvar("mapLine")) mapLine = True end if
|
248
271
|
if (.not.isvar("resolution")) resolution = "r90x45" end if
|
249
272
|
if (.not.isvar("vecRefLength")) vecRefLength = 8.0 end if
|
@@ -399,14 +422,12 @@
|
|
399
422
|
else
|
400
423
|
; perform some remapping to a regular grid because ncl cannot draw vector
|
401
424
|
; from unstructured grids
|
402
|
-
|
403
|
-
operator = "remapnn"
|
404
|
-
remapFilename = setRemapFilename(iFile,iType,resolution,atmLev,operator)
|
425
|
+
remapFilename = setRemapFilename(iFile,iType,resolution,atmLev,remapOperator)
|
405
426
|
print("remapFilename:"+remapFilename)
|
406
427
|
if (.not. checkRemappedFile(iFile,remapFilename,ivarname,iType,atmLev,atmPLevs,atmHLevs) ) then
|
407
428
|
addVars=(/""/)
|
408
|
-
print("PERFORM
|
409
|
-
remapForVecPlot(iFile,remapFilename,resolution,useMask,plotMode,DEBUG,addVars,
|
429
|
+
print("PERFORM "+remapOperator+" again!")
|
430
|
+
remapForVecPlot(iFile,remapFilename,resolution,useMask,plotMode,DEBUG,addVars,remapOperator)
|
410
431
|
end if
|
411
432
|
rFile = addfile( remapFilename+".nc", "r" )
|
412
433
|
end if
|
@@ -570,7 +591,7 @@
|
|
570
591
|
drawNDCGrid(wks)
|
571
592
|
end if
|
572
593
|
|
573
|
-
ResC = setDefaultResource(True,withLines,withLineLabels,fillMode,mapType)
|
594
|
+
ResC = setDefaultResource(True,withLines,withLineLabels,fillMode,mapType,makeYLinear)
|
574
595
|
|
575
596
|
if (.not. userColors) setDefaultColors(ResC,minVar,maxVar,DEBUG) end if
|
576
597
|
|
@@ -695,8 +716,8 @@
|
|
695
716
|
;plotGrid(wks,plot,var,coords(1,:),bounds,File,ResC,DEBUG)
|
696
717
|
boundslon = bounds(0,:,:)
|
697
718
|
boundslat = bounds(1,:,:)
|
698
|
-
|
699
|
-
gsid = gsn_add_polygon(wks,plot,ndtooned(boundslon),ndtooned(boundslat),
|
719
|
+
presGrid = plotGrid_62(wks,plot,var,boundslon,boundslat)
|
720
|
+
gsid = gsn_add_polygon(wks,plot,ndtooned(boundslon),ndtooned(boundslat),presGrid)
|
700
721
|
; }}}
|
701
722
|
;=======================================================================================
|
702
723
|
end if
|
@@ -747,7 +768,7 @@
|
|
747
768
|
end if
|
748
769
|
points = ispan(0,secPoints-1,1)*1.0
|
749
770
|
|
750
|
-
res = setDefaultSectionResource(points,secPoints,secLC,secRC,withLines,withLineLabels)
|
771
|
+
res = setDefaultSectionResource(points,secPoints,secLC,secRC,withLines,withLineLabels,makeYLinear)
|
751
772
|
setAutomaticPlotCaptions(res,plotMode,varName,File,iFile,timeStep,levIndex,iType,atmLev,k2c)
|
752
773
|
setLevels(selMode,res,minVar,maxVar,scaleLimit,numLevs,DEBUG)
|
753
774
|
setSectionVertLabel(res,iType,atmLev)
|
data/lib/icon_plot_lib.ncl
CHANGED
@@ -907,7 +907,7 @@ end
|
|
907
907
|
;---------------------------------------------------------------
|
908
908
|
; Create a default NCL resource
|
909
909
|
undef("setDefaultResource")
|
910
|
-
function setDefaultResource(verticallabelbar,withLines,withLineLabels,fillmode,maptype)
|
910
|
+
function setDefaultResource(verticallabelbar,withLines,withLineLabels,fillmode,maptype,makeYLinear)
|
911
911
|
begin
|
912
912
|
resource = True
|
913
913
|
resource@gsnMaximize = False
|
@@ -960,11 +960,14 @@ begin
|
|
960
960
|
resource@mpGreatCircleLinesOn = True
|
961
961
|
resource@stMinArrowSpacingF = 0.001
|
962
962
|
|
963
|
+
; linearize y axis if desired ===============================================
|
964
|
+
resource@gsnYAxisIrregular2Linear = makeYLinear
|
965
|
+
|
963
966
|
return resource
|
964
967
|
end
|
965
968
|
;---------------------------------------------------------------
|
966
969
|
undef("setDefaultSectionResource")
|
967
|
-
function setDefaultSectionResource(points,secpoints,seclc,secrc,withLines,withLineLabels)
|
970
|
+
function setDefaultSectionResource(points,secpoints,seclc,secrc,withLines,withLineLabels,makeYLinear)
|
968
971
|
begin
|
969
972
|
resource = True; plot mods desired
|
970
973
|
resource@gsnFrame = False; don't turn page yet
|
@@ -986,7 +989,8 @@ begin
|
|
986
989
|
resource@lbLabelAutoStride = True; nice label bar label stride
|
987
990
|
resource@gsnSpreadColors = True; use full range of colormap
|
988
991
|
resource@lbOrientation = "vertical"; vertical label bar
|
989
|
-
resource@pmLabelBarOrthogonalPosF = -0.
|
992
|
+
resource@pmLabelBarOrthogonalPosF = -0.04; move label bar closer to plot
|
993
|
+
resource@lbTitleString = "kg/m^3"
|
990
994
|
resource@lbTitlePosition = "Bottom"
|
991
995
|
; resource@gsnYAxisIrregular2Log = True
|
992
996
|
|
@@ -1007,6 +1011,10 @@ begin
|
|
1007
1011
|
|
1008
1012
|
; lines/labels inside the plot ================================================
|
1009
1013
|
setLineAndLineLabels(resource,withLines,withLineLabels)
|
1014
|
+
|
1015
|
+
; linearize y axis if desired ===============================================
|
1016
|
+
resource@gsnYAxisIrregular2Linear = makeYLinear
|
1017
|
+
|
1010
1018
|
return resource
|
1011
1019
|
end
|
1012
1020
|
;---------------------------------------------------------------
|
@@ -1018,7 +1026,7 @@ begin
|
|
1018
1026
|
resource@vcVectorDrawOrder = "Postdraw"
|
1019
1027
|
resource@vcFillArrowWidthF = 12.0
|
1020
1028
|
resource@lbOrientation = "Vertical"
|
1021
|
-
resource@lbTitleString = "
|
1029
|
+
resource@lbTitleString = "kg/m^3"
|
1022
1030
|
resource@lbTitlePosition = "Left"
|
1023
1031
|
resource@cnInfoLabelOn = False
|
1024
1032
|
resource@lbTitleFontHeightF = 0.02
|
@@ -1031,7 +1039,7 @@ undef("setDefaultColors")
|
|
1031
1039
|
procedure setDefaultColors(resource,minval,maxval,debug)
|
1032
1040
|
begin
|
1033
1041
|
; white is color 135
|
1034
|
-
if ((minval*maxval) .LT. 0.0) then ; data goes
|
1042
|
+
if ((minval*maxval) .LT. 0.0) then ; data goes from positiv to negative or vs.
|
1035
1043
|
if (abs(maxval) .GT. abs(minval)) then
|
1036
1044
|
resource@gsnSpreadColorStart = 135 - toint(126*(abs(minval)/abs(maxval)))
|
1037
1045
|
resource@gsnSpreadColorEnd = 255
|
@@ -1194,7 +1202,7 @@ end
|
|
1194
1202
|
undef("setSectionVertLabel")
|
1195
1203
|
procedure setSectionVertLabel(resource,itype,atmlev)
|
1196
1204
|
begin
|
1197
|
-
resource@lbTitleString = "[
|
1205
|
+
resource@lbTitleString = "[kg/m^3]"
|
1198
1206
|
label = ""
|
1199
1207
|
reversYAxis = True
|
1200
1208
|
if (itype .eq. "atm") then
|
@@ -1324,10 +1332,10 @@ undef("checkMinMaxVar")
|
|
1324
1332
|
procedure checkMinMaxVar(minvar,maxvar)
|
1325
1333
|
begin
|
1326
1334
|
if ( (.not. ismissing(minvar)) .and. (.not. ismissing(maxvar)) ) then
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1335
|
+
if ( minvar .gt. maxvar ) then
|
1336
|
+
print("minVar has to be larger than maxVar")
|
1337
|
+
exit
|
1338
|
+
end if
|
1331
1339
|
end if
|
1332
1340
|
end
|
1333
1341
|
;---------------------------------------------------------------
|
@@ -1359,6 +1367,12 @@ begin
|
|
1359
1367
|
lonlat = str_split(variable@coordinates," ")
|
1360
1368
|
lon = lonlat(0)
|
1361
1369
|
lat = lonlat(1)
|
1370
|
+
; check for real names of coordinate; order is not pre-defines
|
1371
|
+
lonIsLon = str_match(lon,"lon")
|
1372
|
+
if (ismissing(lonIsLon)) then
|
1373
|
+
lon = lonlat(1)
|
1374
|
+
lat = lonlat(0)
|
1375
|
+
end if
|
1362
1376
|
else
|
1363
1377
|
lon = "lon"
|
1364
1378
|
lat = "lat"
|
@@ -1930,24 +1944,26 @@ begin
|
|
1930
1944
|
"cnFillColors" : colors
|
1931
1945
|
end getvalues
|
1932
1946
|
;---All triangles less than lowest level
|
1933
|
-
|
1934
|
-
if(.not.all(ismissing(
|
1935
|
-
gscolors(
|
1947
|
+
vindStart = ind(var .lt. levels(0))
|
1948
|
+
if(.not.all(ismissing(vindStart))) then
|
1949
|
+
gscolors(vindStart) = colors(0)
|
1936
1950
|
end if
|
1937
1951
|
|
1938
1952
|
;---All triangles inbetween levels
|
1939
1953
|
do i = 1, dimsizes(levels) - 1
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1954
|
+
;print("index = "+s)
|
1955
|
+
;print(dimsizes(ind(var .ge. levels(i-1) .and. var .lt. levels(i))))
|
1956
|
+
vindMiddle = ind(var .ge. levels(i-1) .and. var .lt. levels(i))
|
1957
|
+
if(.not.all(ismissing(vindMiddle))) then
|
1958
|
+
gscolors(vindMiddle) = colors(i)
|
1943
1959
|
end if
|
1960
|
+
delete(vindMiddle)
|
1944
1961
|
end do
|
1945
1962
|
|
1946
1963
|
;---All triangles higher than highest level
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
gscolors(vind) = colors(dimsizes(levels)-1)
|
1964
|
+
vindEnd = ind(var .ge. levels(dimsizes(levels)-1))
|
1965
|
+
if(.not.all(ismissing(vindEnd))) then
|
1966
|
+
gscolors(vindEnd) = colors(dimsizes(levels)-1)
|
1951
1967
|
end if
|
1952
1968
|
|
1953
1969
|
pres@gsColors = gscolors
|
data/test/test_iconPlot.rb
CHANGED
@@ -1,52 +1,51 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
2
1
|
require "minitest/autorun"
|
2
|
+
require 'parallelQueue'
|
3
|
+
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
3
4
|
require "iconPlot"
|
4
5
|
|
5
6
|
class TestIconPlot < Minitest::Test
|
6
7
|
|
7
|
-
CALLER = "/home/ram/src/
|
8
|
-
PLOTTER = "/home/ram/src/
|
9
|
-
PLOTLIB = "/home/ram/src/
|
8
|
+
CALLER = "/home/ram/src/iconPlot/contrib/nclsh"
|
9
|
+
PLOTTER = "/home/ram/src/iconPlot/icon_plot.ncl"
|
10
|
+
PLOTLIB = "/home/ram/src/iconPlot"
|
10
11
|
LS = 'ls -crtlh'
|
11
|
-
OCE_PLOT_TEST_FILE = ENV['HOME']+'/data/icon/oce.nc'
|
12
|
-
OCELSM_PLOT_TEST_FILE = ENV['HOME']+'/data/icon/oce_lsm.nc'
|
13
|
-
OCELONG_PLOT_TEST_FILE = ENV['HOME']+'/data/icon/oceLong.nc'
|
14
|
-
ATM_PLOT_TEST_FILE = ENV['HOME']+'/data/icon/atm.nc'
|
15
|
-
OCE_REGPLOT_TEST_FILE = ENV['HOME']+'/data/icon/regular_oce.nc' #remapnn,r180x90
|
16
|
-
ATM_REGPLOT_TEST_FILE = ENV['HOME']+'/data/icon/regular_atm.nc' #remapnn,n63 (no sections), r180x90 (with sections)
|
12
|
+
OCE_PLOT_TEST_FILE = ENV['HOME']+'/local/data/icon/oce.nc'
|
13
|
+
OCELSM_PLOT_TEST_FILE = ENV['HOME']+'/local/data/icon/oce_lsm.nc'
|
14
|
+
OCELONG_PLOT_TEST_FILE = ENV['HOME']+'/local/data/icon/oceLong.nc'
|
15
|
+
ATM_PLOT_TEST_FILE = ENV['HOME']+'/local/data/icon/atm.nc'
|
16
|
+
OCE_REGPLOT_TEST_FILE = ENV['HOME']+'/local/data/icon/regular_oce.nc' #remapnn,r180x90
|
17
|
+
ATM_REGPLOT_TEST_FILE = ENV['HOME']+'/local/data/icon/regular_atm.nc' #remapnn,n63 (no sections), r180x90 (with sections)
|
17
18
|
OFMT = 'png'
|
18
19
|
PLOT_CMD = 'sxiv'
|
19
20
|
CDO = ENV['CDO'].nil? ? 'cdo' : ENV['CDO']
|
20
|
-
if '
|
21
|
+
if 'luthien' == `hostname`.chomp
|
21
22
|
def test_simple
|
22
23
|
ip = IconPlot.new(CALLER,PLOTTER,PLOTLIB,OFMT,PLOT_CMD,CDO,true)
|
23
24
|
ip.debug = true
|
24
25
|
ofile = 'test_icon_plot'
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
ip.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
ip.show(
|
39
|
-
ip.show(ip.scalarPlot("remapnn_r90x45_oce_lsm.nc","reg_lsm_"+ofile,"T",:vecVars => "u-veloc,v-veloc",:levIndex => 2,:mapType => "ortho",:maskName => 'wet_c'))
|
40
|
-
ip.show(ip.scalarPlot("remapnn_r90x45_oce_lsm.nc","reg_lsm_"+ofile,"wet_c",:vecVars => "u-veloc,v-veloc",:levIndex => 2,:mapType => "ortho",:maskName => 'wet_c'))
|
26
|
+
q = ParallelQueue.new
|
27
|
+
q.push {ip.scalarPlot(OCE_PLOT_TEST_FILE, ofile+'_00',"T",:levIndex => 0) }
|
28
|
+
q.push {ip.scalarPlot(OCE_PLOT_TEST_FILE, ofile+'_01',"T",:levIndex => 2) }
|
29
|
+
q.push {ip.vectorPlot(OCE_PLOT_TEST_FILE, ofile+'_02',"u-veloc v-veloc",:levIndex => 2) }
|
30
|
+
q.push {ip.scalarPlot(OCE_PLOT_TEST_FILE, ofile+'_03',"T",:vecVars => "u-veloc,v-veloc",:levIndex => 2,:mapType => "ortho") }
|
31
|
+
q.push {ip.scalarPlot(OCE_PLOT_TEST_FILE, ofile+'_04',"T",:vecVars => "u-veloc,v-veloc",:levIndex => 2,:secLC => "-20,-60", :secRC => "-20,60") }
|
32
|
+
q.push {ip.scalarPlot(OCELSM_PLOT_TEST_FILE,ofile+'_05',"T",:vecVars => "u,v",:levIndex => 2,:secLC => "-20,-60", :secRC => "-20,60",:maskName => 'wet_c') }
|
33
|
+
q.push {ip.scalarPlot(OCELSM_PLOT_TEST_FILE,ofile+'_05',"T",:vecVars => "u,v",:levIndex => 2,:secLC => "-50,-60", :secRC => "0,60",:maskName => 'wet_c',:secMode => 'circle') }
|
34
|
+
q.push {ip.scalarPlot(OCELSM_PLOT_TEST_FILE,ofile+'_06',"T",:vecVars => "u,v",:levIndex => 2,:maskName => 'wet_c') }
|
35
|
+
q.push {ip.scalarPlot(OCELSM_PLOT_TEST_FILE,ofile+'_07',"T",:levIndex => 2,:maskName => 'wet_c') }
|
36
|
+
|
37
|
+
images = q.run
|
38
|
+
|
39
|
+
ip.show(*images)
|
41
40
|
end
|
42
41
|
end
|
43
|
-
def
|
42
|
+
def _test_defaults
|
44
43
|
p = IconPlot.new
|
45
44
|
assert_includes(p.caller.split(File::SEPARATOR),'gems')
|
46
45
|
assert_includes(p.plotter.split(File::SEPARATOR),'gems')
|
47
46
|
assert_includes(p.libdir.split(File::SEPARATOR),'gems')
|
48
47
|
end
|
49
|
-
def
|
48
|
+
def _test_levelPlot
|
50
49
|
p = IconPlot.new
|
51
50
|
p.show( p.levelPlot(OCELONG_PLOT_TEST_FILE,'test_levelPlot_00','T',:operation => :fldmax))
|
52
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iconPlot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ralf Mueller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cdo
|
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
version: '0'
|
86
86
|
requirements: []
|
87
87
|
rubyforge_project:
|
88
|
-
rubygems_version: 2.
|
88
|
+
rubygems_version: 2.5.1
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: Plot ICON output with ncl via Ruby
|