1 | pro 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 | ; |
---|
19 | param_namelist=[ nam1, "/", " ", "&datetime", nam2, nam3, nam4, "/", " ", "&interp", nam5 ] |
---|
20 | |
---|
21 | if (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) |
---|
26 | endif else begin |
---|
27 | temparr = tabnam[1:n_elements(tabnam)-1] |
---|
28 | endelse |
---|
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 | |
---|
43 | param_namelist=[param_namelist,levelstr] |
---|
44 | param_namelist=transpose(param_namelist) |
---|
45 | |
---|
46 | ; |
---|
47 | ; generate file (not available in demo mode) |
---|
48 | ; |
---|
49 | SPAWN, 'touch toto ; \rm toto' |
---|
50 | OPENW, 1, 'toto' |
---|
51 | PRINTF, 1, param_namelist |
---|
52 | CLOSE, 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 |
---|
61 | instru = 'sed s/zenest/'+nest+'/g namelist.ARWpost_ref > namelist.ARWpost_ref_tmp' |
---|
62 | instru = instru + ' ; ' + 'rm -rf zefolder ; ln -sf '+datafolder+' zefolder' |
---|
63 | instru = instru + ' ; ' + 'touch namelist.ARWpost ; \rm namelist.ARWpost ; mv namelist.ARWpost_ref_tmp namelist.ARWpost' |
---|
64 | if (grads eq 'true') then instru = instru + ' ; ' + "sed s/'idl'/'grads'/g namelist.ARWpost > yeye ; \mv yeye namelist.ARWpost" |
---|
65 | instru = instru + ' ; ' + 'cat toto >> namelist.ARWpost ; \rm toto' |
---|
66 | |
---|
67 | ; |
---|
68 | ; extract data from netcdf file |
---|
69 | ; |
---|
70 | instru = instru + ' ; ' + './ARWpost.exe' |
---|
71 | |
---|
72 | ; |
---|
73 | ; patch for correct time in plots |
---|
74 | ; |
---|
75 | instru = 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 |
---|
77 | if (grads ne 'true') then instru = instru + " ; " + "sed s/'Z'/' 0 Z'/g input.ctl > input_tmp.ctl ; mv -f input_tmp.ctl input.ctl" |
---|
78 | instru = instru + " ; " + "grep interval_seconds namelist.ARWpost | tail -n 1 | awk '{print $3}' > timefil ; cat timefil" |
---|
79 | SPAWN, instru |
---|
80 | |
---|
81 | ;;old ARWpost |
---|
82 | ;SPAWN, "sed s/'*'/'9'/g input.dat > yeah ; mv -f yeah input.dat" |
---|
83 | |
---|
84 | |
---|
85 | ;; fix debile |
---|
86 | SPAWN, "sed s/'SWDOWN 0 Z'/'SWDOWNZ'/g input.ctl > yeah ; mv -f yeah input.ctl" |
---|
87 | |
---|
88 | ; |
---|
89 | ; ok |
---|
90 | ; |
---|
91 | print, 'ok...' |
---|
92 | print, 'if the extraction was successful, ' |
---|
93 | print, 'you can use the input.dat and input.ctl files' |
---|
94 | |
---|
95 | if (grads eq 'true') then stop |
---|
96 | |
---|
97 | END |
---|