source: trunk/procs/plt_map.pro

Last change on this file was 248, checked in by ericg, 14 years ago

Add normalisation in spectra calculation in plt_map

  • Property svn:keywords set to Id
File size: 58.9 KB
Line 
1;+
2;
3; make window plot
4;
5; @param CMD {in}{required}{type=structure}
6; command line of window
7;
8; @param IPLOT {in}{required}{type=integer}
9;
10; @param WIN {in}
11; position of window (petit[,,,])
12;
13; @param IOVER {in}{required}{type=integer}
14; overlay index
15;
16; @param LANDSCAPE {in}
17;
18; @examples
19;
20; IDL> cmd={plt:'xy',var:''}
21; IDL> iplot=1
22; IDL> win=[0,0,0]
23; IDL> iover=1
24; IDL> plt_map, cmd, iplot, win, iover, landscape
25;
26; @uses
27; <pro>common</pro>
28; <propost_it>com_eg</propost_it>
29;
30; <propost_it>data_read</propost_it>
31;
32; @todo
33; finish check parameters
34;
35; @history
36; - fplod 20100114T144659Z aedon.locean-ipsl.upmc.fr (Darwin)
37;
38;   * fix array syntax on fld, pltcmd and time
39;
40; - fplod 20091209T094630Z aedon.locean-ipsl.upmc.fr (Darwin)
41;
42;   * check parameters (not finish)
43;
44; - EG 19-2-99
45;
46; @version
47; $Id$
48;
49;-
50PRO plt_map, cmd, iplot, win, iover, landscape
51;
52  compile_opt idl2, strictarrsubs
53;
54@common
55@com_eg
56;
57; Return to caller if errors
58 ON_ERROR, 2
59;
60;
61 IF debug_w THEN BEGIN
62  info = report('enter ...')
63 ENDIF
64;
65 usage='plt_map, cmd, iplot, win, iover, landscape'
66;
67 nparam = N_PARAMS()
68 IF (nparam LT 4) THEN BEGIN
69   ras = report(['Incorrect number of arguments.' $
70          + '!C' $
71          + 'Usage : ' + usage])
72   stop
73 ENDIF
74
75 arg_type = size(cmd,/type)
76 IF (arg_type NE 8) THEN BEGIN
77   ras = report(['Incorrect arg type cmd' $
78          + '!C' $
79          + 'Usage : ' + usage])
80   stop
81 ENDIF
82
83 arg_struct_tags=TAG_NAMES(cmd)
84; ++ check cmd tags (name, type)
85
86 arg_type = size(iplot,/type)
87 IF ((arg_type NE 2) AND (arg_type NE 3)) THEN BEGIN
88   ras = report(['Incorrect arg type iplot' $
89          + '!C' $
90          + 'Usage : ' + usage])
91   stop
92 ENDIF
93;
94 arg_type = size(iover,/type)
95 IF ((arg_type NE 2) AND (arg_type NE 3)) THEN BEGIN
96   ras = report(['Incorrect arg type iover' $
97          + '!C' $
98          + 'Usage : ' + usage])
99   stop
100 ENDIF
101
102 common_type=size(nb_cycles,/type)
103 IF ((common_type NE 2) AND (common_type NE 3)) THEN BEGIN
104   ras = report(['Incorrect common type nb_cycles' $
105          + '!C' $
106          + 'Usage : ' + usage])
107  stop
108 ENDIF
109
110;
111; empty window case for on=2
112;
113   ioverchk = iover
114
115   cmd_wrk = cmd
116
117   IF cmd.on EQ 2 THEN BEGIN
118    GOTO, finish
119   ENDIF
120;
121; incompatible options of plt_def and post_it
122;
123   trend_typp = cmd.trend
124;
125; =============
126;  1.read data
127; =============
128;
129; type of plot
130
131; time series of rms deviation on a sigma surface?
132   st_rms = 0
133   IF strpos(cmd.plt, 'st') NE -1 AND strpos(cmd.var, '@s') GT 4 THEN BEGIN
134      st_rms = 1
135      sig_surface = strmid(cmd.var, strpos(cmd.var, '@s')+2, strlen(cmd.var))
136      cmd.var = strmid(cmd.var, 0, strpos(cmd.var, '@s'))
137      legendsurf = '  on sigma='+sig_surface
138   ENDIF
139
140   CASE cmd.plt OF
141      'x': cmd.plt = cmd.plt+'_global'
142      'y': cmd.plt = cmd.plt+'_global'
143      'z': cmd.plt = cmd.plt+'_global'
144      's': cmd.plt = cmd.plt+'_global'
145      'yz': cmd.plt = cmd.plt+'_global'
146      ELSE:
147   ENDCASE
148
149; Definition of plttyp, hotyp, dimplot
150   datyp = def_dptyp(cmd)
151
152   plttyp = datyp.plttyp
153   hotyp = datyp.hotyp
154   dimplot = datyp.dimplot
155   pltztyp = datyp.pltztyp
156   plt1dtyp = datyp.plt1dtyp
157   splot = datyp.splot
158
159   hotypchk = hotyp
160
161; stat computations:
162
163   CASE cmd.plt OF
164   'xyt': BEGIN
165           plttyp = 'plt'
166           hotyp = 'xyt'
167           dimplot = 2
168          END
169       ELSE:
170   ENDCASE
171
172; xy plot on density surface (cmd.var = <var>@s<sig_surf>
173   legsurf = ''
174   sig_surf = 0.
175   IF  strpos(cmd.var, '@s') GT 4 THEN BEGIN
176      splot = 1
177      sig_surf = strmid(cmd.var, strpos(cmd.var, '@s')+2, strlen(cmd.var))
178      cmd.var = strmid(cmd.var, 0, strpos(cmd.var, '@s'))
179      legsurf = '  on sigma='+sig_surf
180   ENDIF
181
182; contour of coasts
183
184   CASE splot OF
185      1: c_cont = 0
186      0: c_cont = (!d.n_colors-1) < 255
187   ENDCASE
188
189; scatter plot y=f(x)
190
191   IF strpos(cmd.var, '=f(') GE 1 THEN BEGIN
192      CASE cmd.plt OF
193         'xy': cmd.plt = cmd.plt+'_global'
194         ELSE:
195      ENDCASE
196      plttyp = 'yfx'
197      dimplot = 1
198   ENDIF
199
200; binning plot y=bin(x)
201
202   IF strpos(cmd.var, '=bin(') GE 1 THEN BEGIN
203      CASE cmd.plt OF
204         'xy': cmd.plt = cmd.plt+'_global'
205         ELSE:
206      ENDCASE
207      plttyp = 'ybinx'
208      dimplot = 1
209   ENDIF
210
211; vector plot
212
213   IF strpos(cmd.var, '[') EQ 0 THEN BEGIN
214      vecplot = 1
215      ; sampling of vector
216      IF vector_sample GE 2 THEN BEGIN
217         vect_sample = ',UNVECTSUR=strtrim(string(vector_sample),2)'
218      ENDIF ELSE BEGIN
219         vect_sample = ''
220      ENDELSE
221   ENDIF ELSE BEGIN
222      vecplot = 0
223   ENDELSE
224
225; spectrum
226
227   spectplt = 0
228   IF strpos(cmd.plt, '@s') GE 1 THEN BEGIN
229      IF hotyp EQ 't' THEN BEGIN
230       spectplt = 1
231      ENDIF ELSE BEGIN
232       print, '    *** spectrum [@s] applies to 1D time serie only (t_<box>)'
233       stop
234      ENDELSE
235      cmd.plt = strmid(cmd.plt, 0, strpos(cmd.plt, '@s'))
236   ENDIF
237
238; wavelet
239
240   waveplt = 0
241   IF strpos(cmd.plt, '@w') GE 1 THEN BEGIN
242      IF hotyp EQ 't' THEN BEGIN
243       waveplt = 1
244      ENDIF ELSE BEGIN
245       print, '    *** wavelet [@w] applies to 1D time serie only (t_<box>)'
246       stop
247      ENDELSE
248      cmd.plt = strmid(cmd.plt, 0, strpos(cmd.plt, '@w'))
249   ENDIF
250
251; running std dev
252
253   run_stddev = 0
254   IF strpos(cmd.plt, '@r') GE 1 THEN BEGIN
255      IF hotyp NE 't' THEN BEGIN
256         print, '    *** running [@r<win>] std dev applies to 1D time serie only (t_<box> & 1m@t412)'
257         stop
258      ENDIF
259      run_stddev = strmid(cmd.plt, strpos(cmd.plt, '@r')+2, strlen(cmd.plt))
260      cmd.plt = strmid(cmd.plt, 0, strpos(cmd.plt, '@r'))
261   ENDIF
262
263
264; define grids
265; read if new type + triangule
266;
267   cmd1_back = cmd
268   sw_diffg = 0
269   def_grid, cmd
270   IF debug_w THEN BEGIN
271    print, '   after def_grid in plt_map: cmd.grid/varexp/vargrid ',cmd.grid,' ', varexp, ' ', vargrid
272   ENDIF
273
274; vertical average if 3D field
275   vert_switch = 0
276   IF plttyp EQ 'plt' AND vert_type ne '0' THEN BEGIN
277    vert_switch = 1
278   ENDIF
279   IF plttyp EQ 'pltt' AND vert_type ne '0' THEN BEGIN
280    vert_switch = 1
281   ENDIF
282   IF plttyp EQ 'plt1d' AND vert_type ne '0' THEN BEGIN
283    vert_switch = 1
284   ENDIF
285   IF plt1dtyp EQ 'z' THEN BEGIN
286    vert_switch = 0
287   ENDIF
288
289; read all data if netcdf output
290
291   IF debug_w THEN BEGIN
292    print, '    force_all_data_read in pltmap: ', force_all_data_read
293   ENDIF
294
295   IF cmd.out NE 'cdf' THEN BEGIN
296      all_data_str = ''
297   ENDIF ELSE BEGIN
298      all_data_str = ',/ALL_DATA'
299   ENDELSE
300
301; Define ensemble simulation <cmd.exp>#<ensemble_codes>
302
303   toggle_ensbl_diff = 0
304   ensbl_diff = 0
305   ensbl_code_diff = ''
306   IF strpos(cmd.exp, '#') NE -1 THEN BEGIN
307      ensbl_code = strmid(cmd.exp, strpos(cmd.exp, '#')+1, strlen(cmd.exp))
308      exp_ens = strmid(cmd.exp, 0, strpos(cmd.exp, '#'))
309      IF strpos(ensbl_code, '-') NE -1 THEN BEGIN
310         ; difference
311         argvar = strsplit(ensbl_code,'-', /EXTRACT)
312         ensbl_diff = 1
313         ensbl_diff_other = 0
314         IF strmid(argvar[1],0,1) NE 'm' THEN BEGIN ; other simulation
315            ensbl_diff_other = 1
316            cmd.exp = exp_ens+'-'+argvar[1]
317            ensbl_code = argvar[0]
318         ENDIF ELSE BEGIN ; remove other member or ensemble mean (deal with it in ensbl_data_extract.pro)
319            cmd.exp = exp_ens
320            ensbl_code_diff = argvar[1]
321            ensbl_code = argvar[0]
322         ENDELSE
323      ENDIF ELSE BEGIN
324         cmd.exp = exp_ens
325      ENDELSE 
326      ; define ensemble properties
327      result=def_ensbl(exp_ens)
328      IF result EQ -1 THEN BEGIN
329         stop
330      ENDIF
331   ENDIF ELSE BEGIN
332      ensbl_code = ''
333   ENDELSE
334
335; ===========
336;  Read data
337; ===========
338
339   really_1m_st = 1
340   IF cmd.timave EQ '1y' AND strmid(cmd.plt, 0, 2) EQ 'st' THEN BEGIN
341      @densit_pltmap_read
342   ENDIF ELSE BEGIN
343      pltcmd = 'field = data_read(cmd,'''+hotyp+''','''+plttyp+''','+string(dimplot)+','+string(iover)+all_data_str+', ZMTYP = '''+cmd.plt+''')'
344      printf, nulhis, strcompress(pltcmd)
345      printf, nulhis, ' '
346      IF execute(pltcmd) EQ 0 THEN BEGIN
347       stop
348      ENDIF
349   ENDELSE
350
351; data specific treatments
352   IF cmd.var EQ 'sla' THEN BEGIN
353    field.origin = 'diff'
354   ENDIF
355   IF cmd.var EQ 'sosstsst' AND cmd.exp EQ 'HadISST1' THEN BEGIN
356      ; limit data to -1.8 C
357      idx = where(field.data EQ valmask)
358      field.data = field.data > (-1.8)
359      IF idx[0] NE -1 THEN BEGIN
360       field.data[idx] = valmask
361      ENDIF
362   ENDIF
363
364;help, field,/structure
365   IF n_elements(field.data) EQ 1 THEN BEGIN
366    stop
367   ENDIF
368
369; change cmd.var if macro
370   CASE STRMID(cmd.var, 0, 2) OF
371      '@@': BEGIN
372         cmd.var = field.name
373         cmd.var = STRMID(cmd.var, 2, 15)
374         IF debug_w THEN BEGIN
375          print, 'cmd.var : ', cmd.var
376         ENDIF
377      END
378      ELSE:
379   ENDCASE
380   IF vecplot EQ 1 THEN BEGIN
381      ; vectors case
382      CASE STRMID(cmd.var2, 0, 2) OF
383         '@@': BEGIN
384            cmd.var2 = STRMID(cmd.var2, 2, 15)
385         END
386         ELSE:
387      ENDCASE
388   ENDIF
389
390; spectum plot
391   IF spectplt EQ 1 THEN BEGIN
392    plttyp = 'spec'
393   ENDIF
394; wavelet plot
395   IF waveplt EQ 1 THEN BEGIN
396    plttyp = 'wavelet'
397   ENDIF
398
399   xlogax = ''
400
401; density pojection plot (splot=1)
402   IF splot EQ 1 THEN BEGIN
403      ; keep grid attributes
404      izminmesh_b = izminmesh
405      izmaxmesh_b = izmaxmesh
406      jpk_b = jpk
407      jpkglo_b = jpkglo
408      gdept_b = gdept
409      gdepw_b = gdepw
410      e3t_b = e3t
411      e3w_b = e3w
412      tmask_b = tmask
413;      IF cmd.var EQ 'vosigvol' THEN BEGIN
414;       xlogax = ',xlog = 1'
415;      ENDIF
416;  modify vertical grid -> sigma
417      n_sig = (sig_max - sig_min)/sig_del + 1
418      z_sig = sig_min+findgen(n_sig)*sig_del
419      izminmesh = 0
420      izmaxmesh = n_sig-1
421      jpk = long(izmaxmesh-izminmesh+1)
422      jpkglo = jpk
423      gdept = z_sig
424      gdepw = gdept
425      e3t = shift(gdept, 1)-gdept
426      e3t[0] = e3t[1]
427      e3w = e3t
428      prof1 = sig_min
429      prof2 = sig_max
430;      grille,mask,glam,gphi,gdep,nx,ny,nz,premierx,premiery,premierz,dernierx,derniery,dernierz    ; added PDW 12/5/04
431;      tmask = mask  ; added PDW 12/5/04
432      tmask = reform(reform(tmask[*, *, 0], jpi*jpj)#replicate(1, jpk), jpi, jpj, jpk)
433      domdef
434   END
435
436   IF debug_w THEN BEGIN
437    print, '   cmd after data_read in plt_map = ', cmd
438   ENDIF
439;
440; ======================
441;  2. window attributes
442; ======================
443;
444
445; find field attributes
446; ---------------------
447
448   fldatt = {name:'', assos:'', min: 0.0, max: 0.0, int: 0.0, mult: 0.0, add: 0.0, unit: '', mid: 0.0, homin:0.0, homax:0.0, min1d:0.0, max1d:0.0, dmax:0.0, spec:0.0}
449
450; which variable to look for
451
452   CASE plttyp OF
453      'ybinx': BEGIN
454         ; if var3 exists then var = var1/var3
455         IF var3_ybinx NE "" THEN BEGIN
456          var_att = cmd.var+"/"+var3_ybinx
457         ENDIF ELSE BEGIN
458          var_att = cmd.var
459         ENDELSE
460      END
461      ELSE: var_att = cmd.var
462   ENDCASE
463
464   IF debug_w THEN BEGIN
465    print, '    Looking for min/max/iso attributes for variable :', var_att
466   ENDIF
467
468; extremum
469   fldext = fld_pltext(var_att, plttyp, dimplot, hotyp)
470
471   fldatt.name = fldext.name
472   fldatt.min = fldext.min
473   fldatt.max = fldext.max
474   fldatt.homin = fldext.homin
475   fldatt.homax = fldext.homax
476   fldatt.min1d = fldext.min1d
477   fldatt.max1d = fldext.max1d
478   fldatt.dmax = fldext.dmax
479   fldatt.spec = fldext.spec
480   fldatt.assos = fldext.assos
481
482; interval + change of unit
483   fldint = fld_pltint(var_att, plttyp, dimplot, hotyp)
484
485;   help, fldint, /struct
486
487   fldatt.int = fldint.int
488   fldatt.mult = fldint.mult
489   fldatt.add = fldint.add
490   fldatt.unit = fldint.unit
491   fldatt.mid = fldint.mid
492
493   IF debug_w THEN BEGIN
494    print, 'plt_map 1 :', fldatt.mult, fldatt.add, fldatt.min, fldatt.max
495   ENDIF
496
497   IF fldatt.mult NE 1. OR fldatt.add NE 0. THEN BEGIN
498    field.units = fldatt.unit
499   ENDIF
500   fld = field.data*fldatt.mult + fldatt.add
501   IF (where(field.data EQ valmask))[0] NE -1 THEN BEGIN
502    fld[where(field.data EQ valmask)] = valmask
503   ENDIF
504
505;  field 2 if needed
506
507   IF  plttyp EQ 'yfx' OR plttyp EQ 'ybinx' OR  vecplot EQ 1 THEN BEGIN
508      fldatt2 = fldatt
509
510      fldext2 = fld_pltext(cmd.var2, plttyp, dimplot, hotyp)
511
512      fldatt2.name = fldext2.name
513      fldatt2.min = fldext2.min
514      fldatt2.max = fldext2.max
515      fldatt2.homin = fldext2.homin
516      fldatt2.homax = fldext2.homax
517      fldatt2.min1d = fldext2.min1d
518      fldatt2.max1d = fldext2.max1d
519      fldatt2.dmax = fldext2.dmax
520
521; interval + change of unit
522      fldint2 = fld_pltint(cmd.var2, plttyp, dimplot, hotyp)
523
524      fldatt2.int = fldint2.int
525      fldatt2.mult = fldint2.mult
526      fldatt2.add = fldint2.add
527      fldatt2.unit = fldint2.unit
528      fldatt2.mid = fldint2.mid
529
530      IF fldatt2.mult NE 1. OR fldatt2.add NE 0. THEN BEGIN
531       field.units2 = fldatt2.unit
532      ENDIF
533      fld2 = field.data2*fldatt2.mult + fldatt2.add
534      IF (where(field.data2 EQ valmask))[0] NE -1 THEN BEGIN
535       fld2[where(field.data2 EQ valmask)] = valmask
536      ENDIF
537
538   ENDIF
539
540;  field 3 if needed
541
542   IF  plttyp EQ 'ybinx' AND var3_ybinx NE "" THEN BEGIN
543      fldatt3 = fldatt
544
545      fldext3 = fld_pltext(var3_ybinx, plttyp, dimplot, hotyp)
546
547      fldatt3.name = fldext3.name
548      fldatt3.min = fldext3.min
549      fldatt3.max = fldext3.max
550      fldatt3.homin = fldext3.homin
551      fldatt3.homax = fldext3.homax
552      fldatt3.min1d = fldext3.min1d
553      fldatt3.max1d = fldext3.max1d
554      fldatt3.dmax = fldext3.dmax
555
556; interval + change of unit
557      fldint3 = fld_pltint(var3_ybinx, plttyp, dimplot, hotyp)
558
559      fldatt3.int = fldint3.int
560      fldatt3.mult = fldint3.mult
561      fldatt3.add = fldint3.add
562      fldatt3.unit = fldint3.unit
563      fldatt3.mid = fldint3.mid
564
565      IF fldatt3.mult NE 1. OR fldatt3.add NE 0. THEN BEGIN
566       field.units3 = fldatt3.unit
567      ENDIF
568      fld3 = field.data3*fldatt3.mult + fldatt3.add
569      IF (where(field.data3 EQ valmask))[0] NE -1 THEN BEGIN
570       fld3[where(field.data3 EQ valmask)] = valmask
571      ENDIF
572
573   ENDIF
574
575; If running std dev change min/max
576   IF run_stddev GT 0 THEN BEGIN
577      fldatt.homin = 0.
578      fldatt.homax = fldext.dmax
579   ENDIF
580
581; legend text
582; -----------
583
584;   IF plttyp EQ "pltt" THEN BEGIN
585      CASE strmid(cmd.trend, 0, 1) OF
586         '1': trd_txt = ' trend'
587         '2': trd_txt = ' drift'
588         '3': trd_txt = ' inverse trend'
589         '4': trd_txt = ' anomaly'
590         '5': trd_txt = ' filter'
591         '7': trd_txt = ' month sel'
592         ELSE: trd_txt = ''
593      ENDCASE
594   IF field_int EQ 1 AND dimplot EQ 1 THEN BEGIN
595      trd_txt = trd_txt+' integral'
596   ENDIF
597
598   varlegend = field.legend+trd_txt+' ('+field.units+')'
599
600   CASE plttyp OF
601      'yfx': varlegend2 = field.legend2+trd_txt+' ('+field.units2+')'
602      'ybinx': BEGIN
603         IF strmid(cmd2.trend, 0, 1) EQ '4' THEN BEGIN
604          varlegend = field.legend2+trd_txt+' ('+field.units2+')'
605         ENDIF ELSE BEGIN
606          varlegend = field.legend2+' ('+field.units2+')'
607         ENDELSE
608         varlegend2 = field.legend+trd_txt+' ('+field.units+')'
609      END
610      ELSE: BEGIN
611         IF run_stddev GT 0 THEN BEGIN
612          trd_txt = trd_txt+' running Std Dev ['+string(run_stddev, format = '(I3)')+']'
613         ENDIF
614      END
615   ENDCASE
616
617; ensemble specification
618
619   IF ensbl_code NE '' THEN BEGIN
620      varlegend = varlegend+' '+ensbl_legend
621   ENDIF
622
623; date text
624
625   CASE strmid(cmd.timave, 0, 2) OF
626      '1m': BEGIN
627         mn = def_month(cmd.timave, cmd.date1)
628         IF strmid(cmd.timave, 0, 3) EQ '1mm' THEN BEGIN
629          date_txt = mn+' ('+strmid(cmd.date1, 3, strlen(cmd.date1)-3)+')'
630         ENDIF ELSE BEGIN
631          date_txt = mn+' '+strmid(cmd.date1, 0, strlen(cmd.date1)-2)
632         ENDELSE
633      END
634      '3m': BEGIN
635         mn = def_month(cmd.timave, cmd.date1)
636         IF strmid(cmd.timave, 0, 3) EQ '3mm' THEN BEGIN
637          date_txt = mn+' ('+strmid(cmd.date1, 3, strlen(cmd.date1)-3)+')'
638         ENDIF ELSE BEGIN
639          date_txt = mn+' '+strmid(cmd.date1, 0, strlen(cmd.date1)-2)
640         ENDELSE
641      END
642      '6m': BEGIN
643         mn = def_month(cmd.timave, cmd.date1)
644         IF strmid(cmd.timave, 0, 3) EQ '6mm' THEN BEGIN
645          date_txt = mn+' ('+strmid(cmd.date1, 3, strlen(cmd.date1)-3)+')'
646         ENDIF ELSE BEGIN
647          date_txt = mn+' '+strmid(cmd.date1, 0, strlen(cmd.date1)-2)
648         ENDELSE
649      END
650      ELSE:date_txt = cmd.timave+' '+cmd.date1
651   ENDCASE
652
653   CASE plttyp OF
654      'pltt':BEGIN
655         date_txt = cmd.timave
656         IF strmid(cmd.timave, 1, 2) EQ 'mm' THEN BEGIN
657          date_txt = cmd.timave+' ('+strmid(cmd.date1, 3, strlen(cmd.date1)-3)+')'
658         ENDIF
659      END
660      'yfx': BEGIN
661         IF hotyp NE '-' THEN BEGIN
662          date_txt = cmd.timave+' '+cmd.date1+' '+cmd.spec
663         ENDIF
664      END
665      'ybinx': BEGIN
666         IF hotyp NE '-' THEN BEGIN
667          date_txt = cmd.timave+' '+cmd.date1+' '+cmd.spec
668         ENDIF
669      END
670      'wavelet': BEGIN
671         date_txt = cmd.timave+' Wavelet'
672         IF strmid(cmd.timave, 1, 2) EQ 'mm' THEN BEGIN
673          date_txt = cmd.timave+' Wavelet ('+strmid(cmd.date1, 3, strlen(cmd.date1)-3)+')'
674         ENDIF
675      END
676      ELSE:
677   ENDCASE
678
679   IF ensbl_code NE '' THEN BEGIN
680      CASE plttyp OF
681         'plt': BEGIN
682            date_txt =  'Start: '+date_txt+'+LT'+strtrim(string(ensbl_lt), 2)
683         END
684         ELSE:
685      ENDCASE
686   ENDIF
687
688; min/max/int
689
690; defined if fraction of x/y.range is added to plot domain
691
692;   IF free_1d_minmax EQ 'no' THEN BEGIN
693;    fraction = 0.
694;   ENDIF ELSE BEGIN
695;    fraction = 1.0
696;   ENDELSE
697   fraction = 0.
698
699   CASE dimplot OF
700      1: BEGIN
701         CASE plttyp OF
702         'pltt': BEGIN & minc = fldatt.homin & maxc = fldatt.homax & END
703         'spec': BEGIN & minc = 0. & maxc = fldatt.spec & END
704         'wavelet': BEGIN & minc = fldatt.homin & maxc = fldatt.homax & END
705         'plt1d': BEGIN & minc = fldatt.min1d & maxc = fldatt.max1d & END
706         'yfx': BEGIN ; y=f(x) scatter plot
707            IF long(strmid(cmd.trend, 0, 1)) GT 0 THEN BEGIN
708               IF run_stddev EQ 0 THEN BEGIN
709                  minc = -fldatt.dmax & maxc = fldatt.dmax
710                  minc2 = -fldatt2.dmax & maxc2 = fldatt2.dmax
711               ENDIF ELSE BEGIN
712                  minc = 0. & maxc = fldatt.dmax
713                  minc2 = 0. & maxc2 = fldatt2.dmax
714               ENDELSE
715            ENDIF ELSE BEGIN
716               minc = fldatt.min1d & maxc = fldatt.max1d
717               minc2 = fldatt2.min1d & maxc2 = fldatt2.max1d
718            ENDELSE
719         END
720         'ybinx': BEGIN ; y=bin(x) binning plot
721            IF long(strmid(cmd.trend, 0, 1)) GT 0 THEN BEGIN
722                  minc = -fldatt.dmax & maxc = fldatt.dmax
723                  minc2 = fldatt2.min1d & maxc2 = fldatt2.max1d
724            ENDIF ELSE BEGIN
725               minc = fldatt.min1d & maxc = fldatt.max1d
726               minc2 = fldatt2.min1d & maxc2 = fldatt2.max1d
727            ENDELSE
728            IF large_domain EQ 1 THEN BEGIN
729               minc2 = -fldatt2.dmax & maxc2 = fldatt2.dmax
730            ENDIF
731            IF debug_w THEN BEGIN
732             print, '   minc/maxc for 1d fld1/fld2', minc, maxc, minc2, maxc2
733            ENDIF
734         END
735         ELSE: BEGIN & minc = 0. &  maxc = 0. & END
736         ENDCASE
737         fldatt.int = !VALUES.F_NAN
738      END
739      2: BEGIN
740         CASE plttyp OF
741         'pltt': BEGIN & minc = fldatt.homin & maxc = fldatt.homax & END
742         ELSE: BEGIN & minc = fldatt.min & maxc = fldatt.max & END
743         ENDCASE
744      END
745   ENDCASE
746
747   IF cmd.var NE fld_prev OR cmd.trend NE '0' THEN BEGIN
748; field.origin EQ 'diff' OR
749      print, ''
750      CASE dimplot OF
751         2: BEGIN
752            print, '    '+cmd.var, ' plot attributes ('+plttyp+') : min/max/int=', $
753             minc, maxc, fldatt.int
754            IF ( fldatt.mult NE 1.0 OR  fldatt.add NE 0.0 ) THEN BEGIN
755             print, '     --> Modify field using : ', 'mult/add=' , $
756             fldatt.mult, fldatt.add, '    to obtain :    ', fldatt.unit
757            ENDIF
758         END
759         1: BEGIN
760            print, '    '+cmd.var, ' plot attributes ('+plttyp+') : min/max=',minc, maxc
761            IF ( fldatt.mult NE 1.0 OR  fldatt.add NE 0.0 ) THEN BEGIN
762             print, '     --> Modify field using : ', 'mult/add=' , $
763             fldatt.mult, fldatt.add, '    to obtain :    ', fldatt.unit
764            ENDIF
765         END
766         0: BEGIN
767            print, '    '+cmd.var, ' plot attributes ('+plttyp+') : min/max=',minc, maxc
768            IF ( fldatt.mult NE 1.0 OR  fldatt.add NE 0.0 ) THEN BEGIN
769             print, '     --> Modify field using : ', 'mult/add=' , $
770             fldatt.mult, fldatt.add, '    to obtain :    ', fldatt.unit
771            ENDIF
772            print, '    '+cmd.var2, ' plot attributes ('+plttyp+') : min/max=',minc2, maxc2
773            IF ( fldatt2.mult NE 1.0 OR  fldatt2.add NE 0.0 ) THEN BEGIN
774             print, '     --> Modify field using : ', 'mult/add=' , $
775             fldatt2.mult, fldatt2.add, '    to obtain :    ', fldatt2.unit
776            ENDIF
777         END
778         ELSE:
779      ENDCASE
780      print, ''
781
782   ENDIF
783   IF ( fldatt.mult EQ -1.0) THEN BEGIN
784      temp_m = minc
785      minc = -maxc
786      maxc = -temp_m
787   ENDIF
788   IF finite(fldatt.int) EQ 0 THEN BEGIN
789      intcmd = ''
790      colbarfor = ''
791      fmt = '(f6.1)'
792   ENDIF ELSE BEGIN
793      intcmd = ',int = '+string(fldatt.int)
794      IF fldatt.int LT 0.1 THEN BEGIN
795         fmt = '(f6.2)'
796      ENDIF ELSE IF fldatt.int LT 1 THEN BEGIN
797         fmt = '(f5.1)'
798      ENDIF ELSE BEGIN
799         fmt = '(f5.0)'
800      ENDELSE
801      IF long(fldatt.int) NE 0 THEN BEGIN
802         IF fldatt.int/long(fldatt.int) NE 1 THEN BEGIN
803          fmt = '(f5.1)'
804         ENDIF
805      ENDIF
806      colbarfor = ', format = '''+fmt+''''
807   ENDELSE
808
809;  if window > 1 or overlay > 1 noerase
810
811   IF win[2] NE 1 OR iover GT 1 THEN BEGIN
812      noerase = 1
813   ENDIF ELSE BEGIN
814      noerase = 0
815   ENDELSE
816
817; choose window number
818
819   CASE multi_win OF
820      1: window_number = ', window='+string(iplot)
821      ELSE: window_number = ''
822   ENDCASE
823
824; color label control
825
826   labstr = ''
827   IF iover EQ 1 THEN BEGIN
828      nofill = 1-shading
829   ENDIF ELSE BEGIN
830      nofill = 1
831   ENDELSE
832
833   nocoltxt = ''
834   IF nofill EQ 1 THEN BEGIN
835    nocoltxt = ',NOCOULEUR=1'
836   ENDIF
837
838   IF dimplot NE 2 THEN BEGIN
839    nofill = 1
840   ENDIF
841
842   nocolorbar = 0
843   IF col_palette EQ 'no' THEN BEGIN
844    nocolorbar = 1
845   ENDIF
846   IF pal_type EQ '2dom' THEN BEGIN
847    nocolorbar = 1
848   ENDIF
849   IF iover GT 1 THEN BEGIN
850    nocolorbar = 1
851   ENDIF
852   IF dimplot NE 2 THEN BEGIN
853    nocolorbar = 1
854   ENDIF
855   IF cmd.out NE 'cdf' THEN BEGIN
856      readpal = 0
857      IF nofill EQ 0 AND dimplot GT 1 THEN BEGIN
858       readpal = 1
859      ENDIF
860      IF waveplt EQ 1 THEN BEGIN
861       readpal = 2
862      ENDIF
863      IF field.origin EQ 'div' AND plttyp NE 'pltt' THEN BEGIN
864       readpal = 3
865      ENDIF
866      ;; Necessary for correlation plots (overlay of 2D fields)
867      IF dimplot GT 1 AND nover GT 1 AND iover GT 1 THEN BEGIN
868       readpal = 1
869      ENDIF
870      IF readpal GE 1 THEN BEGIN
871         lec_pal_gmt, cmd.var, c_anot_str, fmt, found, readpal
872         colbarfor = ', format = '''+fmt+''''
873         IF found EQ 1 THEN BEGIN
874            labstr = ',label=3'
875            ; if mincmd/naxcmd not defined then use one from palette
876            ; if define take min of 2 mins and max of 2 maxs
877            min_palette = min(levels_gmt)
878            max_palette = max(levels_gmt)
879            IF finite(minc) NE 0 THEN BEGIN
880             minc = min([minc, min_palette])
881            ENDIF ELSE BEGIN
882             minc = min_palette
883            ENDELSE
884            IF finite(maxc) NE 0 THEN BEGIN
885             maxc = max([maxc, max_palette])
886            ENDIF ELSE BEGIN
887             maxc = max_palette
888            ENDELSE
889            print, '    '+cmd.var, ' plot attributes ('+plttyp+') modified via color palette: min/max=', $
890    minc, maxc
891         ENDIF
892      ENDIF
893   ENDIF
894   colbar = colbarfor
895
896   mincmd = ''
897   maxcmd = ''
898
899   IF finite(minc) NE 0 THEN BEGIN
900      mincmd = ','+string(minc)
901      maxcmd = ','+string(maxc)
902   ENDIF
903
904; contour annotation + other color bar controls
905
906   IF n_elements(c_anot_str) EQ 0 THEN BEGIN
907      c_anot = ''
908   ENDIF ELSE BEGIN
909      c_anot = ',c_annotation=c_anot_str'
910      ; sampling of colorbar annotation
911      IF col_palette EQ 'yes' THEN BEGIN
912         sampling = win[0]*win[1]
913;         idx_cb = lindgen((ncont_gmt-2)/sampling)*sampling+1
914         idx_cb0 = lindgen(ncont_gmt-1)+1
915         idx_cb = lindgen(ncont_gmt-2)+2
916         idx_cb1 = lindgen(ncont_gmt-2)+1
917         colbar = colbar+',discret=coul_gmt[idx_cb1],div=n_elements(idx_cb0)-1,cb_label=levels_gmt[idx_cb0]'
918;         c_anot = ',c_annotation=levels_gmt[idx_cb0]'
919      ENDIF
920   ENDELSE
921;
922; vertical grid type
923;
924   IF debug_w THEN BEGIN
925    print, '    splot=', splot
926   ENDIF
927   CASE mesh_type OF
928      'oce': BEGIN
929         IF splot EQ 1 THEN BEGIN
930            type_yz = ',type_yz =''sigma'''
931            zoom_txt = ', zoom='+string(sig_max)
932         ENDIF ELSE BEGIN
933            type_yz = ',type_yz=''m'''
934            zoom_txt = ', zoom='+string(zoom_z)
935         ENDELSE
936         END
937      'atm': BEGIN & type_yz = ',type_yz=''Pa''' & zoom_txt = ', zoom='+string(pres_max) & END
938      ELSE:type_yz = ''
939   ENDCASE
940
941; continents color, thickness
942;   c_cont = 100
943; continent fill
944; real continent drawn
945   strcont =''
946   IF mesh_type NE 'oce' THEN BEGIN
947      IF cont_fill EQ 0 THEN BEGIN
948       strcont = ',/CONT_NOFILL, nite=0'
949      ENDIF
950      IF cont_real GE 1 THEN BEGIN
951       strcont = strcont+', REALCONT = '+string(strtrim(cont_real, 2))+', COAST_THICK = 2'
952      ENDIF
953   ENDIF
954
955; calendar type
956
957   cal_typ = ''
958   IF calendar_type GT 1 THEN BEGIN
959    cal_typ = ',ndayspm=calendar_type'
960   ENDIF
961
962; titles options
963; By default, SAXO puts a title and a subtitle for the first plot
964; Then, if you overlay another field, title and subtitle are set to ''
965   CASE title_type OF
966      "T": tit_str = ',subtitle='''','+marge_option
967      "S": tit_str = ',title='''','+marge_option
968      "TS": tit_str = ','+marge_option
969      "off":tit_str = ',title='''',subtitle='''','+marge_option
970   ENDCASE
971
972; fill_space option
973
974   filltxt = ''
975   IF fill_space EQ 1 THEN BEGIN
976    filltxt = ',/rempli'
977   ENDIF
978
979; axis charsize option (x/ychartxt read from plt_def)
980
981; common command string to plots
982
983   com_strplt = ',petit = ['+string(win[0])+','+string(win[1])+','+string(win[2])+']'+filltxt+nocoltxt+', LANDSCAPE = '+string(landscape)+', NOCOLORBAR = '+string(nocolorbar)+', NOERASE = '+string(noerase)+look+labstr+c_anot+colbar+cal_typ+',cont_thick=2'+type_yz+window_number+tit_str+xlogax+', xcharsize='+string(xchartxt)+', ycharsize='+string(ychartxt)
984
985; add contour_options not overlay
986
987   IF iover EQ 1 THEN BEGIN
988    com_strplt = com_strplt+contour_options
989   ENDIF
990
991   IF debug_w THEN BEGIN
992    print, '   Cmd before making output in plt_map = ', cmd
993    print, '   We are in plt_map: '
994   ENDIF
995
996;   @zoom_indices_debug
997
998; ============================
999;  3. make output (data/plot)
1000; ============================
1001;
1002
1003   CASE cmd.out OF
1004      'data': write_data = long((iplot-1)*10+win[2])  ;  write 1D data ascii in trends.pro
1005      'tcdf': write_data = -long((iplot-1)*10+win[2])  ;  write 1D data netcdf in trends.pro
1006      'cdf': write_data = 0
1007      ELSE: write_data = 0
1008   ENDCASE
1009
1010;  make output
1011
1012   CASE cmd.out OF
1013      'tv': BEGIN ; $$$$$$$$$$$$$$$$$$$$$$ tvnplot $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
1014         erase
1015
1016         CASE (size(fld))[0] OF
1017            2: fldtv = fld
1018            3: BEGIN
1019               niveau = xquestion('3d data : which level ?', '1', /chkwidget)
1020               fldtv = fld[*, *, niveau]
1021            END
1022            4: BEGIN
1023               niveau = xquestion('3d data : which level ?', '1', /chkwidget)
1024               timeplot = xquestion('4d data : which date ?', '1', /chkwidget)
1025               fldtv = fld[*, *, niveau, timeplot]
1026            END
1027            ELSE:
1028         ENDCASE
1029
1030         CASE cmd.grid OF
1031;         'T': tvnplot, fldtv*tmask
1032            'T': tvplus, fldtv, min = fldatt.min, max = fldatt.max
1033            'U': tvplus, fldtv, min = fldatt.min, max = fldatt.max
1034            'V': tvplus, fldtv, min = fldatt.min, max = fldatt.max
1035            'W': tvplus, fldtv, min = fldatt.min, max = fldatt.max
1036            ELSE: tvplus, fldtv, min = fldatt.min, max = fldatt.max
1037         ENDCASE
1038      END
1039
1040      'cdf': BEGIN  ; $$$$$$$$$$$$$$$$$$$$$$   netCDF output $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
1041
1042         ; build structures containing grids
1043         cdf_description = nc_build(cmd, field, field.direc, vargrid)
1044         ; build netCDF file (here if whole data)
1045         IF hotyp EQ '-' OR hotyp EQ 'xyt' THEN BEGIN
1046            fldcdf = {data:field.data, units:field.units, short_name:cmd.var, long_name:field.legend, missing_value:valmask, direc:field.direc}
1047            file_out = cmd.var+'_'+strtrim(string(FORMAT = '(I2.2)', iplot), 2)+'.nc'
1048            pltcmd ='nc_put, fldcdf, file_out, ncdf_db = hom_idl'+cdf_description
1049            printf, nulhis, strcompress(pltcmd)
1050            res = execute(pltcmd)
1051         ENDIF
1052       END
1053       'tcdf': BEGIN ; $$$$$$$$$$$$$$$$$$$$$$   1D netCDF output $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
1054          mask_z, fld, cmd, boite_plt1d, dimplot
1055          fld = checkfield(fld, 'pltt', type = datyp.hotyp, boite = boite_plt1d)
1056          IF debug_w THEN BEGIN
1057           print, 'size(fld)', size(fld)
1058           print, 'boite_plt1d', boite_plt1d
1059          ENDIF
1060          IF cmd.trend GT 0 THEN BEGIN
1061             fld = trends(fld, cmd.trend, datyp.hotyp)
1062             add_txt = trd_txt
1063          ENDIF ELSE BEGIN
1064             print, 'You need to have a trend to make 1D netcdf output'
1065          ENDELSE
1066       END
1067       ELSE: BEGIN ; $$$$$$$$$$$$$$$$$$$$$$$$$$   make plot   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
1068
1069          IF debug_w THEN BEGIN
1070             print, '   Plot type (plttyp) = ', plttyp
1071          ENDIF
1072         CASE plttyp OF
1073            'plt': BEGIN
1074         ;
1075         ; Map plot
1076         ; --------
1077         ;
1078               print, '     '+cmd.var+' data to plot min and max :            ', $
1079                min(fld[where (fld LE valmask/10)], /nan), max(fld[where (fld LE valmask/10)], /nan)
1080               print, ''
1081
1082               map_cmd = ''
1083
1084               niveau = 1
1085
1086               ; compute mean and rms of field
1087               ; zmean = moyenne(fld, 'xy', boite = box_plt, /NAN)
1088               ; zrms = moyenne(fld, 'xy', boite = box_plt, /RMS, /NAN)
1089               ;filleg = ' [region mean/rms='+string(strtrim(zmean, 2))+'/'+string(strtrim(zrms, 2))+']'
1090               filleg = ''
1091
1092               IF vecplot EQ 0 THEN BEGIN
1093                  ; eddy field ? (if so, remove zonal mean)
1094                  IF strpos(cmd.plt, '@z') GT 1 THEN BEGIN
1095                     fldzm = moyenne(fld, 'x', boite=[20,380,-90,90], /NAN)
1096                     fldzm = replicate(1, (size(fld))[1])#fldzm
1097                     fld = fld-fldzm
1098                     edd_txt = ' Eddy '
1099                  ENDIF ELSE BEGIN
1100                     edd_txt = ''
1101                  ENDELSE
1102
1103                  IF hotyp EQ 'xyt' THEN BEGIN
1104                   date_txt = 'monthly'
1105                  ENDIF
1106
1107                  pltcmd = 'plt,{a:fld, d:'''+date_txt+''', n:'''+edd_txt+varlegend+' '+legbox+legsurf+''', u:'''+field.units+filleg+''', g:'''+vargrid+'''}'+mincmd+maxcmd+intcmd+com_strplt+strcont+map_cmd
1108                  ;; For 2D plots with overlays (correlation and proba for instance)
1109                  ;; Scratch the titles and define contours style for the second plot
1110                  IF nover GT 1 AND iover GT 1 THEN BEGIN
1111                     contour_style = ',c_thick=2,c_linestyle=2,c_charthick=2'
1112                     CASE title_type OF
1113                        'T': pltcmd = pltcmd+',title='''''+contour_style
1114                        'S': pltcmd = pltcmd+',subtitle='''''+contour_style
1115                        'TS': pltcmd = pltcmd+',title='''',subtitle='''''+contour_style
1116                        'off': pltcmd = pltcmd+contour_style
1117                     END
1118                  ENDIF
1119               ENDIF ELSE BEGIN
1120
1121                  fld = {a:fld, g:strmid(cmd.grid, 0, 1)}
1122                  fld2 = {a:fld2, g:strmid(cmd.grid, 1, 1)}
1123                  fldv = {data1: fld, data2: fld2}
1124                  vargrid = strmid(cmd.grid, 2, 1)
1125
1126                  pltcmd = 'ajoutvect,fldv'+vect_sample+com_strplt+strcont+map_cmd
1127
1128               ENDELSE
1129
1130               IF debug_w THEN BEGIN
1131                print, strcompress(pltcmd)
1132               ENDIF
1133               printf, nulhis, strcompress(pltcmd)
1134               res = execute(pltcmd[0])
1135
1136               ; draw nino boxes
1137               IF nino_plot GE 1 THEN BEGIN
1138                  xn4 = [160, 210, 210, 160, 160]
1139                  yn4 = [5, 5, -5, -5, 5]
1140                  plot, xn4, yn4, /noerase
1141                  xn3 = [210, 270, 270, 210, 210]
1142                  yn3 = [5, 5, -5, -5, 5]
1143                  plot, xn3, yn3, /noerase
1144                  IF nino_plot GE 2 THEN BEGIN
1145                     xn1 = [270, 280, 280, 270, 270]
1146                     yn1 = [-5, -5, -10, -10, -5]
1147                     plot, xn1, yn1, /noerase
1148                     xn2 = [270, 280, 280, 270, 270]
1149                     yn2 = [0, 0, -5, -5, 0]
1150                     plot, xn2, yn2, /noerase
1151                  ENDIF
1152               ENDIF
1153
1154            END
1155            'pltz': BEGIN
1156         ;
1157         ; Vertical section/mean plot
1158         ; --------------------------
1159         ;
1160               g = gphit
1161               t = tmask
1162
1163                                ; if already 1D, reform fld
1164               fld = reform(fld)
1165
1166            ; mask fld
1167               mask_z, fld, cmd, boite_pltz, dimplot, legz
1168               printf, nulhis, ' boite_pltz = ', boite_pltz
1169
1170               print, '     '+cmd.var+' data to plot min and max :            ', $
1171                min(fld[where (fld NE valmask)], /NAN), max(fld[where (fld NE valmask)], /NAN)
1172               print, ''
1173               IF vecplot EQ 0 THEN BEGIN
1174
1175                  IF cmd.var EQ 'vozonbsf' THEN BEGIN
1176                   xindstr = ', /xindex'
1177                  ENDIF ELSE BEGIN
1178                   xindstr = ''
1179                  ENDELSE
1180
1181                  pltcmd = 'pltz,{a:fld, d:'''+date_txt+''', n:'''+varlegend+'   '+legz+''', u:'''+field.units+''', g:'''+vargrid+'''}'+mincmd+maxcmd+intcmd+',/'+pltztyp+', boite=boite_pltz'+zoom_txt+com_strplt+xindstr
1182
1183
1184               ENDIF ELSE BEGIN
1185
1186                  fld = {a:fld, g:strmid(cmd.grid, 0, 1)}
1187                  fld2 = {a:fld2, g:strmid(cmd.grid, 1, 1)}
1188                  fldv = {data1: fld, data2: fld2}
1189                  vargrid = strmid(cmd.grid, 2, 1)
1190
1191                  pltcmd = 'ajoutvectz,fldv'+com_strplt+strcont+',type='''+strmid(cmd.plt, 0, 2)+''', boite=boite_pltz'
1192
1193               ENDELSE
1194
1195               IF debug_w THEN BEGIN
1196                print, pltcmd
1197               ENDIF
1198               printf, nulhis, strcompress(pltcmd)
1199               res = execute(pltcmd[0])
1200
1201
1202               ; overlay bowl if sig_bowl=1
1203               IF sig_bowl EQ 1 THEN BEGIN
1204                  ; define line color, thickness and type
1205                  iover = 2
1206                  overc = overlay_type(iover, dimplot)
1207                  ; type of latitude axis
1208                  IF strmid(cmd.plt, 0, 1) EQ 'y' AND lat_axis EQ 'sin' THEN BEGIN
1209                   sin = ',/sin'
1210                  ENDIF ELSE BEGIN
1211                   sin = ''
1212                  ENDELSE
1213                  plt1dtyp = strmid(pltztyp, 0, 1)
1214                  noerase = 1
1215                  com_strplt = ', NOERASE = '+string(noerase)
1216                  pltcmd = 'plt1d,field.bowl,/'+plt1dtyp+', boite=boite_pltz'+overc+sin+com_strplt
1217                  IF debug_w THEN BEGIN
1218                   print, pltcmd
1219                  ENDIF
1220
1221                  res = execute(pltcmd[0])
1222               ENDIF
1223
1224               gphit = g
1225               tmask = t
1226
1227            END
1228            'plt1d': BEGIN
1229         ;
1230         ; 1D, x, y, z plot
1231         ; ----------------
1232         ;
1233               g = gphit
1234               t = tmask
1235            ; if already 1D, reform fld
1236               fld = reform(fld)
1237               
1238            ; mask fld
1239               mask_z, fld, cmd, boite_plt1d, dimplot, legz
1240
1241               IF debug_w THEN BEGIN
1242                print, '  iover, boite_plt1d in plt1d:', iover, boite_plt1d
1243               ENDIF
1244               niveau = 1
1245            ; define line color, thickness and type
1246               overc = overlay_type(iover, dimplot)
1247            ; type of latitude axis
1248               IF strmid(cmd.plt, 0, 1) EQ 'y' AND lat_axis EQ 'sin' THEN BEGIN
1249                sin = ',/sin'
1250               ENDIF ELSE BEGIN
1251                sin = ''
1252               ENDELSE
1253               take_log = ',take_log=0'
1254               IF cmd.var EQ 'vosigvol' AND n_elements(strsplit(cmd.exp,'-', /EXTRACT)) EQ 1 THEN BEGIN ; don't take log if difference plot
1255                  take_log = ',take_log=1'
1256               ENDIF
1257               ; if ensemble loop on each member
1258                  ; if ensbl_mean=0 plot just members
1259                  ; if ensbl_mean=1 plot members + ensemble mean
1260                  ; if ensbl_mean=2 plot min/max envelop + ensemble mean
1261               IF ensbl_code NE '' THEN BEGIN
1262                  iens = 0
1263                  jpe = jpk
1264                  IF ensbl_diff_other EQ 1 AND ensbl_dim GT 1 THEN BEGIN
1265                     jpe = (size(fld))[3]
1266                  ENDIF
1267                  IF debug_w THEN BEGIN
1268                     print, '  jpe in plt_map/plt1d:', jpe
1269                  ENDIF
1270                  WHILE iens LE jpe -1 DO BEGIN
1271                     IF jpe GT 1 THEN BEGIN
1272                        flde = reform(fld[*, *, iens, *], nxt, nyt, jpt)
1273                     ENDIF ELSE BEGIN
1274                        flde = fld
1275                     ENDELSE
1276                     overc = overlay_type_ensbl(iover, iens, /member)
1277                     IF ensbl_mean GT 0 THEN BEGIN
1278                        IF iens EQ 0 THEN BEGIN
1279                           fldmean = flde
1280                        ENDIF ELSE BEGIN
1281                           fldmean = fldmean+flde
1282                        ENDELSE
1283                     ENDIF
1284                     IF ensbl_mean LE 1 OR dimplot EQ 2 THEN BEGIN ; plot each member
1285                        pltcmd = 'plt1d,{a:flde, d:'''+date_txt+''', n:'''+varlegend+'   '+legz+''', u:'''+field.units+''', g:'''+vargrid+'''},'''+plt1dtyp+''''+mincmd+maxcmd+intcmd+', boite=boite_plt1d'+overc+sin+com_strplt+take_log
1286                        printf, nulhis, strcompress(pltcmd)
1287                        IF debug_w THEN BEGIN
1288                           print, pltcmd
1289                        ENDIF
1290                        res = execute(pltcmd[0])
1291                     ENDIF
1292                     IF ensbl_code EQ 'mame' AND iover EQ jpe-1 THEN BEGIN
1293                        nb_cycles = 1
1294                        @legend_overlay
1295                     ENDIF
1296                     iens = iens + 1
1297                  ENDWHILE
1298                  ; compute and draw ensemble_mean (if ensbl_mean eq 1 and dimplot ne 2)
1299                  IF dimplot EQ 1 THEN BEGIN
1300                     IF ensbl_mean GE 1 AND ensbl_code NE 'mame' THEN BEGIN
1301                        fldmean = fldmean/float(jpe)
1302                        IF ensbl_mean EQ 2 THEN BEGIN
1303                           overc = overlay_type_ensbl(iover, 0, /mean)
1304                        ENDIF ELSE BEGIN
1305                           overc = overlay_type_ensbl(iover, iens, /mean)
1306                        ENDELSE
1307                        pltcmd = 'plt1d,{a:fldmean, d:'''+date_txt+''', n:'''+varlegend+'   '+legz+''', u:'''+field.units+''', g:'''+vargrid+'''},'''+plt1dtyp+''''+mincmd+maxcmd+intcmd+', boite=boite_plt1d'+overc+sin+com_strplt+take_log
1308                        printf, nulhis, strcompress(pltcmd)
1309                        IF debug_w THEN BEGIN
1310                           print, pltcmd
1311                        ENDIF
1312                        res = execute(pltcmd[0])
1313                       ; increment line properties index
1314                        index_over = index_over + 1
1315                     ENDIF
1316                                ; compute and draw min/max envelop
1317                     IF ensbl_mean EQ 2 AND ensbl_code NE 'mame' THEN BEGIN
1318                        fldetmp = grossemoyenne(fld, 'xy', /NAN)
1319                        fldemin = min(fldetmp, DIMENSION = 1)
1320                        fldemax = max(fldetmp, DIMENSION = 1)
1321                        overc = overlay_type_ensbl(iover, iens, /member)
1322                        pltcmd = 'plt1d,{a:fldemin, n:'''+date_txt+'  '+varlegend+'   '+legbox+''', u:'''+field.units+filleg+''', g:'''+vargrid+'''}, '''+hotyp+''''+com_strplt+overc
1323                        printf, nulhis, strcompress(pltcmd)
1324                        IF debug_w THEN BEGIN
1325                           print, pltcmd
1326                        ENDIF
1327                        res = execute(pltcmd[0])
1328                        pltcmd = 'plt1d,{a:fldemax, n:'''+date_txt+'  '+varlegend+'   '+legbox+''', u:'''+field.units+filleg+''', g:'''+vargrid+'''}, '''+hotyp+''''+com_strplt+overc
1329                        printf, nulhis, strcompress(pltcmd)
1330                        IF debug_w THEN BEGIN
1331                           print, pltcmd
1332                        ENDIF
1333                        res = execute(pltcmd[0])
1334                     ENDIF
1335                  ENDIF
1336                  ; increment line properties index
1337                  index_over = index_over + jpe - 1
1338                  IF debug_w GE 2 THEN BEGIN
1339                     ready = ''
1340                     read,'<Return> for next curve ', ready
1341                  ENDIF
1342               ENDIF ELSE BEGIN ; General pltt case
1343                  print, '     '+cmd.var+' data to plot min and max :            ', $
1344                   min(fld[where (fld NE valmask)]), max(fld[where (fld NE valmask)])
1345                  pltcmd = 'plt1d,{a:fld, d:'''+date_txt+''', n:'''+varlegend+'   '+legz+''', u:'''+field.units+''', g:'''+vargrid+'''},'''+plt1dtyp+''''+mincmd+maxcmd+intcmd+', boite=boite_plt1d'+overc+sin+com_strplt+take_log
1346                  printf, nulhis, 'boite_plt1d=',boite_plt1d
1347                  printf, nulhis, strcompress(pltcmd)
1348                  IF debug_w THEN BEGIN
1349                     print, pltcmd
1350                  ENDIF
1351                  res = execute(pltcmd[0])
1352                 
1353               ENDELSE
1354               @legend_overlay
1355               ; draw zero lines
1356               xn = [0, 0]
1357               yn = [-1.e10, 1.e10]
1358               plot, xn, yn, /noerase
1359               plot, yn, xn, /noerase
1360               gphit = g
1361               tmask = t
1362
1363            END
1364            'pltt': BEGIN
1365            ;
1366            ; hovmoeller
1367            ; -----------
1368            ;
1369               g = gphit
1370               t = tmask
1371
1372            ; mask fld
1373            mask_z, fld, cmd, boite_pltt, dimplot, legz
1374            ; define line color, thickness and type
1375            overc = overlay_type(iover, dimplot)
1376            ; define additional text for pltt
1377            @add_txt_pltt
1378
1379            ; General case: compute mean and time rms if hoytp='t'
1380            ; Ensemble case : tbd
1381               IF hotyp EQ 't' THEN BEGIN
1382                  IF ensbl_code EQ '' THEN BEGIN
1383                     IF field.dim EQ 3 THEN BEGIN
1384                        zmeant = grossemoyenne(fld, 'xy', boite = boite_pltt, /NAN)
1385                     ENDIF ELSE BEGIN
1386                        zmeant = grossemoyenne(fld, 'xyz', boite = boite_pltt, /NAN)
1387                     ENDELSE
1388                     zmean = total(zmeant)/float(jpt)
1389                     zrms = sqrt(total(zmeant^2))/float(jpt)
1390                     filleg = filleg+' ['+cmd.exp+' time mean='+string(strtrim(zmean, 2))+'/ time rms of '+legbox+' ave.='+string(strtrim(zrms, 2))+']'
1391                     print, '   '+cmd.exp+'  time mean=  '+string(strtrim(zmean, 2))+' / time rms of '+legbox+' ave.='+string(strtrim(zrms, 2))+''
1392                  ENDIF ELSE BEGIN
1393                     filleg = ' stats on ensembles tbd'
1394                     print,' stats on ensembles tbd'
1395                  ENDELSE
1396               ENDIF
1397            ; repeat for seasonal mean
1398               CASE cmd.timave OF
1399                  '1mm': rep_txt = ',repeat_c=nb_cycles,DATE_FORMAT="%M"'
1400                  ELSE: rep_txt = ''
1401               ENDCASE
1402
1403               print, '     '+cmd.var+' data to plot min and max :            ', $
1404                min(fld[where (fld NE valmask)]), max(fld[where (fld NE valmask)])
1405               print, ''
1406               vardate = 'toto'
1407               grille, mask, glam, gphi, gdep, nx, ny,nz
1408
1409
1410               ; if common_time = 1, then impose common time array (from first one)
1411
1412               IF common_time EQ 1 THEN BEGIN
1413                  IF iover EQ 1 THEN BEGIN
1414                   time_prev = time
1415                  ENDIF ELSE BEGIN
1416                   time = time_prev
1417                  ENDELSE
1418               ENDIF
1419               printf, nulhis, 'boite_pltt=',boite_pltt
1420
1421               IF debug_w THEN BEGIN
1422                  print, '          Calendar type = ', key_caltype
1423               ENDIF
1424
1425               ; if time_domain NE 'auto' then impose time_domain
1426               IF time_domain[0] NE 'auto' THEN BEGIN
1427                  datdom1 = time_domain[0]+'01'
1428                  datdom2 = time_domain[1]+'31'
1429                  datdomtxt = ','+datdom1+','+datdom2
1430               ENDIF ELSE BEGIN
1431                  datdomtxt = ''
1432               ENDELSE
1433
1434               IF st_rms EQ 1 THEN BEGIN
1435                  ; time series of rms deviation on a sigma surface
1436                  @densit_pltmap_plot
1437               ENDIF ELSE BEGIN
1438                  ; if ensemble loop on each member
1439                  ; if ensbl_mean=0 plot just members
1440                  ; if ensbl_mean=1 plot members + ensemble mean
1441                  ; if ensbl_mean=2 plot min/max envelop + ensemble mean
1442                  IF ensbl_code NE '' THEN BEGIN
1443                     iens = 0
1444                     jpe = jpk
1445                     IF ensbl_diff_other EQ 1 AND ensbl_dim GT 1 THEN BEGIN
1446                        jpe = (size(fld))[3]
1447                     ENDIF
1448                     IF debug_w THEN BEGIN
1449                        print, ' jpe in plt_map/pltt:', jpe
1450                     ENDIF
1451                     WHILE iens LE jpe -1 DO BEGIN
1452                        IF jpe GT 1 THEN BEGIN
1453                           flde = reform(fld[*, *, iens, *], nxt, nyt, jpt)
1454                        ENDIF ELSE BEGIN
1455                           flde = fld
1456                        ENDELSE
1457                        IF dimplot EQ 1 THEN BEGIN
1458                           overc = overlay_type_ensbl(iover, iens, /member)
1459                        ENDIF ELSE BEGIN
1460                           overc = ""
1461                        ENDELSE
1462                        IF ensbl_mean GT 0 THEN BEGIN
1463                           IF iens EQ 0 THEN BEGIN
1464                              fldmean = flde
1465                           ENDIF ELSE BEGIN
1466                              fldmean = fldmean+flde
1467                           ENDELSE
1468                        ENDIF
1469                        IF ensbl_mean LE 1 OR dimplot EQ 2 THEN BEGIN ; plot each member
1470                           pltcmd = 'pltt,{a:flde, n:'''+date_txt+'  '+varlegend+'   '+legbox+''', u:'''+field.units+filleg+''', g:'''+vargrid+'''}, '''+hotyp+''''+mincmd+maxcmd+datdomtxt+intcmd+',boite=boite_pltt'+com_strplt+overc+filtxt+',TREND_TYPE='+cmd.trend+rep_txt
1471                           printf, nulhis, strcompress(pltcmd)
1472                           IF debug_w THEN BEGIN
1473                              print, pltcmd
1474                           ENDIF
1475                           res = execute(pltcmd[0])
1476                        ENDIF
1477                        IF ensbl_code EQ 'mame' AND iover EQ jpe-1 THEN BEGIN
1478                           nb_cycles = 1
1479                           @legend_overlay
1480                        ENDIF
1481                        iens = iens + 1
1482                     ENDWHILE
1483                     ; compute and draw ensemble_mean (if ensbl_mean eq 1 and dimplot ne 2)
1484                     IF dimplot EQ 1 THEN BEGIN
1485                        IF ensbl_mean GE 1 AND ensbl_code NE 'mame' THEN BEGIN
1486                           fldmean = fldmean/float(jpe)
1487                           IF ensbl_mean EQ 2 THEN BEGIN
1488                              overc = overlay_type_ensbl(iover, 0, /mean)
1489                           ENDIF ELSE BEGIN
1490                              overc = overlay_type_ensbl(iover, iens, /mean)
1491                           ENDELSE
1492                           pltcmd = 'pltt,{a:fldmean, n:'''+date_txt+'  '+varlegend+'   '+legbox+''', u:'''+field.units+filleg+''', g:'''+vargrid+'''}, '''+hotyp+''''+mincmd+maxcmd+datdomtxt+intcmd+',boite=boite_pltt'+com_strplt+overc+filtxt+',TREND_TYPE='+cmd.trend+rep_txt
1493                           printf, nulhis, strcompress(pltcmd)
1494                           IF debug_w THEN BEGIN
1495                              print, pltcmd
1496                           ENDIF
1497                           res = execute(pltcmd[0])
1498                           index_over = index_over + 1
1499                        ENDIF
1500                                ; compute and draw min/max envelop
1501                        IF ensbl_mean EQ 2 AND ensbl_code NE 'mame' THEN BEGIN
1502                           fldetmp = grossemoyenne(fld, 'xy', /NAN)
1503                           fldemin = min(fldetmp, DIMENSION = 1)
1504                           fldemax = max(fldetmp, DIMENSION = 1)
1505                           overc = overlay_type_ensbl(iover, iens, /member)
1506                           pltcmd = 'plt1d,{a:fldemin, n:'''+date_txt+'  '+varlegend+'   '+legbox+''', u:'''+field.units+filleg+''', g:'''+vargrid+'''}, '''+hotyp+''''+com_strplt+overc
1507                           printf, nulhis, strcompress(pltcmd)
1508                           IF debug_w THEN BEGIN
1509                              print, pltcmd
1510                           ENDIF
1511                           res = execute(pltcmd[0])
1512                           pltcmd = 'plt1d,{a:fldemax, n:'''+date_txt+'  '+varlegend+'   '+legbox+''', u:'''+field.units+filleg+''', g:'''+vargrid+'''}, '''+hotyp+''''+com_strplt+overc
1513                           printf, nulhis, strcompress(pltcmd)
1514                           IF debug_w THEN BEGIN
1515                              print, pltcmd
1516                           ENDIF
1517                           res = execute(pltcmd[0])
1518                        ENDIF
1519                     ENDIF
1520                     ; increment line properties index
1521                     index_over = index_over + jpe - 1
1522                     IF debug_w GE 2 THEN BEGIN
1523                        ready = ''
1524                        read,'<Return> for next curve ', ready
1525                     ENDIF
1526                  ENDIF ELSE BEGIN ; General pltt case
1527                     pltcmd = 'pltt,{a:fld, n:'''+date_txt+'  '+varlegend+'   '+legbox+''', u:'''+field.units+filleg+''', g:'''+vargrid+'''}, '''+hotyp+''''+mincmd+maxcmd+intcmd+datdomtxt+',boite=boite_pltt'+com_strplt+overc+filtxt+',TREND_TYPE='+cmd.trend+rep_txt ; +',/integration'
1528                     printf, nulhis, strcompress(pltcmd)
1529                     IF debug_w THEN BEGIN
1530                        print, pltcmd
1531                     ENDIF
1532                     res = execute(pltcmd[0])
1533                  ENDELSE
1534               ENDELSE
1535
1536               IF iover EQ 4 THEN BEGIN
1537                print, 'There might be a pb with the legends !'
1538               ENDIF
1539               ; legend if plot=t
1540               IF ensbl_code NE 'mame' THEN BEGIN
1541                  IF hotyp EQ 't' THEN BEGIN
1542                                ; positions of the legend depend on nb_cycles
1543                                ; it is different from 1 only with 1mm case
1544                     IF cmd.timave NE '1mm' THEN BEGIN
1545                        nb_cycles = 1
1546                     ENDIF
1547                     @legend_overlay
1548                  ENDIF
1549               ENDIF
1550               gphit = g
1551               tmask = t
1552               ; draw zero lines
1553               xn = [0, 0]
1554               yn = [-1.e10, 1.e10]
1555               plot, xn, yn, /noerase
1556               plot, yn, xn, /noerase
1557            END
1558
1559            'yfx': BEGIN
1560               @yfx
1561            END
1562            'ybinx': BEGIN
1563               @ybinx
1564            END
1565            'spec': BEGIN
1566         ;
1567         ; Spectrum plot y=fft(x)
1568         ; ---------------------
1569         ;
1570               t = tmask
1571            ; plot domain
1572               mask_z, fld, cmd, boite_pltspec, dimplot, legspec
1573            ; define line color and type
1574               overc = overlay_type(iover, dimplot)
1575               vardate = date_txt
1576               varname = varlegend
1577               varunit = cmd.exp+'   '+cmd.timave+' '+cmd.date1+'-'+cmd.spec+'  '+varlegend+'  '+legspec
1578
1579            ; make mean in box
1580               fld = checkfield(fld, 'pltt', type = 't', boite = boite_pltspec, _EXTRA=extra)
1581            ; apply trends
1582               IF long(cmd.trend) GT 0 THEN BEGIN
1583                fld = trends(fld, long(cmd.trend), 't')
1584               ENDIF
1585
1586            ; make spectrum
1587               time_interval = time[1]-time[0]
1588
1589               print, '     Max plot spectrum in plt_def : days/month/year ', max_spec, max_spec/30, max_spec/360
1590               print, '      lenght of time serie (years) = ', long(time[jpt-1]-time[0]+time_interval)/360
1591               print, '      spectrum window (years)/chunks = ', spec_win/360, long(time[jpt-1]-time[0]+time_interval)/spec_win
1592               print, ' '
1593
1594            ; number of time windowsš
1595               nt_win = long((time[jpt-1]-time[0]+time_interval)/spec_win)
1596               idx_win_size = long(spec_win/time_interval)
1597               IF idx_win_size*nt_win NE jpt THEN BEGIN
1598                  print, '   *** Warning : spec_win must divide lenght of time serie ', idx_win_size, jpt
1599                  stop
1600               ENDIF
1601            ; mean of idx_win_size chunks
1602               spect = spectrum(fld[0:idx_win_size-1], time_interval)
1603               FOR it = 2, nt_win DO BEGIN
1604                  idx1 = idx_win_size*(it-1)
1605                  idx2 = idx1 + idx_win_size - 1
1606                  specc = spectrum(fld[idx1:idx2], time_interval)
1607                  spect = spect + specc
1608               ENDFOR
1609               spect = spect/nt_win
1610            ; build new time array
1611               idx = where (spect[0, *] LE max_spec)
1612               jpt = n_elements(idx)
1613               fld = reverse(reform(spect[1, idx], jpt))
1614               time = findgen(jpt)
1615               time = reverse(reform(spect[0, idx], jpt))
1616               IF max(time) GT 20*360 THEN BEGIN
1617                  time = time/360
1618                  xtitle = 'Years'
1619               ENDIF ELSE IF max(time) GT 5*360 THEN BEGIN
1620                  time = time/30
1621                  xtitle = 'Months'
1622               ENDIF ELSE xtitle = 'Days'
1623            ; normalised spectra ?
1624               norms = 1
1625               IF norms EQ 1 THEN BEGIN
1626                  pmax = max(fld)
1627                  fld = fld/pmax
1628               ENDIF
1629            ; time/space filter ?
1630               IF strpos(cmd.plt, '@f') GT 1 THEN BEGIN
1631                  filter = long(strmid(cmd.plt, strpos(cmd.plt, '@f')+3, strlen(cmd.plt)-strpos(cmd.plt, '@f')-3))
1632                  fildirec = strmid(cmd.plt, strpos(cmd.plt, '@f')+2, 1)
1633                  IF fildirec EQ 't' THEN BEGIN
1634                     xtitle = xtitle+' (filter '+strtrim(string(filter), 2)+' warning : discrete filter)'
1635                     fld = smooth(fld, filter)
1636                     fld[0:filter/2-1] = 0.
1637                     fld[(size(fld))[1]-filter/2-1:(size(fld))[1]-1] = 0.
1638                  ENDIF
1639               ENDIF
1640
1641            ; rms with previous curve
1642
1643               IF iover EQ 1 THEN BEGIN
1644                  spec_prev = fld
1645               ENDIF ELSE BEGIN
1646                  time_int = time-shift(time, 1)
1647                  time_int[0] = 0.
1648                  divi = total(time_int^2)
1649                  rms_spec = sqrt( total( ((fld-spec_prev)*time_int)^2) / (divi > 0.))
1650                  print, '       RMS spectra difference with previous spectra =', rms_spec
1651               ENDELSE
1652
1653
1654            ; plot
1655               ytitle = 'Power spectrum (window='+strtrim(string(spec_win/360), 2)+'y)'
1656               pltcmd = 'splot,time,fld,xstyle=1,ystyle=1,title=varunit,xtitle=xtitle,ytitle=ytitle'+overc+com_strplt+',yrange=[0,'+string(fldatt.spec)+']'
1657               printf, nulhis, 'boite_pltspec=',boite_pltspec
1658               printf, nulhis, strcompress(pltcmd)
1659               IF debug_w THEN BEGIN
1660                print, pltcmd
1661               ENDIF
1662               res = execute(pltcmd[0])
1663
1664               tmask = t
1665
1666            END
1667            'wavelet': BEGIN
1668            ;
1669            ; Wavelet plot
1670            ; ------------
1671            ;
1672               t = tmask
1673            ; plot domain
1674               mask_z, fld, cmd, boite_pltspec, dimplot, legspec
1675            ; define line color and type
1676               vardate = date_txt
1677               varname = varlegend + ' '+date_txt
1678               varunit = cmd.exp+'   '+cmd.timave+' '+cmd.date1+'-'+cmd.spec+'  '+varlegend+'  '+legspec
1679            ; make mean in box
1680               fld = checkfield(fld, 'pltt', type = 't', boite = boite_pltspec, _EXTRA=extra)
1681            ; apply trends
1682               IF long(cmd.trend) GT 0 THEN BEGIN
1683                fld = trends(fld, long(cmd.trend), 't')
1684               ENDIF
1685
1686            ; make spectrum
1687               time_interval = time[1]-time[0]
1688
1689               print, '     Max plot spectrum in plt_def : days/month/year ', max_spec, max_spec/30, max_spec/360
1690               print, '      lenght of time serie (years) = ', long(time[jpt-1]-time[0]+time_interval)/360
1691               print, ' '
1692            ; make wavelet
1693               wave = wavelet(fld,time_interval,period=period,coi=coi,/pad,signif=signif)
1694               power = abs(wave)^2
1695               nscale = n_elements(period)
1696               period = period/365 ; to have period in years
1697            ; compute significance
1698               signif = rebin(transpose(signif),jpt,nscale)
1699            ; plot wavelet
1700               mincmd = ','+string(min(power))
1701               maxcmd = ','+string(max(power))
1702               boite_pltspec = [0, 0, min(period), max(period)]
1703;               domdef, boite_pltspec
1704               lat1r = lat1
1705               lat2r = lat2
1706               lat1 = 0
1707               lat2 = max_spec/360
1708               key_onearth = 0
1709               pltcmd = 'plttg,power,period'+mincmd+maxcmd+intcmd+',boite=boite_pltspec,reverse_y=1,nocontour=1'+com_strplt
1710               printf, nulhis, 'boite_pltspec=',boite_pltspec
1711               printf, nulhis, strcompress(pltcmd)
1712               IF debug_w THEN BEGIN
1713                print, pltcmd
1714               ENDIF
1715               res = execute(pltcmd[0])
1716               contour,abs(wave)^2/signif,time,period, /overplot,level=1.0,c_annot='95%'
1717               plot,time,coi/365, noclip = 0, /noerase
1718               tmask = t
1719               lat1 = lat1r
1720               lat2 = lat2r
1721               key_onearth = 1
1722            END
1723            ELSE: BEGIN
1724               print, ' unknown projection plot ', cmd.plt, ' / plot type = ', plttyp
1725
1726            END
1727         ENDCASE
1728
1729      END
1730
1731   ENDCASE
1732
1733   fld_prev = cmd.var
1734;
1735; reset incompatible options of plt_def
1736
1737   cmd.trend = trend_typp
1738
1739;
1740; reset vertical grid after density bining
1741
1742   IF splot EQ 1 THEN BEGIN
1743
1744      izminmesh = izminmesh_b
1745      izmaxmesh = izmaxmesh_b
1746      jpk = jpk_b
1747      jpkglo = jpkglo_b
1748      gdept = gdept_b
1749      gdepw = gdepw_b
1750      e3t = e3t_b
1751      e3w = e3w_b
1752      tmask = tmask_b
1753
1754   ENDIF
1755finish:
1756   IF debug_w THEN BEGIN
1757    info = report('leaving ...')
1758   ENDIF
1759;
1760END
Note: See TracBrowser for help on using the repository browser.