gphys 1.5.5 → 1.5.7

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.
Files changed (41) hide show
  1. checksums.yaml +5 -5
  2. data/ChangeLog +0 -7595
  3. data/LICENSE.txt +1 -1
  4. data/bin/gpcut +12 -0
  5. data/bin/gpvect +88 -77
  6. data/bin/gpview +200 -103
  7. data/ext/numru/ganalysis/ext_init.c +9 -0
  8. data/ext/numru/ganalysis/extconf.rb +43 -0
  9. data/ext/numru/ganalysis/narray_ext_dfloat.c +84 -0
  10. data/ext/numru/ganalysis/pde_ext.c +130 -0
  11. data/ext/numru/gphys/dim_op.c +336 -44
  12. data/ext/numru/gphys/ext_init.c +6 -0
  13. data/ext/numru/gphys/interpo.c +326 -3
  14. data/gphys.gemspec +1 -0
  15. data/lib/numru/dclext.rb +78 -16
  16. data/lib/numru/ganalysis/beta_plane.rb +6 -4
  17. data/lib/numru/ganalysis/eof.rb +63 -41
  18. data/lib/numru/ganalysis/fitting.rb +109 -30
  19. data/lib/numru/ganalysis/histogram.rb +3 -3
  20. data/lib/numru/ganalysis/log_p.rb +20 -0
  21. data/lib/numru/ganalysis/lomb_scargle.rb +205 -0
  22. data/lib/numru/ganalysis/met_z.rb +132 -3
  23. data/lib/numru/ganalysis/narray_ext.rb +13 -0
  24. data/lib/numru/ganalysis/pde.rb +109 -0
  25. data/lib/numru/ganalysis/planet.rb +136 -1
  26. data/lib/numru/ganalysis/qg.rb +224 -3
  27. data/lib/numru/ggraph.rb +95 -23
  28. data/lib/numru/gphys/axis.rb +4 -2
  29. data/lib/numru/gphys/gphys.rb +6 -5
  30. data/lib/numru/gphys/gphys_dim_op.rb +69 -6
  31. data/lib/numru/gphys/gphys_fft.rb +30 -0
  32. data/lib/numru/gphys/gphys_io_common.rb +2 -0
  33. data/lib/numru/gphys/grads_gridded.rb +77 -29
  34. data/lib/numru/gphys/grib.rb +2 -2
  35. data/lib/numru/gphys/grib_params.rb +3 -3
  36. data/lib/numru/gphys/interpolate.rb +153 -1
  37. data/lib/numru/gphys/varraycomposite.rb +7 -4
  38. data/lib/numru/gphys/version.rb +1 -1
  39. data/lib/numru/gphys.rb +1 -0
  40. data/testdata/pres.jan.nc +0 -0
  41. metadata +13 -4
data/bin/gpview CHANGED
@@ -3,17 +3,17 @@
3
3
  =begin
4
4
  = NAME
5
5
 
6
- gpview - quick viewer for the values of a variable specified by a gtool4-type URL.
6
+ gpview - quick viewer for the values of a variable specified by a gtool4-type URL.
7
7
 
8
8
 
9
9
  (1) for 1-dimensional variable, make line plot.
10
10
  (2) for 2-dimensional variable, make contour/tone plot.
11
- (3) for 3/more-dimensional variable, make contour/tone plot,
11
+ (3) for 3/more-dimensional variable, make contour/tone plot,
12
12
  select first 2D. possible to make animation.
13
-
13
+
14
14
  = USAGE
15
15
 
16
- The first command form is
16
+ The first command form is
17
17
 
18
18
  % gpview [options] gturl1 gturl2 gturl3 ...
19
19
 
@@ -21,11 +21,20 @@ where the format of the gturl is
21
21
 
22
22
  path[@|/]varname[,dimname=pos1[:pos2[:thinning_intv]][,dimname=...]]
23
23
 
24
- The second commnad form is
24
+ When the slice parameters are the same throughout the all Gphys
25
+ variables, the following form can be used:
26
+
27
+ % gpview --slice <slice> [options] file1@var1 file2@var2 ...
28
+
29
+ where the format of the slice is
30
+
31
+ dimname=pos1[:pos2[:thinning_intv]][,dimname=...]]
32
+
33
+ The second commnad form is
25
34
 
26
35
  % gpview --var url [options] gtfile1 gtfile2 ...
27
36
 
28
- where the format of the url is
37
+ where the format of the url is
29
38
 
30
39
  varname[,dimname=pos1[:pos2[:thinning_intv]][,dimname=...]]
31
40
 
@@ -37,19 +46,22 @@ if you want to know more description, please read
37
46
 
38
47
  == GLOBAL OPTIONS
39
48
 
40
- :--help:
41
- print this message.
49
+ :--help:
50
+ print this message.
42
51
 
43
52
  :--var url:
44
53
  set the variable name and slicing parameters.
45
54
 
55
+ :--slice url:
56
+ set the slicing parameters.
57
+
46
58
  :--wsn [1-4]:
47
59
  set work staion number. each number represent output device:
48
- * for dcl-6,
60
+ * for dcl-6,
49
61
  1 : X window
50
62
  2.: PDF file (named dcl.pdf).
51
- * for dcl-5-?,
52
- 1 : X window,
63
+ * for dcl-5-?,
64
+ 1 : X window,
53
65
  2 : PS file. (named dcl.ps)
54
66
  3 : Tektronix terminal
55
67
  4 : GTK Windows
@@ -59,19 +71,19 @@ if you want to know more description, please read
59
71
 
60
72
  :--itr [1-4,5-7,10-15,20-23,30-33]:
61
73
  set axis scale. default is 1.
62
- 1 : linear scale for x/y axis
74
+ 1 : linear scale for x/y axis
63
75
  2 : linear scale for x , log scale for y axis
64
76
  3 : log scale for x , linear scale for y axis
65
77
  4 : log scale for x/y axis
66
78
 
67
79
  :--similar [simfac,vxoff,vyoff]:
68
- (for 5<=itr<=7) set similarity parameters which are fed in DCL.grssim.
80
+ (for 5<=itr<=7) set similarity parameters which are fed in DCL.grssim.
69
81
 
70
82
  :--map_axis [uxc,uyc,rot]:
71
- (for 10<=itr<=33) set mapping parameters which are fed in DCL.umpcnt.
83
+ (for 10<=itr<=33) set mapping parameters which are fed in DCL.umpcnt.
72
84
 
73
85
  :--map_radius <radius>:
74
- (for itr>=20) set clipping radius (degree) around the tangential point.
86
+ (for itr>=20) set clipping radius (degree) around the tangential point.
75
87
  Deafault=90.
76
88
 
77
89
  :--xcoord [xcoord]
@@ -87,16 +99,16 @@ if you want to know more description, please read
87
99
  set aspect ratio of Viewport. default is 2.0.
88
100
 
89
101
  :--noannotate:
90
- not draw annotations.
102
+ not draw annotations.
91
103
 
92
104
  :--animate/anim <dim>:
93
- plot animation along <dim>. <dim> must be name of dimension.
105
+ plot animation along <dim>. <dim> must be name of dimension.
94
106
 
95
- :--alternate, --Ga:
107
+ :--alternate, --Ga:
96
108
  enable to backing store.
97
109
 
98
110
  :--nowait, --Gw:
99
- not wait for any actions if animate
111
+ not wait for any actions if animate
100
112
 
101
113
  :--delay <number>:
102
114
  wait <number> seconds for each new page drawing of animation
@@ -111,39 +123,42 @@ if you want to know more description, please read
111
123
  exchange(transpose) x/y axis.
112
124
 
113
125
  :--mean <dim>:
114
- mean along axis <dim>.
126
+ mean along axis <dim>.
127
+
128
+ :--sum <dim>:
129
+ sum up along axis <dim>.
115
130
 
116
131
  :--stddev <dim>:
117
132
  standard deviation along axis <dim>.
118
133
 
119
134
  :--eddy <dim>:
120
- deviation from mean along axis <dim>.
135
+ deviation from mean along axis <dim>.
121
136
 
122
137
  :--diff:
123
138
  calculate the difference of two variables.
124
- you must provide two gturls whose size and dimension are same.
139
+ you must provide two gturls whose size and dimension are same.
125
140
 
126
- :--m, --map <map_type>:
141
+ :--m, --map <map_type>:
127
142
  plot map. itr number must be set. this option is neglect if itr
128
143
  number is 1-4. abailable map type is coast_world, border_world,
129
144
  plate_world, state_usa, coast_japan, pref_japan
130
145
 
131
- :--operation <math_func>:
146
+ :--operation <math_func>:
132
147
  operation of the specified math function on the data.
133
- <math_func> should be a math function with one argument
148
+ <math_func> should be a math function with one argument
134
149
  such as log10, sqrt, sin, etc.
135
150
 
136
- :--time_ax [nil|false|h|ymd]:
137
- specify type of calendar-type time axis:
151
+ :--time_ax [nil|false|h|ymd]:
152
+ specify type of calendar-type time axis:
138
153
  nil (=> auto slection)
139
- false (=> do not use the time axis even if
154
+ false (=> do not use the time axis even if
140
155
  the units of the axis is a time one with since field)
141
156
  "h" (=> like nil, but always use the hour-resolving datetime_ax method
142
157
  in dclext_datetime_ax.rb)
143
158
  "ymd" (=> like "h" but for y-m-d type using DCL.uc[xy]acl)
144
159
 
145
160
  :-xx:yyyy=value:
146
- specify Dennou Club Library internal variable.
161
+ specify Dennou Club Library internal variable.
147
162
  'xx' is a package name prefix of DCL (eg. sg=>sgpack).
148
163
  'yy' is a variable name of DCL.
149
164
  'value' is a value of the DCL variable.
@@ -171,7 +186,7 @@ if you want to know more description, please read
171
186
 
172
187
  :--overplot_color, --Opc
173
188
  multiple lines are distinguished with color rather than line type.
174
-
189
+
175
190
  == CONTOUR/TONE OPTIONS
176
191
 
177
192
  :--shade:
@@ -192,28 +207,46 @@ if you want to know more description, please read
192
207
  :--srange:
193
208
  set min/max value for tone plot. this is more dominant than --interval/int
194
209
 
195
- :--interval,--int [num]:
210
+ :--interval,--int [num]:
196
211
  set interval value for contour/tone plot. set the number of lines if
197
212
  you set negative value.
198
213
 
199
214
  :--cint:
200
- set interval value for contour plot. this is more dominant
215
+ set interval value for contour plot. this is more dominant
201
216
  than --interval/int
202
217
 
203
- :--sint:
218
+ :--sint:
204
219
  set interval value for tone plot. this is more dominant than --interval/int.
205
-
206
- :--levels:
207
- set values of contour/tone levels.
208
220
 
209
- :--clevels:
210
- set values of contour levels.
221
+ :--levels:
222
+ set values of contour/tone levels.
223
+
224
+ :--clevels:
225
+ set values of contour levels.
226
+
227
+ :--slevels:
228
+ set tone of contour levels.
229
+
230
+ :--patterns:
231
+ set each patterns for tone plot.
211
232
 
212
- :--slevels:
213
- set tone of contour levels.
233
+ :--clog:
234
+ approximately log-scaled levels for contour plot.
214
235
 
215
- :--patterns:
216
- set each patterns for tone plot.
236
+ :--slog:
237
+ approximately log-scaled levels for tone plot.
238
+
239
+ :--clog_cycle [1|2|3|]::
240
+ number of levels in one-order for log-countour plot (default 3).
241
+
242
+ :--slog_cycle [1|2|3|]:
243
+ number of levels in one-order for log-tone plot (default 3).
244
+
245
+ :--log:
246
+ approximately log-scaled levels for tone and contour plot.
247
+
248
+ :--log_cycle [1|2|3|]::
249
+ number of levels in one-order for log- tone and countour plot (default 3).
217
250
 
218
251
  :--tone [a|e|f|b|c]:
219
252
  set tone subroutine:
@@ -223,10 +256,15 @@ if you want to know more description, please read
223
256
  b (=> DCL.uetonb is used)
224
257
  c (=> DCL.uetonc is used)
225
258
 
226
- :--nocolorbar:
259
+ :--colorbar_pos [b|l]:
260
+ set position of color bar
261
+ b (=> bottom (default)
262
+ l (=> left
263
+
264
+ :--nocolorbar:
227
265
  do not draw color bar
228
266
 
229
- :--nozero:
267
+ :--nozero:
230
268
  do not draw zero contour
231
269
 
232
270
  :--udsfmt [strings]:
@@ -234,12 +272,12 @@ if you want to know more description, please read
234
272
 
235
273
  = EXAMPLES
236
274
 
237
- For a single GPhys variable,
275
+ For a single GPhys variable,
238
276
 
239
277
  % gpview data.nc@temp
240
278
  % gpview data.nc@temp,lon=130:150,lat=0:90:2
241
- % gpview --nocont data.nc@temp,lon=130:150,lat=0
242
- % gpview --noshade data.nc@temp,lon=130:150,lat=0
279
+ % gpview --nocont data.nc@temp,lon=130:150,lat=0
280
+ % gpview --noshade data.nc@temp,lon=130:150,lat=0
243
281
  % gpview --mean lon data.nc@temp,lon=130:150,lat=0
244
282
  % gpview --exch data.nc@temp,lon=130:150,lat=0
245
283
  % gpview --animate lon data.nc@temp,lon=130:150
@@ -255,12 +293,13 @@ For a single GPhys variable,
255
293
  Example to set DCL internal variable,
256
294
  % gpview -ud:lmsg=false --itr 5 --exch data.nc@temp,lon=0
257
295
 
258
- For multiple GPhys variables,
296
+ For multiple GPhys variables,
259
297
  % gpview data1.nc@temp data2.nc@temp
260
- % gpview data1.nc@temp,lon=130:150 data2.nc@temp,lon=150:170
261
- % gpview --overplot=3 --anim t data.nc@temp,lon=0 data.nc@temp,lon=10
262
- % gpview --var temp,lon=130:150 data?.nc
263
- % gpview --anim t --var temp,lon=130:150 data*.nc
298
+ % gpview data1.nc@temp,lon=130:150 data2.nc@temp,lon=150:170
299
+ % gpview --overplot=3 data.nc@temp,lon=0 data.nc@temp,lon=10
300
+ % gpview --slice lon=130,lat=0 data1.nc@temp data2.nc@temp --overplot 2
301
+ % gpview --var temp,lon=130:150 data?.nc
302
+ % gpview --anim t --var temp,lon=130:150 data*.nc
264
303
 
265
304
  =end
266
305
  #
@@ -271,9 +310,9 @@ For multiple GPhys variables,
271
310
  # 2005/01/09 D Tsukahara (add option --animate, smooth, alternate, index )
272
311
  # 2005/01/10 D Tsukahara (transpose axis with attr "positive:down" ,
273
312
  # abailable loopsense_flag. )
274
- # 2005/01/10 D Tsukahara (implement GGraph::color_bar, and margin_info,
313
+ # 2005/01/10 D Tsukahara (implement GGraph::color_bar, and margin_info,
275
314
  # which file name, date, and toolname. )
276
- # 2005/01/11 D Tsukahara ( 1. write document about OPTIONS.
315
+ # 2005/01/11 D Tsukahara ( 1. write document about OPTIONS.
277
316
  # 2. add many options. more info please see document. )
278
317
  # 2005/01/23 S Takehiro (add option --similar, map_axis)
279
318
  # 2005/02/09 D Tsukahara && M Nakano (add option --reverse, --Gr, --map)
@@ -287,7 +326,7 @@ For multiple GPhys variables,
287
326
  # 2005/08/07 S Takehiro (option --overplot implemented)
288
327
  # 2005/08/09 S Takehiro && T Horinouchi (add option --help and help function.
289
328
  # URL information corrected. )
290
- # 2005/08/23 S Takehiro (multiple Gphys variables plotting
329
+ # 2005/08/23 S Takehiro (multiple Gphys variables plotting
291
330
  # and option --var implemented)
292
331
  # 2005/08/23 S Takehiro (common methods to gp* command moved to gpcommon.rb)
293
332
  # 2005/10/30 S Takehiro (option --animate recoverd)
@@ -301,7 +340,7 @@ For multiple GPhys variables,
301
340
  # 2011/11/04 S Takehiro (option --time_ax implemented)
302
341
  # 2011/11/20 S Takehiro (option --eddy implemented)
303
342
  # 2012/02/19 S Takehiro (description for gturl format updated)
304
- # 2013/01/29 T Tanigawa && S Takehiro (calculation of aspect ratio
343
+ # 2013/01/29 T Tanigawa && S Takehiro (calculation of aspect ratio
305
344
  # of viewport improved)
306
345
  # 2013/01/29 S Nishizawa && S Takehiro (sequential operation implemented)
307
346
  # 2014/02/21 Y Naito && S Takehiro (implement DCL internal variable setting,
@@ -318,6 +357,11 @@ For multiple GPhys variables,
318
357
  # 2015/09/05 Y O Takahashi && S Takehiro (add option --delay)
319
358
  # 2015/09/06 Y O Takahashi && S Takehiro (defalt wsn number changed)
320
359
  # 2017/06/07 S Takehiro (int option bug fix)
360
+ # 2021/02/22 S Takehiro (added options --log, --log_scale, --clog, --clog_scale, --slog, --slog_scale)
361
+ # 2021/05/19 S Takehiro (added options --sum)
362
+ # 2021/05/25 S Takehiro (added options --slice)
363
+ # 2021/07/16 S Takehiro (added options --colorbar_pos)
364
+ # 2021/07/16 S Takehiro (DCL colormap setting fixed)
321
365
  #
322
366
  #################################################
323
367
  require "getoptlong" # for option_parse
@@ -359,7 +403,7 @@ def each_along_dims(gphys, loopdim)
359
403
  if loopdim.is_a?(String)
360
404
  dimname = loopdim
361
405
  elsif
362
- if loopdim < 0
406
+ if loopdim < 0
363
407
  dimname = gphys.coord(gphys.rank + loopdim).name
364
408
  else
365
409
  dimname = gphys.coord(loopdim).name
@@ -369,7 +413,7 @@ def each_along_dims(gphys, loopdim)
369
413
  end
370
414
 
371
415
  loopdim_na = gphys.coord(dimname).val # get coord ary
372
- loopdim_na = loopdim_na[-1..0] if $OPT_reverse || $OPT_Gr # reverse
416
+ loopdim_na = loopdim_na[-1..0] if $OPT_reverse || $OPT_Gr # reverse
373
417
  loopdim_na.each { |x|
374
418
  yield( gphys.cut(dimname=>x) )
375
419
  }
@@ -387,12 +431,12 @@ def draw_setup
387
431
  DCL.sgpset('lfull', true) # use full area in the window
388
432
  DCL.sgpset('lfprop',true) # use proportional font
389
433
  DCL.uscset('cyspos', 'B' ) # move unit y axis
390
-
434
+
391
435
  # viewport size
392
436
  GGraph.set_fig('viewport'=>$VIEWPORT)
393
437
  GGraph.set_fig( 'itr'=>($OPT_itr == nil) ? 1 : $OPT_itr.to_i )
394
- GGraph.set_fig("xrev"=>"units:mb,units:hPa,units:millibar,positive:down",
395
- "yrev"=>"units:mb,units:hPa,units:millibar,positive:down")
438
+ GGraph.set_fig("xrev"=>"units:mb,units:hPa,units:millibar,positive:down",
439
+ "yrev"=>"units:mb,units:hPa,units:millibar,positive:down")
396
440
 
397
441
  # set options
398
442
  min_range, max_range = __split_range($OPT_range)
@@ -409,7 +453,7 @@ def draw_setup
409
453
  tone_interval = nil
410
454
  end
411
455
  GGraph.set_linear_contour_options(
412
- 'int' => cont_interval,
456
+ 'int' => cont_interval,
413
457
  'min' => ( min_crange || min_range ),
414
458
  'max' => ( max_crange || max_range )
415
459
  )
@@ -432,6 +476,19 @@ def draw_setup
432
476
  $OPT_patterns=$OPT_patterns.split(',').map!{|v| v.to_f }
433
477
  end
434
478
 
479
+ if ( $OPT_log )
480
+ $OPT_slog=$OPT_log; $OPT_clog=$OPT_log
481
+ end
482
+
483
+ $OPT_slog_cycle = 3 if ( ! $OPT_slog_cycle )
484
+ $OPT_clog_cycle = 3 if ( ! $OPT_clog_cycle )
485
+
486
+ if ( $OPT_log_cycle )
487
+ $OPT_slog_cycle=$OPT_log_cycle; $OPT_clog_cycle=$OPT_log_cycle
488
+ end
489
+ $OPT_slog_cycle=$OPT_slog_cycle.to_i; $OPT_clog_cycle=$OPT_clog_cycle.to_i
490
+
491
+
435
492
  # similar projection
436
493
  if ($OPT_similar)
437
494
  if /([\d\-.]*),([\d\-.]*),([\d\-.]*)/ =~ $OPT_similar
@@ -471,7 +528,7 @@ def draw_setup
471
528
  GGraph::set_map(map_type=>true)
472
529
  end
473
530
 
474
- # time axis
531
+ # time axis
475
532
  if ($OPT_time_ax)
476
533
  $OPT_time_ax = false if $OPT_time_ax == "false"
477
534
  GGraph.set_axes('time_ax'=>$OPT_time_ax)
@@ -484,8 +541,8 @@ def draw(gp, draw_flag)
484
541
  # draw hontai
485
542
  case draw_flag
486
543
  when "line"
487
- if ( $Overplot == 1 )
488
- GGraph.line(gp,
544
+ if ( $Overplot == 1 )
545
+ GGraph.line(gp,
489
546
  true,
490
547
  "title"=>$OPT_title,
491
548
  "index"=>($OPT_index||1),
@@ -496,7 +553,7 @@ def draw(gp, draw_flag)
496
553
  "max" => __split_range($OPT_range)[1]
497
554
  )
498
555
  elsif ( $OPT_overplot_color || $OPT_Opc )
499
- GGraph.line(gp,
556
+ GGraph.line(gp,
500
557
  false,
501
558
  "title"=>$OPT_title,
502
559
  "index"=>($OPT_index.to_i+$Overplot*10),
@@ -507,7 +564,7 @@ def draw(gp, draw_flag)
507
564
  "max" => __split_range($OPT_range)[1]
508
565
  )
509
566
  else
510
- GGraph.line(gp,
567
+ GGraph.line(gp,
511
568
  false,
512
569
  "title"=>$OPT_title,
513
570
  "index"=>($OPT_index||1),
@@ -521,12 +578,12 @@ def draw(gp, draw_flag)
521
578
  if ( $Overplot < $Overplot_max )
522
579
  $Overplot += 1
523
580
  else
524
- $Overplot = 1
581
+ $Overplot = 1
525
582
  end
526
583
 
527
584
  when "mark"
528
- if ( $Overplot == 1 )
529
- GGraph.mark(gp,
585
+ if ( $Overplot == 1 )
586
+ GGraph.mark(gp,
530
587
  true,
531
588
  "title"=>$OPT_title,
532
589
  "index"=>($OPT_index||1),
@@ -537,7 +594,7 @@ def draw(gp, draw_flag)
537
594
  "max" => __split_range($OPT_range)[1]
538
595
  )
539
596
  else
540
- GGraph.mark(gp,
597
+ GGraph.mark(gp,
541
598
  false,
542
599
  "title"=>$OPT_title,
543
600
  "index"=>($OPT_index||1),
@@ -551,17 +608,19 @@ def draw(gp, draw_flag)
551
608
  if ( $Overplot < $Overplot_max )
552
609
  $Overplot += 1
553
610
  else
554
- $Overplot = 1
611
+ $Overplot = 1
555
612
  end
556
613
 
557
614
  when "full"
558
615
  GGraph.tone(gp,
559
- true,
616
+ true,
560
617
  "title"=>$OPT_title,
561
618
  "annotate"=>$annotate,
562
619
  "transpose"=>$OPT_exch,
563
620
  "levels"=>$OPT_slevels,
564
621
  "patterns"=>$OPT_patterns,
622
+ "log"=>$OPT_slog,
623
+ "log_cycle"=>$OPT_slog_cycle,
565
624
  "auto"=>$auto,
566
625
  "tonf"=>$tonf,
567
626
  "tonb"=>$tonb,
@@ -569,23 +628,27 @@ def draw(gp, draw_flag)
569
628
  "xcoord"=>$OPT_xcoord,
570
629
  "ycoord"=>$OPT_ycoord
571
630
  )
572
- GGraph.contour(gp,
631
+ GGraph.contour(gp,
573
632
  false,
574
633
  "transpose"=>$OPT_exch,
575
634
  "levels"=>$OPT_clevels,
576
635
  "nozero"=>$OPT_nozero,
636
+ "log"=>$OPT_clog,
637
+ "log_cycle"=>$OPT_clog_cycle,
577
638
  "label"=>$OPT_label,
578
639
  "xcoord"=>$OPT_xcoord,
579
640
  "ycoord"=>$OPT_ycoord
580
641
  )
581
642
  when "nocont"
582
643
  GGraph.tone(gp,
583
- true,
644
+ true,
584
645
  "title"=>$OPT_title,
585
646
  "annotate"=>$annotate,
586
647
  "transpose"=>$OPT_exch,
587
648
  "levels"=>$OPT_slevels,
588
649
  "patterns"=>$OPT_patterns,
650
+ "log"=>$OPT_slog,
651
+ "log_cycle"=>$OPT_slog_cycle,
589
652
  "auto"=>$auto,
590
653
  "tonf"=>$tonf,
591
654
  "tonb"=>$tonb,
@@ -596,13 +659,15 @@ def draw(gp, draw_flag)
596
659
  when "noshade"
597
660
  mj = DCL.udpget('indxmj')
598
661
  mn = DCL.udpget('indxmn')
599
- GGraph.contour(gp,
600
- true,
662
+ GGraph.contour(gp,
663
+ true,
601
664
  "title" =>$OPT_title,
602
665
  "annotate"=>$annotate,
603
666
  "transpose"=>$OPT_exch,
604
- "levels"=>$OPT_clevels,
667
+ "levels"=>$OPT_clevels,
605
668
  "nozero"=>$OPT_nozero,
669
+ "log"=>$OPT_clog,
670
+ "log_cycle"=>$OPT_clog_cycle,
606
671
  "label"=>$OPT_label,
607
672
  "xcoord"=>$OPT_xcoord,
608
673
  "ycoord"=>$OPT_ycoord
@@ -611,12 +676,20 @@ def draw(gp, draw_flag)
611
676
 
612
677
  # color bar
613
678
  if ( ( draw_flag == "full") || ( draw_flag == "nocont") ) && $colorbar
614
- GGraph::color_bar(
615
- "left" => true,
616
- "landscape" => true
617
- )
679
+ if $OPT_colorbar_pos == "l" then
680
+ GGraph::color_bar(
681
+ "left" => false,
682
+ "landscape" => false,
683
+ "log" => $OPT_slog
684
+ )
685
+ else
686
+ GGraph::color_bar(
687
+ "left" => true,
688
+ "landscape" => true,
689
+ "log" => $OPT_slog
690
+ )
691
+ end
618
692
  end
619
-
620
693
  end
621
694
 
622
695
 
@@ -632,17 +705,17 @@ def set_vpsize( default_vp, aspect=2.0 )
632
705
  hlength = x1 - x0
633
706
  vlength = y1 - y0
634
707
  # center grid of viewport
635
- cen_of_vp = [ x0 + hlength/2.0, y0 + vlength/2.0 ]
708
+ cen_of_vp = [ x0 + hlength/2.0, y0 + vlength/2.0 ]
636
709
 
637
710
  if aspect <= hlength / vlength
638
711
  hlength = vlength * aspect
639
712
  x0 = cen_of_vp[0] - hlength/2.0
640
713
  x1 = cen_of_vp[0] + hlength/2.0
641
714
  else
642
- vlength = hlength / aspect
715
+ vlength = hlength / aspect
643
716
  y0 = cen_of_vp[1] - vlength/2.0
644
717
  y1 = cen_of_vp[1] + vlength/2.0
645
- end
718
+ end
646
719
 
647
720
  return [ x0, x1, y0, y1 ]
648
721
 
@@ -666,7 +739,7 @@ def __split_range(range)
666
739
  else
667
740
  raise "invalid range: variable subset specification error. split range with ':'\n\n"
668
741
  end
669
-
742
+
670
743
  return min, max
671
744
  end
672
745
 
@@ -691,7 +764,7 @@ def check_dclopts
691
764
  value = opt[4..-1].split('=')[1]
692
765
  dcl_set_params(pkg,name,value)
693
766
  }
694
-
767
+
695
768
  end
696
769
 
697
770
  def dcl_set_params(pkg,name,value)
@@ -715,7 +788,7 @@ def dcl_set_params(pkg,name,value)
715
788
  else
716
789
  eval( "DCL.#{pkg}r#{set}(name,value.to_f)" )
717
790
  end
718
-
791
+
719
792
  end
720
793
 
721
794
  #####################################################
@@ -728,6 +801,7 @@ check_dclopts
728
801
  parser = GetoptLong.new
729
802
  parser.set_options(
730
803
  ### global option ###
804
+ ['--slice', GetoptLong::REQUIRED_ARGUMENT],
731
805
  ['--var', GetoptLong::REQUIRED_ARGUMENT],
732
806
  ['--wsn', GetoptLong::REQUIRED_ARGUMENT],
733
807
  ['--clrmap', GetoptLong::REQUIRED_ARGUMENT],
@@ -753,10 +827,11 @@ parser.set_options(
753
827
  ['--reverse', GetoptLong::NO_ARGUMENT],
754
828
  ['--Gr', GetoptLong::NO_ARGUMENT],
755
829
  ['--mean', GetoptLong::REQUIRED_ARGUMENT],
830
+ ['--sum', GetoptLong::REQUIRED_ARGUMENT],
756
831
  ['--stddev', GetoptLong::REQUIRED_ARGUMENT
757
832
  ],
758
833
  ['--eddy', GetoptLong::REQUIRED_ARGUMENT],
759
- ['--diff', GetoptLong::NO_ARGUMENT],
834
+ ['--diff', GetoptLong::NO_ARGUMENT],
760
835
  ['--map', GetoptLong::REQUIRED_ARGUMENT],
761
836
  ['--m', GetoptLong::NO_ARGUMENT],
762
837
  ['--operation', GetoptLong::REQUIRED_ARGUMENT],
@@ -783,8 +858,15 @@ parser.set_options(
783
858
  ['--clevels', GetoptLong::REQUIRED_ARGUMENT],
784
859
  ['--slevels', GetoptLong::REQUIRED_ARGUMENT],
785
860
  ['--patterns', GetoptLong::REQUIRED_ARGUMENT],
861
+ ['--log', GetoptLong::NO_ARGUMENT],
862
+ ['--clog', GetoptLong::NO_ARGUMENT],
863
+ ['--slog', GetoptLong::NO_ARGUMENT],
864
+ ['--log_cycle', GetoptLong::REQUIRED_ARGUMENT],
865
+ ['--clog_cycle', GetoptLong::REQUIRED_ARGUMENT],
866
+ ['--slog_cycle', GetoptLong::REQUIRED_ARGUMENT],
786
867
  ['--tone', GetoptLong::REQUIRED_ARGUMENT],
787
868
  ['--udsfmt', GetoptLong::REQUIRED_ARGUMENT],
869
+ ['--colorbar_pos', GetoptLong::REQUIRED_ARGUMENT],
788
870
  ['--nocolorbar', GetoptLong::NO_ARGUMENT],
789
871
  ['--nozero', GetoptLong::NO_ARGUMENT],
790
872
  ['--help', GetoptLong::NO_ARGUMENT]
@@ -801,7 +883,7 @@ end
801
883
 
802
884
  ## Print out help message
803
885
  if ($OPT_help)
804
- help
886
+ help
805
887
  exit(1)
806
888
  end
807
889
 
@@ -811,7 +893,7 @@ DCL::swlset('lwait', false) if ($OPT_nowait || $OPT_Gw || $OPT_smooth || $OPT
811
893
  DCL::swlset('lalt', true) if ($OPT_alternate || $OPT_Ga || $OPT_smooth || $OPT_Gaw)
812
894
  # set backing store option
813
895
  if ($OPT_noannotate)
814
- $annotate = false
896
+ $annotate = false
815
897
  else
816
898
  $annotate = true
817
899
  end
@@ -820,12 +902,12 @@ $Overplot_max = ( $OPT_overplot.to_i || 1 )
820
902
  $Overplot = 1
821
903
 
822
904
  if ($OPT_nocolorbar)
823
- $colorbar = false
905
+ $colorbar = false
824
906
  else
825
907
  $colorbar = true
826
908
  end
827
909
 
828
- if ($OPT_tone)
910
+ if ($OPT_tone)
829
911
  case $OPT_tone
830
912
  when "a"
831
913
  $auto, $tonf, $tonb, $tonc = true,false,false,false
@@ -855,11 +937,9 @@ udsfmt = ($OPT_udsfmt||DCL.udqfmt())
855
937
  DCL.udsfmt(udsfmt)
856
938
 
857
939
  ## draw figure
858
- loopdim = ( $OPT_animate || $OPT_anim )
940
+ loopdim = ( $OPT_animate || $OPT_anim )
859
941
  loopdim = loopdim.to_i if loopdim.to_i.to_s == loopdim
860
942
 
861
- ### set colormap
862
- DCL.sgscmn($OPT_clrmap||1)
863
943
  ## open work station
864
944
  if NumRu::DCL::DCLVERSION.to_f >= 6
865
945
  DCL.gropn($OPT_wsn||1)
@@ -867,15 +947,19 @@ else
867
947
  DCL.gropn($OPT_wsn||4)
868
948
  end
869
949
 
950
+ ### set colormap
951
+ DCL.sgscmn($OPT_clrmap||1)
952
+
870
953
  ## open netcdf variables
871
954
 
872
955
  while ARGV[0] do
873
956
  gturl = ARGV[0]
874
957
  gturl = gturl+'@'+$OPT_var if $OPT_var
958
+ gturl = gturl+','+$OPT_slice if $OPT_slice
875
959
 
876
960
  gp = GPhys::IO.open_gturl(gturl)
877
961
  print " Reading #{gturl}\n"
878
- ARGV.shift
962
+ ARGV.shift
879
963
 
880
964
  ## for case of calculating difference of two gphys object
881
965
  if ($OPT_diff)
@@ -887,15 +971,21 @@ while ARGV[0] do
887
971
  gp = gp - GPhys::IO.open_gturl(gturl)
888
972
  print " Taking difference: #{prev_gturl} - #{gturl}\n"
889
973
  gturl = prev_gturl+" - "+gturl
890
- ARGV.shift
974
+ ARGV.shift
891
975
  end
892
-
976
+
893
977
  ## mean along any axis
894
978
  if ($OPT_mean)
895
979
  dims_mean = ($OPT_mean).split(/\s*,\s*/)
896
980
  dims_mean = dims_mean.map{|dim| dim.to_i.to_s == dim ? dim.to_i : dim}
897
981
  end
898
982
 
983
+ ## sum up along any axis
984
+ if ($OPT_sum)
985
+ dims_sum = ($OPT_sum).split(/\s*,\s*/)
986
+ dims_sum = dims_sum.map{|dim| dim.to_i.to_s == dim ? dim.to_i : dim}
987
+ end
988
+
899
989
  ## standard deviation along any axis
900
990
  if ($OPT_stddev)
901
991
  dims_stddev = ($OPT_stddev).split(/\s*,\s*/)
@@ -921,6 +1011,13 @@ while ARGV[0] do
921
1011
  }
922
1012
  end
923
1013
 
1014
+ ## sum up along any axis
1015
+ if ($OPT_sum)
1016
+ dims_sum.each{|dim|
1017
+ g = g.sum(dim)
1018
+ }
1019
+ end
1020
+
924
1021
  ## standard deviation along any axis
925
1022
  if ($OPT_stddev)
926
1023
  dims_stddev.each{|dim|
@@ -947,14 +1044,14 @@ while ARGV[0] do
947
1044
  kind_of_fig = "mark"
948
1045
  elsif ($OPT_line || gp_rank == 1)
949
1046
  kind_of_fig = "line"
950
- elsif (!$OPT_line && gp_rank >= 2) && !$OPT_noshade && $OPT_nocont
1047
+ elsif (!$OPT_line && gp_rank >= 2) && !$OPT_noshade && $OPT_nocont
951
1048
  kind_of_fig = "nocont"
952
- elsif (!$OPT_line && gp_rank >= 2) && $OPT_noshade && !$OPT_nocont
1049
+ elsif (!$OPT_line && gp_rank >= 2) && $OPT_noshade && !$OPT_nocont
953
1050
  kind_of_fig = "noshade"
954
1051
  elsif (!$OPT_line && gp_rank >= 2) && !$OPT_noshade && !$OPT_nocont
955
1052
  kind_of_fig = "full"
956
1053
  end
957
- end
1054
+ end
958
1055
 
959
1056
  draw(g, kind_of_fig)
960
1057
  end