source: trunk/MESOSCALE_DEV/PLOT/ARWpost/call_arwpost.pro @ 296

Last change on this file since 296 was 85, checked in by aslmd, 14 years ago

LMD_MM_MARS et LMD_LES_MARS: ajout des routines IDL pour tracer les sorties --> voir mesoscale/PLOT

File size: 2.9 KB
Line 
1pro call_arwpost, nam1, nam2, nam3, nam4, nam5, tabnam, nest, datafolder, grads
2
3;
4; YOU MUST HAVE COMPILED ARWPOST.EXE !
5;
6
7;
8; USE:
9;  @plot.def
10;  then: call_arwpost, nam1, nam2, nam3, nam4, nam5, tabnam
11;
12; but you'd rather use the trace.idl script 
13
14
15
16;
17; prepare user_defined namelist part
18;
19param_namelist=[ nam1, "/", " ", "&datetime", nam2, nam3, nam4, "/", " ", "&interp", nam5 ]
20
21if (tabnam(0) ne 999.) then begin
22  ntot = ( 1+tabnam(1)-tabnam(0) ) / float(tabnam(2))
23  ;ntot = ( tabnam(1)-tabnam(0) ) / float(tabnam(2))
24  ntot = ceil(ntot)
25  temparr =  tabnam(0)+findgen(ntot)*tabnam(2)
26endif else begin
27  temparr = tabnam[1:n_elements(tabnam)-1]
28endelse
29
30
31        if (n_elements(temparr) le 5.) then begin
32                levelstr=[ " interp_levels = ", '   '+string(temparr,'(F7.3)'), "/"]
33        endif else begin
34                nnnn = floor(n_elements(temparr)/3.)
35                ye = strarr(nnnn)
36                for i=0,nnnn-2 do begin
37                  ye[i] = string(temparr[3*i],'(F7.3)')+','+string(temparr[3*i+1],'(F7.3)')+','+string(temparr[3*i+2],'(F7.3)')+','
38                endfor
39                ye[nnnn-1] = string(temparr[3*(nnnn-1)],'(F7.3)')+','+string(temparr[3*(nnnn-1)+1],'(F7.3)')+','+string(temparr[3*(nnnn-1)+2],'(F7.3)')
40                levelstr=[ "interp_levels = ", ye, "/"]
41        endelse
42
43param_namelist=[param_namelist,levelstr]
44param_namelist=transpose(param_namelist)
45
46;
47; generate file (not available in demo mode)
48;
49SPAWN, 'touch toto ; \rm toto'
50OPENW, 1, 'toto'
51PRINTF, 1, param_namelist
52CLOSE, 1
53        ;;
54        ;; fix for demo mode
55        ;;     
56        ;SPAWN, 'touch toto ; \rm toto ; touch toto'
57        ;for i=0, n_elements(param_namelist)-1 do begin
58        ;       SPAWN, 'echo "'+param_namelist[i]+'" >> toto'
59        ;       print, param_namelist[i]
60        ;endfor
61instru = 'sed s/zenest/'+nest+'/g namelist.ARWpost_ref > namelist.ARWpost_ref_tmp'
62instru = instru + ' ; ' + 'rm -rf zefolder ; ln -sf '+datafolder+' zefolder'
63instru = instru + ' ; ' + 'touch namelist.ARWpost ; \rm namelist.ARWpost ; mv namelist.ARWpost_ref_tmp namelist.ARWpost'
64if (grads eq 'true') then instru = instru + ' ; ' + "sed s/'idl'/'grads'/g namelist.ARWpost > yeye ; \mv yeye namelist.ARWpost"
65instru = instru + ' ; ' + 'cat toto >> namelist.ARWpost ; \rm toto'
66
67;
68; extract data from netcdf file
69;
70instru = instru + ' ; ' + './ARWpost.exe'
71
72;
73; patch for correct time in plots
74;
75instru = instru + " ; " + "touch input_tmp.ctl ; \rm input_tmp.ctl ; touch timefil ; \rm timefil"
76        ;;; this line induces problems with variables with Z in the name
77if (grads ne 'true') then instru = instru + " ; " + "sed s/'Z'/' 0 Z'/g input.ctl > input_tmp.ctl ; mv -f input_tmp.ctl input.ctl"
78instru = instru + " ; " + "grep interval_seconds namelist.ARWpost | tail -n 1 | awk '{print $3}' > timefil ; cat timefil"
79SPAWN, instru
80
81;;old ARWpost
82;SPAWN, "sed s/'*'/'9'/g input.dat > yeah ; mv -f yeah input.dat"
83
84
85;; fix debile
86SPAWN, "sed s/'SWDOWN 0 Z'/'SWDOWNZ'/g input.ctl > yeah ; mv -f yeah input.ctl"
87
88;
89; ok
90;
91print, 'ok...'
92print, 'if the extraction was successful, '
93print, 'you can use the input.dat and input.ctl files'
94
95if (grads eq 'true') then stop
96
97END
Note: See TracBrowser for help on using the repository browser.