1 | ;####################################################################### |
---|
2 | ;# Program language: IDL (Interactive Data Language), file-ending .pro # |
---|
3 | ;# # |
---|
4 | ;# This program creates png- or ps-images from netCDF-files generated # |
---|
5 | ;# by PALM. The images show timeseries of an available variable. # |
---|
6 | ;# # |
---|
7 | ;# Remarks: # |
---|
8 | ;# * Program reads netCDF files ending with *_ts.nc (PALM timeseries)# |
---|
9 | ;# * The input-parameters, that the program requires, have to be # |
---|
10 | ;# entered in the following section "ENTER PARAMETERS". # |
---|
11 | ;# * The program creates a .png or .ps image in the current directory# |
---|
12 | ;# # |
---|
13 | ;# coder: F. Herbort # |
---|
14 | ;####################################################################### |
---|
15 | ; # |
---|
16 | ; ENTER PARAMETERS: # |
---|
17 | ; ================= # |
---|
18 | ; # |
---|
19 | ; Host-Identifier: # |
---|
20 | hostid = 'lcsgih' ; # |
---|
21 | ; # |
---|
22 | ; Name of run: # |
---|
23 | name_of_run = 'example_cbl' ; sub-folder of # |
---|
24 | ; ~/palm/current_version/JOBS # |
---|
25 | ; Number for restart-files: # |
---|
26 | resnum = ' ' ; (blank if no restart-file is considered) # |
---|
27 | ; # |
---|
28 | ; Path to netCDF-file: # |
---|
29 | netcdf_path = '/home/herbort/palm/current_version/JOBS/'+name_of_run+'/OUTPUT/' ;# |
---|
30 | ; # |
---|
31 | ; Chosing desired variables (0 = no, 1 = yes): # |
---|
32 | tke_yn = 1 ; TKE # |
---|
33 | umax_yn = 1 ; maximum of u-wind component # |
---|
34 | vmax_yn = 1 ; maximum of v-wind component # |
---|
35 | wmax_yn = 1 ; maximum of w-wind component # |
---|
36 | ustern_yn = 1 ; u* # |
---|
37 | wstern_yn = 1 ; w* # |
---|
38 | ; # |
---|
39 | ; kind of image (.png or .ps): # |
---|
40 | png_yn = 1 ; # |
---|
41 | ps_yn = 0 ; # |
---|
42 | ;####################################################################### |
---|
43 | |
---|
44 | PRINT, ' ' |
---|
45 | PRINT, '===========================================================' |
---|
46 | PRINT, 'Program creates images from netCDF-files generated by PALM.' |
---|
47 | PRINT, 'The images show timeseries of different variables. ' |
---|
48 | PRINT, ' [F. Herbort]' |
---|
49 | PRINT, '===========================================================' |
---|
50 | PRINT, ' ' |
---|
51 | |
---|
52 | ;======================================================================= |
---|
53 | ; Constants and parameters: |
---|
54 | ; ------------------------- |
---|
55 | |
---|
56 | kind_data = 'ts' |
---|
57 | |
---|
58 | plotfile1 = 'E_'+name_of_run+'_idl_ts' |
---|
59 | plotfile2 = 'umax_'+name_of_run+'_idl_ts' |
---|
60 | plotfile3 = 'vmax_'+name_of_run+'_idl_ts' |
---|
61 | plotfile4 = 'wmax_'+name_of_run+'_idl_ts' |
---|
62 | plotfile5 = 'us_'+name_of_run+'_idl_ts' |
---|
63 | plotfile6 = 'ws_'+name_of_run+'_idl_ts' |
---|
64 | |
---|
65 | ;======================================================================= |
---|
66 | ; Checking existence of file: |
---|
67 | ; --------------------------- |
---|
68 | |
---|
69 | IF resnum EQ ' ' THEN datafile = hostid+'_'+name_of_run+'_'+kind_data+'.nc' |
---|
70 | IF resnum NE ' ' THEN datafile = hostid+'_'+name_of_run+'_'+kind_data+'.'+resnum+'.nc' |
---|
71 | input = netcdf_path+datafile |
---|
72 | |
---|
73 | fileyn = FILE_TEST(input) |
---|
74 | |
---|
75 | ; Checking, wether filename is without hostid at the beginning of filename: |
---|
76 | IF fileyn EQ 0L THEN BEGIN |
---|
77 | IF resnum EQ ' ' THEN datafile = name_of_run+'_'+kind_data+'.nc' |
---|
78 | IF resnum NE ' ' THEN datafile = name_of_run+'_'+kind_data+'.'+resnum+'.nc' |
---|
79 | input = netcdf_path+datafile |
---|
80 | fileyn = FILE_TEST(input) |
---|
81 | ENDIF |
---|
82 | |
---|
83 | IF fileyn EQ 0L THEN BEGIN |
---|
84 | PRINT, 'netCDF-file does not exist!' |
---|
85 | PRINT, 'Program aborted' |
---|
86 | PRINT, ' ' |
---|
87 | GOTO, abort_flag |
---|
88 | ENDIF |
---|
89 | |
---|
90 | ;======================================================================= |
---|
91 | ; Reading the profile data from netCDF-file: |
---|
92 | ; ------------------------------------------ |
---|
93 | |
---|
94 | nid = NCDF_OPEN(input) |
---|
95 | |
---|
96 | NCDF_VARGET, nid, 'time', time |
---|
97 | IF tke_yn NE 0 THEN NCDF_VARGET, nid, 'E', tke |
---|
98 | IF umax_yn NE 0 THEN NCDF_VARGET, nid, 'umax', umax |
---|
99 | IF vmax_yn NE 0 THEN NCDF_VARGET, nid, 'vmax', vmax |
---|
100 | IF wmax_yn NE 0 THEN NCDF_VARGET, nid, 'wmax', wmax |
---|
101 | IF ustern_yn NE 0 THEN NCDF_VARGET, nid, 'u*', ustern |
---|
102 | IF wstern_yn NE 0 THEN NCDF_VARGET, nid, 'w*', wstern |
---|
103 | |
---|
104 | NCDF_CLOSE, nid |
---|
105 | |
---|
106 | PRINT, 'timeseries data read in' |
---|
107 | PRINT, ' ' |
---|
108 | |
---|
109 | ;======================================================================= |
---|
110 | ; Plotting the data: |
---|
111 | ; ------------------ |
---|
112 | |
---|
113 | SET_PLOT, 'Z' |
---|
114 | DEVICE, Z_BUFFERING = 0, SET_RESOLUTION=[1200,900] |
---|
115 | SET_COLORS=256 |
---|
116 | |
---|
117 | LOADCT, 0 |
---|
118 | TVLCT, R,G,B, /GET |
---|
119 | |
---|
120 | !P.CHARSIZE = 2.3 |
---|
121 | !P.CHARTHICK = 2.3 |
---|
122 | !X.THICK = 3.0 |
---|
123 | !Y.THICK = 3.0 |
---|
124 | !X.TICKLEN = 0.025 |
---|
125 | !Y.TICKLEN = 0.01 |
---|
126 | |
---|
127 | black = 0 |
---|
128 | white = 255 |
---|
129 | !P.BACKGROUND = white |
---|
130 | |
---|
131 | plot_window = [0.12,0.10,0.96,0.99] |
---|
132 | |
---|
133 | ; .ps-preferences, if desired: |
---|
134 | IF ps_yn NE 0 THEN BEGIN |
---|
135 | SET_PLOT, 'PS' |
---|
136 | PRINT, 'Postscript-Format (.ps) selected' |
---|
137 | PRINT, '' |
---|
138 | ;Farbeinstellungen, Format etc.: |
---|
139 | ;DEVICE, /COLOR, BITS = 8, ENCAPSULATED = 1, /ISOLATIN1, /PORTRAIT |
---|
140 | ;DEVICE, FILENAME = plotpath+plotfile+'.eps' |
---|
141 | DEVICE, /COLOR, BITS = 8, ENCAPSULATED = 0, /ISOLATIN1, /LANDSCAPE |
---|
142 | ;DEVICE, SCALE_FACTOR = 1.0, XOFFSET = 1.0, YOFFSET = 1.0 |
---|
143 | !P.CHARSIZE = 1.5 |
---|
144 | !P.CHARTHICK = 1.5 |
---|
145 | ;plot_window = [0.095,0.225,0.97,0.99] |
---|
146 | ENDIF |
---|
147 | |
---|
148 | ; Determining time ranges of the plot (x-axis): |
---|
149 | IF MAX(time) LE 18000.0 THEN BEGIN |
---|
150 | x_min = FLOOR(MIN(time)/1800.0)*1800.0 |
---|
151 | x_max = CEIL(MAX(time)/1800.0)*1800.0 |
---|
152 | x_inter = 1800.0 |
---|
153 | x_minor = 6 |
---|
154 | ENDIF |
---|
155 | IF MAX(time) GT 18000.0 THEN BEGIN |
---|
156 | x_min = FLOOR(MIN(time)/3600.0)*3600.0 |
---|
157 | x_max = CEIL(MAX(time)/3600.0)*3600.0 |
---|
158 | x_inter = 3600.0 |
---|
159 | x_minor = 6 |
---|
160 | ENDIF |
---|
161 | |
---|
162 | IF tke_yn NE 0 THEN BEGIN ; tke |
---|
163 | |
---|
164 | IF ps_yn NE 0 THEN DEVICE, FILENAME = plotfile1+'.ps' |
---|
165 | |
---|
166 | ; Determining y-axis ranges: |
---|
167 | y_min = 0.0 |
---|
168 | IF MAX(tke) LE 1.0 THEN BEGIN |
---|
169 | y_max = CEIL(MAX(tke)/0.1)*0.1 |
---|
170 | y_inter = 0.1 |
---|
171 | y_minor = 2 |
---|
172 | ENDIF |
---|
173 | IF MAX(tke) GT 1.0 THEN BEGIN |
---|
174 | y_max = CEIL(MAX(tke)/0.5)*0.5 |
---|
175 | y_inter = 0.5 |
---|
176 | y_minor = 5 |
---|
177 | ENDIF |
---|
178 | |
---|
179 | ; Plotting: |
---|
180 | PLOT, time, tke, COLOR = black, XRANGE = [x_min,x_max], YRANGE = [y_min,y_max], $ |
---|
181 | XMINOR = x_minor, YMINOR = y_minor, XTITLE = 'time [s]', YTITLE = 'TKE [m!U2!N/s!U2!N]', $ |
---|
182 | XTICKINTERVAL = x_inter, YTICKINTERVAL = y_inter, POSITION = plot_window, $ |
---|
183 | XSTYLE = 1, YSTYLE = 1, LINESTYLE = 0, XTICKFORMAT = '(I5)', YTICKFORMAT = '(F4.1)' |
---|
184 | |
---|
185 | IF png_yn NE 0 THEN BEGIN |
---|
186 | DATA = TVRD() |
---|
187 | WRITE_PNG, plotfile1+'.png', DATA, r, g, b |
---|
188 | PRINT, 'png-image of timeseries of "E" created' |
---|
189 | ;PRINT, ' ' |
---|
190 | ENDIF |
---|
191 | |
---|
192 | DEVICE, /CLOSE |
---|
193 | ENDIF |
---|
194 | |
---|
195 | IF umax_yn NE 0 THEN BEGIN ; umax |
---|
196 | |
---|
197 | IF ps_yn NE 0 THEN DEVICE, FILENAME = plotfile2+'.ps' |
---|
198 | |
---|
199 | ; Determining y-axis ranges: |
---|
200 | IF MAX([MAX(umax),ABS(MIN(umax))]) LE 10.0 THEN BEGIN |
---|
201 | y_max = CEIL(MAX([MAX(umax),ABS(MIN(umax))])/1.0)*1.0 |
---|
202 | ;y_min = -y_max |
---|
203 | y_inter = 1.0 |
---|
204 | y_minor = 2 |
---|
205 | ENDIF |
---|
206 | IF MAX([MAX(umax),ABS(MIN(umax))]) GT 10.0 THEN BEGIN |
---|
207 | y_max = CEIL(MAX([MAX(umax),ABS(MIN(umax))])/2.0)*2.0 |
---|
208 | ;y_min = -y_max |
---|
209 | y_inter = 2.0 |
---|
210 | y_minor = 4 |
---|
211 | ENDIF |
---|
212 | y_min = -y_max |
---|
213 | |
---|
214 | ; Plotting: |
---|
215 | PLOT, time, umax, COLOR = black, XRANGE = [x_min,x_max], YRANGE = [y_min,y_max], $ |
---|
216 | XMINOR = x_minor, YMINOR = y_minor, XTITLE = 'time [s]', YTITLE = 'max. of u-wind [m/s]', $ |
---|
217 | XTICKINTERVAL = x_inter, YTICKINTERVAL = y_inter, POSITION = plot_window, $ |
---|
218 | XSTYLE = 1, YSTYLE = 1, LINESTYLE = 0, XTICKFORMAT = '(I5)', YTICKFORMAT = '(F5.1)' |
---|
219 | |
---|
220 | PLOTS, [x_min,x_max], [0.0,0.0], COLOR = black, LINESTYLE = 2 |
---|
221 | |
---|
222 | IF png_yn NE 0 THEN BEGIN |
---|
223 | DATA = TVRD() |
---|
224 | WRITE_PNG, plotfile2+'.png', DATA, r, g, b |
---|
225 | PRINT, 'png-image of timeseries of "umax" created' |
---|
226 | ;PRINT, ' ' |
---|
227 | ENDIF |
---|
228 | |
---|
229 | DEVICE, /CLOSE |
---|
230 | ENDIF |
---|
231 | |
---|
232 | IF vmax_yn NE 0 THEN BEGIN ; vmax |
---|
233 | |
---|
234 | IF ps_yn NE 0 THEN DEVICE, FILENAME = plotfile3+'.ps' |
---|
235 | |
---|
236 | ; Determining y-axis ranges: |
---|
237 | IF MAX([MAX(vmax),ABS(MIN(vmax))]) LE 10.0 THEN BEGIN |
---|
238 | y_max = CEIL(MAX([MAX(vmax),ABS(MIN(vmax))])/1.0)*1.0 |
---|
239 | ;y_min = -y_max |
---|
240 | y_inter = 1.0 |
---|
241 | y_minor = 2 |
---|
242 | ENDIF |
---|
243 | IF MAX([MAX(vmax),ABS(MIN(vmax))]) GT 10.0 THEN BEGIN |
---|
244 | y_max = CEIL(MAX([MAX(vmax),ABS(MIN(vmax))])/2.0)*2.0 |
---|
245 | ;y_min = -y_max |
---|
246 | y_inter = 2.0 |
---|
247 | y_minor = 4 |
---|
248 | ENDIF |
---|
249 | y_min = -y_max |
---|
250 | |
---|
251 | ; Plotting: |
---|
252 | PLOT, time, vmax, COLOR = black, XRANGE = [x_min,x_max], YRANGE = [y_min,y_max], $ |
---|
253 | XMINOR = x_minor, YMINOR = y_minor, XTITLE = 'time [s]', YTITLE = 'max. of v-wind [m/s]', $ |
---|
254 | XTICKINTERVAL = x_inter, YTICKINTERVAL = y_inter, POSITION = plot_window, $ |
---|
255 | XSTYLE = 1, YSTYLE = 1, LINESTYLE = 0, XTICKFORMAT = '(I5)', YTICKFORMAT = '(F5.1)' |
---|
256 | |
---|
257 | PLOTS, [x_min,x_max], [0.0,0.0], COLOR = black, LINESTYLE = 2 |
---|
258 | |
---|
259 | IF png_yn NE 0 THEN BEGIN |
---|
260 | DATA = TVRD() |
---|
261 | WRITE_PNG, plotfile3+'.png', DATA, r, g, b |
---|
262 | PRINT, 'png-image of timeseries of "vmax" created' |
---|
263 | ;PRINT, ' ' |
---|
264 | ENDIF |
---|
265 | |
---|
266 | DEVICE, /CLOSE |
---|
267 | ENDIF |
---|
268 | |
---|
269 | IF wmax_yn NE 0 THEN BEGIN ; wmax |
---|
270 | |
---|
271 | IF ps_yn NE 0 THEN DEVICE, FILENAME = plotfile4+'.ps' |
---|
272 | |
---|
273 | ; Determining y-axis ranges: |
---|
274 | y_min = FLOOR(MIN(wmax)/1.0)*1.0 |
---|
275 | y_max = CEIL(MAX(wmax)/1.0)*1.0 |
---|
276 | y_inter = 1.0 |
---|
277 | y_minor = 2 |
---|
278 | |
---|
279 | ; Plotting: |
---|
280 | PLOT, time, wmax, COLOR = black, XRANGE = [x_min,x_max], YRANGE = [y_min,y_max], $ |
---|
281 | XMINOR = x_minor, YMINOR = y_minor, XTITLE = 'time [s]', YTITLE = 'max. of w-wind [m/s]', $ |
---|
282 | XTICKINTERVAL = x_inter, YTICKINTERVAL = y_inter, POSITION = plot_window, $ |
---|
283 | XSTYLE = 1, YSTYLE = 1, LINESTYLE = 0, XTICKFORMAT = '(I5)', YTICKFORMAT = '(F5.1)' |
---|
284 | |
---|
285 | PLOTS, [x_min,x_max], [0.0,0.0], COLOR = black, LINESTYLE = 2 |
---|
286 | |
---|
287 | IF png_yn NE 0 THEN BEGIN |
---|
288 | DATA = TVRD() |
---|
289 | WRITE_PNG, plotfile4+'.png', DATA, r, g, b |
---|
290 | PRINT, 'png-image of timeseries of "wmax" created' |
---|
291 | ;PRINT, ' ' |
---|
292 | ENDIF |
---|
293 | |
---|
294 | DEVICE, /CLOSE |
---|
295 | ENDIF |
---|
296 | |
---|
297 | IF ustern_yn NE 0 THEN BEGIN ; u* |
---|
298 | |
---|
299 | IF ps_yn NE 0 THEN DEVICE, FILENAME = plotfile5+'.ps' |
---|
300 | |
---|
301 | ; Determining y-axis ranges: |
---|
302 | y_min = FLOOR(MIN(ustern)/0.1)*0.1 |
---|
303 | y_max = CEIL(MAX(ustern)/0.1)*0.1 |
---|
304 | y_inter = 0.1 |
---|
305 | y_minor = 2 |
---|
306 | |
---|
307 | ; Plotting: |
---|
308 | PLOT, time, ustern, COLOR = black, XRANGE = [x_min,x_max], YRANGE = [y_min,y_max], $ |
---|
309 | XMINOR = x_minor, YMINOR = y_minor, XTITLE = 'time [s]', YTITLE = 'u* [m/s]', $ |
---|
310 | XTICKINTERVAL = x_inter, YTICKINTERVAL = y_inter, POSITION = plot_window, $ |
---|
311 | XSTYLE = 1, YSTYLE = 1, LINESTYLE = 0, XTICKFORMAT = '(I5)', YTICKFORMAT = '(F3.1)' |
---|
312 | |
---|
313 | IF png_yn NE 0 THEN BEGIN |
---|
314 | DATA = TVRD() |
---|
315 | WRITE_PNG, plotfile5+'.png', DATA, r, g, b |
---|
316 | PRINT, 'png-image of timeseries of "u*" created' |
---|
317 | ;PRINT, ' ' |
---|
318 | ENDIF |
---|
319 | |
---|
320 | DEVICE, /CLOSE |
---|
321 | ENDIF |
---|
322 | |
---|
323 | IF wstern_yn NE 0 THEN BEGIN ; w* |
---|
324 | |
---|
325 | IF ps_yn NE 0 THEN DEVICE, FILENAME = plotfile6+'.ps' |
---|
326 | |
---|
327 | ; Determining y-axis ranges: |
---|
328 | y_min = FLOOR(MIN(wstern)/0.5)*0.5 |
---|
329 | y_max = CEIL(MAX(wstern)/0.5)*0.5 |
---|
330 | y_inter = 0.5 |
---|
331 | y_minor = 5 |
---|
332 | |
---|
333 | ; Plotting: |
---|
334 | PLOT, time, wstern, COLOR = black, XRANGE = [x_min,x_max], YRANGE = [y_min,y_max], $ |
---|
335 | XMINOR = x_minor, YMINOR = y_minor, XTITLE = 'time [s]', YTITLE = 'w* [m/s]', $ |
---|
336 | XTICKINTERVAL = x_inter, YTICKINTERVAL = y_inter, POSITION = plot_window, $ |
---|
337 | XSTYLE = 1, YSTYLE = 1, LINESTYLE = 0, XTICKFORMAT = '(I5)', YTICKFORMAT = '(F3.1)' |
---|
338 | |
---|
339 | IF png_yn NE 0 THEN BEGIN |
---|
340 | DATA = TVRD() |
---|
341 | WRITE_PNG, plotfile6+'.png', DATA, r, g, b |
---|
342 | PRINT, 'png-image of timeseries of "w*" created' |
---|
343 | ;PRINT, ' ' |
---|
344 | ENDIF |
---|
345 | |
---|
346 | DEVICE, /CLOSE |
---|
347 | ENDIF |
---|
348 | |
---|
349 | PRINT, ' ' |
---|
350 | PRINT, 'Program finished' |
---|
351 | abort_flag: |
---|
352 | PRINT, ' ' |
---|
353 | |
---|
354 | |
---|
355 | END |
---|