[85] | 1 | pro hovmuller, $ |
---|
| 2 | what_I_plot, $ ; 2D field |
---|
| 3 | space, $ ; space coordinate |
---|
| 4 | time, $ ; time coordinate |
---|
| 5 | minfield=minfield_init, $ ; minimum value of plotted field (=0: calculate) |
---|
| 6 | maxfield=maxfield_init, $ ; maximum value of plotted field (=0: calculate) |
---|
| 7 | minspace=minspace, $ ; minimum value of space window (=0: calculate) |
---|
| 8 | maxspace=maxspace, $ ; maximum value of space window (=0: calculate) |
---|
| 9 | overcontour=overcontour, $ ; another 2D field to overplot with contour lines (=0: no) |
---|
| 10 | ct=pal, $ ; color table (33-rainbow is default) |
---|
| 11 | colors=colors, $ ; number of colors/levels (32 is default) |
---|
| 12 | title=title ; title of the plot ('' is default) |
---|
| 13 | |
---|
| 14 | ;-------------------------------------------- |
---|
| 15 | ; |
---|
| 16 | ; A general routine to plot hovmuller maps |
---|
| 17 | ; |
---|
| 18 | ; USE: - hovmuller, what_I_plot |
---|
| 19 | ; - hovmuller, what_I_plot, space, time |
---|
| 20 | ; - ... and see options above |
---|
| 21 | ; |
---|
| 22 | ;-------------------------------------------- |
---|
| 23 | ; A. Spiga, September 2007 |
---|
| 24 | ;-------------------------------------------- |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | ;--------------------------- |
---|
| 30 | ; a few permanent settings |
---|
| 31 | ;--------------------------- |
---|
| 32 | ; |
---|
| 33 | missing_value=1.e30 |
---|
| 34 | @param_plot.idl |
---|
| 35 | ; |
---|
| 36 | ;------------------ |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | ;------------------ |
---|
| 40 | ; user settings |
---|
| 41 | ;------------------ |
---|
| 42 | if (n_elements(space) eq 0) then begin |
---|
| 43 | space=findgen(n_elements(what_I_plot(*,0))) |
---|
| 44 | endif |
---|
| 45 | if (n_elements(time) eq 0) then begin |
---|
| 46 | time=findgen(n_elements(what_I_plot(0,*))) |
---|
| 47 | endif |
---|
| 48 | |
---|
| 49 | if (n_elements(minfield_init) eq 0) then minfield_init=0. |
---|
| 50 | if (n_elements(maxfield_init) eq 0) then maxfield_init=0. |
---|
| 51 | if (n_elements(minspace) eq 0) then minspace=0. |
---|
| 52 | if (n_elements(maxspace) eq 0) then maxspace=0. |
---|
| 53 | if (n_elements(colors) eq 0) then colors=32 |
---|
| 54 | if (n_elements(title) eq 0) then title='' |
---|
| 55 | if (n_elements(pal) eq 0) then pal=33 |
---|
| 56 | if (n_elements(overcontour) eq 0) then overcontour=0. |
---|
| 57 | if (n_elements(titlex) eq 0) then titlex='space' |
---|
| 58 | if (n_elements(titley) eq 0) then titley='time' |
---|
| 59 | |
---|
| 60 | ;------------------ |
---|
| 61 | ; limits |
---|
| 62 | ;------------------ |
---|
| 63 | if (minfield_init*maxfield_init eq 0) then begin |
---|
| 64 | ;---different min/max for each layer |
---|
| 65 | w=where(abs(what_I_plot) lt missing_value) |
---|
| 66 | if (w(0) ne -1) then begin |
---|
| 67 | minfield=min(what_I_plot[w]) |
---|
| 68 | maxfield=max(what_I_plot[w]) |
---|
| 69 | endif else begin |
---|
| 70 | what_I_plot=0. |
---|
| 71 | print, 'no valid values in this field' |
---|
| 72 | endelse |
---|
| 73 | endif else begin |
---|
| 74 | ;---user-defined limits |
---|
| 75 | minfield=minfield_init |
---|
| 76 | maxfield=maxfield_init |
---|
| 77 | ;;w=where(what_I_plot lt minfield) & if (w(0) ne -1) then what_I_plot[w]=minfield |
---|
| 78 | ;;w=where(what_I_plot gt maxfield) & if (w(0) ne -1) then what_I_plot[w]=maxfield |
---|
| 79 | endelse |
---|
| 80 | |
---|
| 81 | if ((minfield+maxfield eq 0) and (abs(minfield) ne abs(maxfield))) then begin |
---|
| 82 | print, 'nothing to plot ... skipping this plot ...' |
---|
| 83 | endif else begin |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | ;----------------------------------------- |
---|
| 88 | ; fix the possible longitude ugliness :) |
---|
| 89 | ; ...get rid of the -180/180 limit |
---|
| 90 | ;----------------------------------------- |
---|
| 91 | |
---|
| 92 | w=where(space eq min(space)) |
---|
| 93 | if (w(0) ne 0) then begin |
---|
| 94 | space[0:w(0)-1]=space[0:w(0)-1]-360 |
---|
| 95 | endif |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | ;--------------- |
---|
| 99 | ; adapt ticks |
---|
| 100 | ;--------------- |
---|
| 101 | if ((minspace eq 0) and (maxspace eq 0)) then begin |
---|
| 102 | minspace=min(space) |
---|
| 103 | maxspace=max(space) |
---|
| 104 | endif |
---|
| 105 | intervalx=round((maxspace-minspace)/8.) |
---|
| 106 | intervaly=round((max(time)-min(time))/5.) |
---|
| 107 | intervalx=60. |
---|
| 108 | intervaly=4. |
---|
| 109 | |
---|
| 110 | |
---|
| 111 | ;------------------ |
---|
| 112 | ; plot window |
---|
| 113 | ;------------------ |
---|
| 114 | |
---|
| 115 | ; to ensure the right limits |
---|
| 116 | dumb_what_I_plot=what_I_plot |
---|
| 117 | dumb_what_I_plot(*,*)=minfield & print, minfield |
---|
| 118 | dumb_what_I_plot(0,0)=maxfield & print, maxfield |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | loadct,0,/silent |
---|
| 122 | contour, $ |
---|
| 123 | /nodata, $ |
---|
| 124 | dumb_what_I_plot, $ |
---|
| 125 | space, $ |
---|
| 126 | time, $ |
---|
| 127 | title=title, $ |
---|
| 128 | xtitle=titlex, $ |
---|
| 129 | xrange=[minspace,maxspace], $ |
---|
| 130 | ytitle=titley, $ |
---|
| 131 | yrange=[min(time),max(time)], $ |
---|
| 132 | xtickinterval=intervalx, ytickinterval=intervaly, $ |
---|
| 133 | ; position=[0.15, 0.15, 0.95, 0.75], $ |
---|
| 134 | color=0 |
---|
| 135 | |
---|
| 136 | |
---|
| 137 | |
---|
| 138 | ;------------------ |
---|
| 139 | ; plot field |
---|
| 140 | ;------------------ |
---|
| 141 | |
---|
| 142 | ;lim=45. |
---|
| 143 | ;ecart=5. |
---|
| 144 | ;yeah=-lim + ecart*findgen(lim*2./5.) |
---|
| 145 | |
---|
| 146 | loadct,pal,/silent |
---|
| 147 | contour, what_I_plot, $ |
---|
| 148 | space, $ |
---|
| 149 | time, $ |
---|
| 150 | nlevels=colors, $ |
---|
| 151 | ;lev=yeah, $ |
---|
| 152 | /cell_fill, $ |
---|
| 153 | max_value=maxfield, $ |
---|
| 154 | min_value=minfield, $ |
---|
| 155 | /overplot |
---|
| 156 | |
---|
| 157 | |
---|
| 158 | ;------------------ |
---|
| 159 | ; colorbar |
---|
| 160 | ;------------------ |
---|
| 161 | |
---|
| 162 | ;;format_colorbar='(F6.2)' |
---|
| 163 | ;;format_colorbar='(F10.3)' |
---|
| 164 | ;;format_colorbar='(F12.2)' |
---|
| 165 | ;format_colorbar='(F4.0)' ;temperature |
---|
| 166 | ;colorbar, $ |
---|
| 167 | ;; position=[0.15, 0.85, 0.95, 0.90], $ |
---|
| 168 | ; /vertical, $ |
---|
| 169 | ; divisions=8, $ |
---|
| 170 | ; range=[minfield,maxfield], $ |
---|
| 171 | ; format=format_colorbar |
---|
| 172 | |
---|
| 173 | ;-------------------- |
---|
| 174 | ; overplot contour |
---|
| 175 | ;-------------------- |
---|
| 176 | if (n_elements(overcontour) ne 1) then begin |
---|
| 177 | |
---|
| 178 | w=where(abs(overcontour) lt missing_value) |
---|
| 179 | if (w(0) ne -1) then begin |
---|
| 180 | min_contour=min(overcontour[w]) |
---|
| 181 | max_contour=max(overcontour[w]) |
---|
| 182 | endif |
---|
| 183 | |
---|
| 184 | loadct,0,/silent |
---|
| 185 | contour, overcontour, $ |
---|
| 186 | space,time, $ |
---|
| 187 | nlevels=colors/2, $ |
---|
| 188 | max_value=max_contour, $ |
---|
| 189 | min_value=min_contour, $ |
---|
| 190 | c_labels=findgen(colors/2), $ |
---|
| 191 | color=0, $ |
---|
| 192 | /noerase, $ |
---|
| 193 | xtitle='space', $ |
---|
| 194 | xrange=[min(space),max(space)], $ |
---|
| 195 | ytitle='time', $ |
---|
| 196 | yrange=[min(time),max(time)], $ |
---|
| 197 | xtickinterval=intervalx, ytickinterval=intervaly, $ |
---|
| 198 | position=[0.15, 0.15, 0.95, 0.75] |
---|
| 199 | |
---|
| 200 | endif |
---|
| 201 | |
---|
| 202 | |
---|
| 203 | endelse |
---|
| 204 | |
---|
| 205 | end |
---|