;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;; AnisView, IDL-Version 8.8 ;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;; ;; The sets of routines below are used to establish a GUI application ;; to test the (M)RPV-model in a 1-, 2-, and 3-D environment. The user ;; can specify the geophysical system by choosing the three physical ;; input parameters: amplitude parameter rho, Minnaert parameter k, ;; and asymmetry parameter theta_HG and the three geometrical ;; parameters solar zenith angle, observer zenith angle, and the ;; relative azimuth (degrees). ;; ;; To set up an IDL-executable: ;;============================== ;; 1) compile and run this code ;; 2) resolve_all ;; 3) save,/routines,filename='AnisView.sav', /compress (the .sav file name *must* ;; be the same as the name of the main program) ;; 4) Please note that the compiled .sav file depends on the ;; IDL-version in use and may not work when executed on machines ;; running a different IDL version ;; ;; ;; ;; AUTHORS: ;; Peter Vogt email: Peter.Vogt@ec.europa.eu ;; Michel M. Verstraete email: mmverstraete@gmail.com ;; ;; ;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;; ;; F U N C T I O N T O C A L C U L A T E T H E B R F ;; ;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;***************************************************************************** ;;***************************************************************************** FUNCTION Rahmanbrf ;;***************************************************************************** ;; PURPOSE: calculate BRF as a function of the geometrical and ;; physical parameters ;;***************************************************************************** ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl ;; declare a COMMON block to hold the values of the angular and ;; physical variables obtained from the widgets: COMMON Vars_params, illzen_deg, illzen_rad, obszen_deg, obszen_rad, $ relazi_deg, relazi_rad, rhopar, kpar, thetapar, hspar ;; compute some trigonometric functions. the rpv model may not work ;; correctly at large illumination or observation zenith angles (say ;; larger than 60 degrees). In any case, neither of these angles ;; should be allowed to take on values larger than 80 degrees because ;; this program computes the tangents of these angles. epsilon = 0.0000001 ;; small value to catch inaccuracies sin_illzen = sin (illzen_rad) ;; sine of illumination zenith angle cos_illzen = cos (illzen_rad) ;; cosine of illumination zenith angle tan_illzen = sin_illzen / cos_illzen ;; tangent illumination zenith angle sin_obszen = sin (obszen_rad) ;; sine of observation zenith angle cos_obszen = cos (obszen_rad) ;; cosine of observation zenith angle tan_obszen = sin_obszen / cos_obszen ;; tangent observation zenith angle ci_co = cos_illzen * cos_obszen ;; product of cosines cos_relazi = cos (!pi - Relazi_rad) ;; cosine of relative azimuth ;; (using !pi-phi to comply with backw/forw scatt. convention of ;; O.Engelsen) cosg = ci_co + sin_illzen * sin_obszen * cos_relazi ;; cosine phase angle ;; compute the minnaert fraction fraction: minnaert = (ci_co * (cos_illzen + cos_obszen)) ^ (kpar - 1.0) ;; compute the phase function, using cos(pi-phase)=-cos(phase): IF rpv_sel EQ 1 THEN BEGIN tp2 = thetapar * thetapar denum = 1.0 + 2.0 * thetapar * cosg + tp2 fg = (1.0 - tp2) / (denum ^ 1.5) ENDIF ELSE BEGIN fg = exp( - thetapar * cosg) ENDELSE ;; original version of Engelsen with relazi = 0 for backward ;; scattering was: ;; g = sqrt (tan_illzen * tan_illzen + tan_obszen * tan_obszen $ ;; - 2.0 * tan_illzen * tan_obszen * cos_relazi) ;; now changed to relazi=180 for backward scattering g = sqrt (tan_illzen * tan_illzen + tan_obszen * tan_obszen $ - 2.0 * tan_illzen * tan_obszen * cos(!pi - Relazi_rad)) IF hs_sel EQ 0b THEN hspar = rhopar k3 = 1.0 + (1.0 - hspar) / (1.0 + g) ;; compute the bidirectionnal reflectance factor brf = rhopar * minnaert * fg * k3 return, brf END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** PRO Gauss_quad, x1, x2, n, xx, ww ;;***************************************************************************** ; PURPOSE: derive the quadrature points and weights to evaluate the ; integral in [x1,x2] ;;***************************************************************************** ; input: ; x1 - start of integral ; x2 - end of integral ; n - number of quadrature points ; ; output: ; xx - quadrature point positions ; ww - weights ; eps = 3.d-14 & x = dblarr(n + 1) & w = x m = (n + 1) / 2 & xm = 0.5d0 * (x2 + x1) & xl = 0.5d0 * (x2 - x1) FOR i = 1, m DO BEGIN z = cos(3.141592654d0 * (i - .25d0) / (n + .5d0)) jump: p1 = 1.d0 & p2 = 0.d0 FOR j = 1, n DO BEGIN p3 = p2 p2 = p1 p1 = ((2.d0 * j - 1.d0) * z * p2 - (j - 1.d0) * p3) / j ENDFOR pp = n * (z * p1 - p2) / (z * z - 1.d0) z1 = z z = z1 - p1 / pp IF (abs(z - z1) GT eps) THEN GOTO, jump x(i) = xm - xl * z x(n + 1 - i) = xm + xl * z w(i) = 2.d0 * xl / ((1.d0 - z * z) * pp * pp) w(n + 1 - i) = w(i) ENDFOR xx = dblarr(n) & xx( * ) = x(1: * ) ww = dblarr(n) & ww( * ) = w(1: * ) return END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** PRO Statistics ;;***************************************************************************** ;; PURPOSE: calculate statistics of BRF field: ;; BRF_min, BRF_min_th, BRF_min_phi, BRF_max, BRF_max_th, BRF_max_phi, ;; BRF_nad, BRF_hot, alb ;;***************************************************************************** ;; declare a COMMON block to hold the values of the angular and ;; physical variables obtained from the widgets: COMMON Vars_params, illzen_deg, illzen_rad, obszen_deg, obszen_rad, $ relazi_deg, relazi_rad, rhopar, kpar, thetapar, hspar COMMON Stats, BRF_min, BRF_min_th, BRF_min_phi, $ BRF_max, BRF_max_th, BRF_max_phi, BRF_nad, BRF_hot, alb epsilon = 0.0000001 ;; check for special cases which do not require all calculations ;; and need special values for geometrical locations ;; Lambert/isotropic case: IF abs(kpar - 1.0) LT epsilon AND abs(thetapar) LT epsilon AND $ hspar GT (1.0 - epsilon) THEN BEGIN BRF_min_th = 'arbitrary' & BRF_min_phi = BRF_min_th BRF_max_th = BRF_min_th & BRF_max_phi = BRF_min_th BRF_min = strtrim(rhopar, 2) & BRF_max = BRF_min BRF_nad = BRF_min & BRF_hot = BRF_min & alb = BRF_min & GOTO, fin ENDIF IF (rhopar LT epsilon) THEN BEGIN BRF_min_th = 'arbitrary' & BRF_min_phi = BRF_min_th BRF_max_th = BRF_min_th & BRF_max_phi = BRF_min_th BRF_min = strtrim(rahmanbrf(), 2) & BRF_max = BRF_min BRF_nad = BRF_min & BRF_hot = BRF_min & alb = BRF_min & GOTO, fin ENDIF ;; the following variables of the main window will be changed in this ;; procedure. They will be stored to temporary variables and restored ;; to their initial value at the end of this procedure obszen_rad_set = obszen_rad relazi_rad_set = relazi_rad ;; calculation albedo ;;---------------------------- ;; get Gauss-quadratur points & weights for number=64 to calculate albedo number = 64 call_procedure, 'gauss_quad', - 1.0, 1.0, number, points, weights ;; BRF for all points of the Gauss quadrature xm = 0.5 * (1. - 1.) xr = 0.5 * (1. + 1.) ym = 0.5 * (2. * !pi - 0.) yr = 0.5 * (2. * !pi + 0.) sum_y = 0.0 FOR i = 0, number - 1 DO BEGIN ;; full azimuthal loop y = ym + yr * points[i] relazi_rad = y sum_x = 0. FOR j = number / 2, number - 1 DO BEGIN ;; HALF zenithal loop x = xm + xr * points[j] obszen_rad = acos(x) brf = rahmanbrf() sum_x = sum_x + brf * weights[j] * abs(x) * xr ENDFOR sum_y = sum_y + sum_x * weights(i) * yr ENDFOR alb = float(sum_y / !pi) ;; Calculate BRF_min and BRF_max (re-calculate the BRF field for ;; the pre-defined range of obszen_deg (+/- 80 degrees) ;;----------------------------------------------------------------------------- ;; declare the arrays for the observation zenith angles and the BRFS: obs_deg = indgen (161) - 80 & obs_rad = obs_deg * !dtor Rel_deg = indgen (181) & rel_rad = rel_deg * !dtor Brf = fltarr (161, 181) ;; compute the BRDF values for the selected solar zenith angle: FOR i = 0, 160 DO BEGIN obszen_rad = obs_rad [i] FOR j = 0, 180, 1 DO BEGIN relazi_rad = rel_rad [j] brf [i, j] = rahmanbrf () ENDFOR ENDFOR brf = polar_surface(brf, obs_deg, rel_deg * !dtor, / Grid, $ spacing = [1.0, 1.0]) ;; get size and define axis array s = size(brf) & th = (findgen(s(1)) / (s(1) - 1) * 2.0 - 1.0) * 80.0 ;; get max/min and positions in rectangular coordinates BRF_max = max(brf, idx_max) BRF_min = min((brf LT epsilon) * 1000.0 + brf, idx_min) ;; get coordinates BRF_max(theta,phi), BRF_min(theta,phi) ix = idx_max MOD s(1) & iy = idx_max / s(1) & rect = [th(ix), th(iy)] pos_max = cv_coord(from_rect = rect, / to_polar, / degrees) ix = idx_min MOD s(1) & iy = idx_min / s(1) & rect = [th(ix), th(iy)] pos_min = cv_coord(from_rect = rect, / to_polar, / degrees) IF pos_min(0) LT 0.0 THEN BEGIN IF pos_min(0) GT - 90.0 THEN pos_min(0) = 0.0 ELSE pos_min(0) = 180.0 ENDIF IF pos_max(0) LT 0.0 THEN BEGIN IF pos_max(0) GT - 90.0 THEN pos_max(0) = 0.0 ELSE pos_max(0) = 180.0 ENDIF BRF_min_th = pos_min(1) & BRF_min_phi = pos_min(0) BRF_max_th = pos_max(1) & BRF_max_phi = pos_max(0) IF illzen_deg LT epsilon THEN BEGIN ; set relazi to arbitrary BRF_min_phi = 'arbitrary' & BRF_max_phi = BRF_min_phi ENDIF ;; calculate BRF_nad ;;------------------------------------ obszen_rad = 0.0 BRF_nad = rahmanbrf() ;; calculate BRF_hot ;;------------------------------------ obszen_rad = illzen_rad & relazi_rad = !pi Brf_hot = rahmanbrf() ;; re-setting the COMMON variables to their values originally ;; assigned by the main program obszen_rad = obszen_rad_set relazi_rad = relazi_rad_set fin: END ;;***************************************************************************** ;;***************************************************************************** ;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;; ;; P R O C E D U R E S T O D I S P L A Y T H E B R F F I E L D ;; ;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;***************************************************************************** ;;***************************************************************************** PRO Pcs, x1, y1, range, inc, ysize = ysize, charsize = charsize, $ scbr = scbr, frmt = frmt, color = coll ;;***************************************************************************** ;; PURPOSE: set up the color scale for the box legend in tvim.pro ;;***************************************************************************** ;; ROUTINE: put_color_scale - scbr=scale width and frmt=format of scale ;; ;; ;; USEAGE: PCS,x1,y1,range[,inc,ysize=ysize,charsize=charsize, ;; scbr=scbr,frmt=frmt] ;; ;; PURPOSE: Draws a numbered color scale ;; ;; INPUT: ;; ;; x1,y1 device coordinates of lower left hand corner of color bar ;; ;; range array which contains full range of physical values, ;; The number scale limits are computed fron min(range) and ;; max(range) ;; ;; scbr multiplication factor of color scale width ;; ;; inc increment step of the number scale in physical units ;; ;; OPTIONAL KEYWORD INPUT: ;; ;; charsize character size on number scale ;; coll character color on number scale ;; ysize vertical size of color bar in device units. ;; ;; AUTHOR: Paul Ricchiazzi oct92 ;; Earth Space Research Group, UCSB ;; COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl dev = strupcase(!d.Name) IF dev EQ 'X' OR dev EQ 'WIN' OR dev EQ 'MAC' THEN max_color = 254 ELSE $ max_color = !d.N_colors - 1 epsilon = 0.0000001 IF keyword_set(charsize) EQ 0 THEN charsize = 1 IF keyword_set(ysize) EQ 0 THEN ysize = max_color ;IF keyword_set(frmt) EQ 0 THEN frmt = '(f10.6)' amin = min(range) & amax = max(range) s0 = float(amin) & s1 = float(amax) ;IF inc eq 0.0 THEN BEGIN ; isotropic <=> amax=amin ; frmt = '(f8.6)' & GOTO, skip ;ENDIF IF inc EQ 0.0 THEN BEGIN so = 0.0 & s1 = 0.0 ENDIF ELSE BEGIN s0 = fix(s0 / inc) * inc & s1 = fix(s1 / inc) * inc ENDELSE IF s0 LT amin THEN s0 = s0 + inc IF s1 GT amax THEN s1 = s1 - inc ;; IF keyword_set(frmt) EQ 0 THEN frmt='(e9.2)' ;nzs = fix(alog10(inc * 1.01)) ;IF nzs LT 0 AND nzs GT - 4 THEN $ ; frmt = '(f8.' + string(form = '(i1)', - nzs + 1) + ')' ;IF nzs ge 0 AND nzs le 3 THEN frmt = '(f8.1)' ;mg=6 skip: smax = string(amax, form = frmt) smax = strcompress(smax, / remove_all) smin = string(amin, form = frmt) smin = strcompress(smin, / remove_all) lablen = strlen(smax) > strlen(smin) iso = abs(amax - amin) LT epsilon * 10.0 IF dev EQ 'X' or dev EQ 'WIN' or dev EQ 'MAC' THEN BEGIN IF keyword_set(scbr) EQ 0 THEN scbr = 1. dx = 20 * scbr ; width of color bar x2 = x1 + dx x3 = x2 + 2 mg = 6 ; black out margin dy = ysize ; height of color bar y2 = y1 + dy q = bytscl(replicate(1, dx) # indgen(y2 - y1), $ top = max_color) IF iso then q = q*0b+127b tv, q, x1, y1, / device ENDIF ELSE BEGIN xs = !d.X_vsize / 700. ; about 100 pixels per inch on screen ys = !d.Y_vsize / 700. dx = 20 * xs * scbr ; width of color bar x2 = x1 + dx x3 = x2 + 2 * xs mg = 6 * xs ; black out margin dy = ysize ; height of color bar y2 = y1 + dy q = bytscl(replicate(1, 2) # indgen(y2 - y1), top = max_color) IF iso then q = q*0b+127b tv, q, x1, y1, xsize = dx, ysize = dy ENDELSE boxx = [x1, x2, x2, x1, x1] boxy = [y1, y1, y2, y2, y1] plots, boxx, boxy, / device, color = coll ;lines around the scale-box IF iso THEN BEGIN ; Lambert <=> amax=amin xyouts, x3, y1, smin, / device, charsize = charsize, color = coll xyouts, x3, y2, smax, / device, charsize = charsize, color = coll GOTO, fin ENDIF denom = amax - amin IF inc GT 0.0 THEN BEGIN nval = fix((s1 - s0) / inc + .1) ENDIF ELSE BEGIN plots, [x1, x2], [y2, y2], / device, color = coll plots, [x1, x2], [y1, y1], / device, color = coll xyouts, x3, y1, smin, / device, charsize = charsize, color = coll xyouts, x3, y2, smax, / device, charsize = charsize, color = coll GOTO, fin ENDELSE FOR ival = 0, nval DO BEGIN val = s0 + inc * float(ival) ss = (val - amin) / denom IF ss ge 0 AND ss LE 1 THEN BEGIN yval = y1 + (y2 - y1) * ss sval = string(val, form = frmt) sval = strcompress(sval, / remove_all) ;;lines in the scale-box plots, [x1, x2], [yval, yval], / device, color = coll ;;scale-box char. xyouts, x3, yval, sval, / device, charsize = charsize, color = coll ENDIF ELSE BEGIN plots, [x1, x2], [y2, y2], / device, color = coll plots, [x1, x2], [y1, y1], / device, color = coll xyouts, x3, y1, smin, / device, charsize = charsize, color = coll xyouts, x3, y2, smax, / device, charsize = charsize, color = coll GOTO,fin ENDELSE ENDFOR fin: END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** PRO Tvim, a, scale = scale, range = range, xrange = xrange, $ yrange = yrange, xoffset = xoffset, yoffset = yoffset, $ aspect = aspect, ticks = ticks, xticks = xticks, $ xtickname = xtickname, yticks = yticks, ytickname = ytickname, $ title = title, xtitle = xtitle, ytitle = ytitle, $ outside = outside, noframe = noframe, scbr = scbr, $ frmt = frmt, scchar = scchar, color = coll, $ background = background, charsize = charsize, $ multx = multx, multy = multy ;;***************************************************************************** ;; PURPOSE: display 3-D array in a contour diagram ;;***************************************************************************** ;; ROUTINE tvim - scbr=scale width and frmt=format of scale, ;; charsize,color ;; ;; USEAGE: tvim,a ;; ;; tvim,a,title=title,xtitle=xtitle,ytitle=ytitle,$ ;; xrange=xrange,yrange=yrange,$ ;; scale=scale,range=range,$ ;; noframe=noframe,$ ;; aspect,scbr=scbr,scchar=scchar,$ ;; color=color,charsize=charsize ;; ;; PURPOSE: Display an image with provisions for ;; ;; 1. numbered color scale ;; 2. plot title ;; 3. annotated x and y axis ;; 4. simplified OPLOT capability ;; ;; INPUT a image quantity ;; ;; Optional keyword input: ;; ;; title plot title ;; ;; xtitle x axis title ;; ;; ytitle y axis title ;; ;; xrange array spanning entire x axis range. NOTE: TVIM ;; only uses min(XRANGE) and max(XRANGE). ;; ;; yrange array spanning entire y axis range. NOTE: TVIM ;; only uses min(YRANGE) and max(YRANGE). ;; ;; scale IF set draw color scale. SCALE=2 causes steped ;; color scale ;; ;; range two or three element vector indicating physical ;; range over which to map the color scale. The ;; third element of RANGE, IF specified, sets the ;; step interval of the displayed color scale. It ;; has no effect when SCALE is not set. E.g., ;; RANGE=[0., 1., 0.1] will cause the entire color ;; scale to be mapped between the physical values ;; of zero and one; the step size of the displayed ;; color scale will be set to 0.1. ;; ;; aspect the x over y aspect ratio of the output image ;; IF not set aspect is set to (size_x/size_y) of ;; the input image. ;; ;; x-, yoffset move the image away from the lower left corner ;; noframe IF set do not draw axis box around image ;; ;; scbr factor to multiply width of color scale in (PCS) ;; ;; frmt format (string!) for color scale default: 'e9.2' ;; ;; scchar Charsize of annotations along scale ;; ;; charsize Charsize of x/y-axis annotation ;; ;; ;; SIDE EFFECTS: Setting SCALE=2 changes the color scale using ;; the STEP_CT procedure. The color scale may ;; be returned to its original state by the ;; command, STEP_CT,/OFF PROCEDURE ;; TVIM first determins the size of the plot ;; data window with a dummy call to PLOT. ;; When the output device is "X", CONGRID is ;; used to scale the image to the size of the ;; available data window. Otherwise, IF the output ;; device is Postscript, scaleable pixels are used ;; in the call to TV. PCS draws the color scale and ;; PLOT draws the x and y axis and titles. ;; ;; DEPENDENCIES: PCS, STEP_CT ;; ;; AUTHOR: Paul Ricchiazzi Oct92, Peter Vogt 98/99 ;; Earth Space Research Group, UCSB ;; COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl epsilon = 0.0000001 sz = size(a) nx = sz(1) ny = sz(2) nxm = nx - 1 nym = ny - 1 plot, [0, 1], [0, 1], / nodata, xstyle = 4, ystyle = 4, $ background = background px = !x.Window * !d.X_vsize py = !y.Window * !d.Y_vsize xsize = px(1) - px(0) ysize = py(1) - py(0) IF keyword_set(scale) THEN $ xsize = xsize - (50 - (1. - scbr) * 20) * !d.X_vsize / 700. ;; resize image asp = float(nx) / ny IF xsize GT ysize * asp THEN xsize = ysize * asp ELSE ysize = xsize / asp IF keyword_set(aspect) THEN BEGIN xsize = xsize * aspect & ysize = ysize * aspect ENDIF IF keyword_set(multx) EQ 0 THEN multx = 1.0 ELSE multx = multx IF keyword_set(multy) EQ 0 THEN multy = 1.0 ELSE multy = multy px(1) = px(0) + xsize * multx py(1) = py(0) + ysize * multy max_color = !d.N_colors - 1 IF keyword_set(title) EQ 0 THEN title = '' amax = float(max(a)) & amin = float(min(a)) IF keyword_set(range) EQ 0 THEN range = [amin, amax] ;; calculate values in color scale annotation bar IF keyword_set(scale) THEN BEGIN s0 = float(range(0)) & s1 = float(range(1)) IF n_elements(range) EQ 3 THEN BEGIN s2 = range(2) range = range(0:1) ENDIF ELSE BEGIN IF s1 - s0 LT 0.000001 THEN BEGIN ; Lambert case <=> amin=amax s2 = 0.0 & GOTO, skip ENDIF rng = alog10(s1 - s0) IF rng LT 0. THEN pt = fix(alog10(s1 - s0) - .5) ELSE $ pt = fix(alog10(s1 - s0) + .5) s2 = 10.^pt tst = [.05, .1, .2, .5, 1., 2., 5., 10] ii = where((s1 - s0) / (s2 * tst) le 16) s2 = s2 * tst(ii(0)) ENDELSE skip: IF keyword_set(xoffset) THEN BEGIN px(0) = xoffset * px(0) & px(1) = px(0) + xsize ENDIF IF keyword_set(yoffset) THEN BEGIN py(0) = yoffset * py(0) & py(1) = py(0) + ysize ENDIF xs = px(1) + 9 * !d.X_vsize / 700. ys = py(0) ysize = py(1) - py(0) ;; IF scale EQ 2 THEN step_ct,[s0,s1],s2 ENDIF ;enum=range(1)-range(0) ;f abs(denum) LT 1.0e-6 THEN aa=float(a) $ ; Lambert conditions ;lse aa=(max_color-1)*((float(a)-range(0))/denum > 0. < 1.) ; scale field in color array and set background to white ;rr=bytscl(aa,top=254) IF abs(amin - amax) LT epsilon * 10 THEN $ arr = byte(a * 0.0 + 127) ELSE arr = bytscl(a, top = 254) ;q = size(outside) & IF q(0) GT 0 THEN arr(outside) = 255b ;; apply filter for region outside the circular data array arr = outside * 255b + (outside EQ 0b) * arr arr(0, * ) = 0b & arr(160, * ) = 0b ; black frame around rectangular arr( * , 0) = 0b & arr( * , 160) = 0b ; display area dev = strupcase(!d.Name) IF dev EQ 'X' OR dev EQ 'WIN' OR dev EQ 'MAC' THEN BEGIN ; on screen disp. tv, congrid(arr, xsize, ysize), px(0), py(0) pos = [px(0), py(0), px(1), py(1)] ENDIF ELSE BEGIN ; ps-format pos = [px(0), py(0), px(1), py(1)] tv, arr, px(0), py(0), xsize = xsize, ysize = ysize, / device ENDELSE IF (keyword_set(scbr) EQ 0) THEN scbr = 1. IF (keyword_set(frmt) EQ 0) THEN frmt = '(f10.6)' IF keyword_set(scchar) THEN scchar = scchar IF keyword_set(color) THEN color = coll IF keyword_set(scale) THEN call_procedure, 'pcs', xs, ys, range, s2, $ ysize = ysize, scbr = scbr, charsize = scchar, frmt = frmt, color = coll IF (keyword_set(xtitle) EQ 0) THEN xtitle = '' IF (keyword_set(ytitle) EQ 0) THEN ytitle = '' IF (keyword_set(xrange) EQ 0) THEN $ xrng = [0, nxm] ELSE xrng = [min(xrange), max(xrange)] IF (keyword_set(yrange) EQ 0) THEN $ yrng = [0, nym] ELSE yrng = [min(yrange), max(yrange)] IF keyword_set(noframe) THEN BEGIN plot, [0, 0], [0, 0], xstyle = 5, ystyle = 5, title = title, $ xtitle = xtitle, ytitle = ytitle, charsize = charsize, $ xrange = xrng, yrange = yrng, position = pos, / noerase, / device, $ / nodata, color = coll, background = background ENDIF ELSE BEGIN IF keyword_set(ticks) THEN BEGIN plot, [0, 0], [0, 0], xstyle = 1, ystyle = 1, title = title, $ xtitle = xtitle, ytitle = ytitle, charsize = charsize, $ xticks = xticks, xtickname = xtickname, yticks = yticks, $ ytickname = ytickname, xrange = xrng, yrange = yrng, $ position = pos, / noerase, / device, $ / nodata, color = coll, background = background ENDIF ELSE BEGIN plot, [0, 0], [0, 0], xstyle = 1, ystyle = 1, title = title, $ xtitle = xtitle, ytitle = ytitle, charsize = charsize, $ xrange = xrng, yrange = yrng, position = pos, / noerase, $ / device, / nodata, color = coll, background = background ENDELSE ENDELSE pxim = px & pyim = py END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** PRO Show_0 ;;***************************************************************************** ;; PURPOSE: display the selected geometric constellation ;;***************************************************************************** ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl ;; declare a COMMON block to hold the values of the angular and ;; physical variables obtained from the widgets: COMMON Vars_params, illzen_deg, illzen_rad, obszen_deg, obszen_rad, $ relazi_deg, relazi_rad, rhopar, kpar, thetapar, hspar ;; declare a COMMON block to hold the output data derived from the routine COMMON Output, obs_deg, rel_deg, brf, image, acroread_exe, AnisView_dir ;; temporarily assign current color table to 39 to ensure readable display tvlct, r_curr, g_curr, b_curr, / get & loadct,39 widget_control, w_rdpx, set_value = '' IF bw_sel EQ 0 THEN BEGIN col_sol = 200 & col_azi = 254 & col_obs = 70 ENDIF ELSE BEGIN col_sol = 0 & col_azi = 0 & col_obs = 0 ENDELSE ;; define circle, fake array, axis size and annotation xcirc = cos(findgen(361) * !pi * 2 / 360) ycirc = sin(findgen(361) * 2 * !pi / 360) arr = findgen(19, 19) / 360.0 x = 1. - 2 * findgen(19) / 18 & x = rotate(x, 2) & y = x xtm = ['90', '60', '30', '0', '-30', '-60', '-90'] ext = 1.5 & chs = 1.7 & cf = 8.0 / 6.0 ;; display geometric coordinate system in black color surface, arr, / nodata, / save, x, y, zaxis = - 1, ax = 45, az = 45, $ charsize = chs, yticks = 6, yminor = 3, ytickname = xtm, xticks = 6, $ xminor = 3, xtickname = xtm, col = 0, background = 255 xtitle = 'X = !7h !9*!3 sin(!7u!3) [!9%!3]' ytitle = 'Y = !7h !9*!3 cos(!7u!3) [!9%!3]' xyouts, / T3D, - 2.6, 0.0, alignment = 0.5, ytitle, $ charsize = 1.2 * chs, col = 0, orientation = - 90 ;; ytitle xyouts, / T3D, 0.0, - 2.2, alignment = 0.5, xtitle, $ charsize = 1.2 * chs, col = 0, orientation = 0 ;; xtitle axis, 2.0, 1.5, xaxis = 1, / T3D, xticks = 6, xminor = 3, $ xtickname = xtm, charsize = chs, col = 0 ;; add. x-axis axis, 1.5, 1.5, yaxis = 1, / T3D, yticks = 6, yminor = 3, $ ytickname = xtm, charsize = chs, col = 0 ;; add y-axis oplot, / T3D, xcirc * ext, ycirc * ext, col = 0, / noclip ;; outer circle at theta_obs=90 degrees ;; local normal plots, [0, 0], [0, 0], [0, 1.2], / T3D, col = 0, thick = 2 polyfill, [ - 0.05, 0.05, 0], [0.05, - 0.05, 0], [1.17, 1.17, 1.23], $ / T3D, / data, col = 0 ;; arrow-head ;; solar position at: illzen_deg, azimuth=180 degrees in yellow color zsol = cos(illzen_deg * !dtor) & Pl = [180, illzen_deg] ; solar position res = cv_coord(from_polar = pl, / to_rect, / degrees) xsol = - res(1) / 90 * ext & ysol = - res(0) / 90 * ext ;; illumination vector plots, [xsol, 0], [ysol, 0], [zsol, 0], / T3D, col = col_sol, thick = 2 h1 = ysol * 0.1 & h2 = zsol * 0.1 ; coordinates for arrow head polyfill, [ - 0.1, 0.1, 0], [h1, h1, 0], [h2, h2, 0.0], / T3D, / data, $ / noclip, col = col_sol ;; Define a circle with 16 points and set the filled flag to define ;; the solar symbol q = findgen(17) * (!pi * 2 / 16.) & usersym, cos(q), sin(q), / fill plots, [xsol, xsol], [ysol, ysol], [zsol, zsol], / T3D, psym = 8, $ symsize = 2, col = col_sol plots, [xsol, xsol], [ysol, ysol], [zsol, zsol], / T3D, psym = 2, $ symsize = 3.5, thick = 2, col = col_sol plots, [xsol, xsol], [ysol, ysol], [0, zsol], / T3D, col = col_sol, $ thick = 2 ; illumination vector ground projection ;; annotations: xyouts, / normal, 0.02, 0.95, 'Sketch of the geometric settings:', $ col = 0, charsize = 0.65 * chs, charthick = 1.5 plots, [0.6, 0.6], [0.96, 0.96], / normal, psym = 8, symsize = 1.5, $ col = 0 xyouts, / normal, 0.63, 0.95, 'Local normal', col = 0, $] charsize = 0.65 * chs, charthick = 1.5 plots, [0.6, 0.6], [0.90, 0.90], / normal, psym = 8, symsize = 1.5, $ col = col_sol xyouts, / normal, 0.63, 0.89, 'Illumination (!7h!3!I0!N)', col = col_sol, $ charsize = 0.65 * chs, charthick = 1.5 plots, [0.6, 0.6], [0.84, 0.84], / normal, psym = 8, symsize = 1.5, $ col = col_obs xyouts, / normal, 0.63, 0.83, 'Observation (!7h!3)', col = col_obs, $ charsize = 0.65 * chs, charthick = 1.5 plots, [0.6, 0.6], [0.78, 0.78], / normal, psym = 8, symsize = 1.5, $ col = col_azi xyouts, / normal, 0.63, 0.77, 'Relative azimuth (!7u!3)', col = col_azi, $ charsize = 0.65 * chs, charthick = 1.5 xyouts, / normal, 0.02, 0.90, $ 'PP: Principal plane:= !7h!3 !9e!3 !7u!3=[0!9%!3, 180!9%!3]', $ col = col_azi, charsize = 0.55 * chs, charthick = 1.5 xyouts, / normal, 0.02, 0.86, $ 'CP: Cross plane:= !7h!3 !9e!3 !7u!3=[90!9%!3, 270!9%!3]', col = col_azi, $ charsize = 0.55 * chs, charthick = 1.5 ;; azimuthal settings in red color ; relazi-plane 180 plots, [0, 0], [ - 1.5, 1.5], [0, 0], / T3D, lin = 0, col = col_azi polyfill, [ - 0.1, 0.1, 0], [1.4, 1.4, 1.5], [0, 0, 0], / T3D, $ / data, col = col_azi ; arrow-head at phi=180 polyfill, [ - 0.1, 0.1, 0], [ - 1.4, - 1.4, - 1.5], [0, 0, 0], / T3D,$ / data, col = col_azi ; arrow-head at phi=0 plots, [ - 1.5, 1.5], [0, 0], [0, 0], / T3D, lin = 0, $ col = col_azi ; relazi-plane 270 polyfill, [ - 1.4, - 1.4, - 1.5], [0.1, - 0.1, 0], [0, 0, 0], / T3D, $ / data, col = col_azi ; arrow-head at phi=90 polyfill, [1.4, 1.4, 1.5], [0.1, - 0.1, 0], [0, 0, 0], / T3D, $ / data, col = col_azi ; arrow-head at phi=270 xyouts, / T3D, 0.05, - 0.5, '!7u!3=0!9%!3 (PP)', col = col_azi, $ charsize = 0.8 * chs, orientation = - 90 xyouts, / T3D, - 1.3, 0.05, '!7u!3=90!9%!3 (CP)', col = col_azi, $ charsize = 0.8 * chs, orientation = - 2 xyouts, / T3D, 0.05, 1.3, '!7u!3=180!9%!3 (PP)', col = col_azi, $ charsize = 0.8 * chs, orientation = - 90 xyouts, / T3D, 0.2, 0.05, '!7u!3=270!9%!3 (CP)', col = col_azi, $ charsize = 0.8 * chs, orientation = - 1 xyouts, / T3D, 3.1, 0.0, 'Direction of', alignment = 0.5, $ charsize = 1.2 * chs, col = col_azi, orientation = - 90, charthick = 1.5 xyouts, / T3D, 2.7, 0.0, 'the scattered light:', alignment = 0.5, $ charsize = 1.2 * chs, col = col_azi, orientation = - 90, charthick = 1.5 xyouts, / T3D, 2.3, 0.0, '!94!3 backward forward !96!3', $ alignment = 0.5, charsize = 1.2 * chs, col = col_azi, $ orientation = - 90, charthick = 1.5 ;; observer position at: obszen_deg, azimuth=relazi_deg in blue color zobs = cos(obszen_deg * !dtor) & Pl = [relazi_deg, obszen_deg] res = cv_coord(from_polar = pl, / to_rect, / degrees) xobs = - res(1) / 90 * ext & yobs = - res(0) / 90 * ext plots, [0, xobs], [0, yobs], [0, zobs], / T3D, col = col_obs, $ thick = 2 ; observation vector plots, [xobs, xobs], [yobs, yobs], [0, zobs], / T3D, col = col_obs, $ thick = 2 ; observation vector ground projection ;; Define a satellite symbol and set the filled flag y = [4, 3.5, 3, 3, 3.5, 4, 1, 1.5, 2, 2, 1.5, 1, 4] - 2.5 x = [0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0, 0] - 2.5 & usersym, x, y, / fill plots, [xobs, xobs], [yobs, yobs], [zobs, zobs], / T3D, psym = 8, $ symsize = 2, col = col_obs ;; 3 points for the observer zenith arrow head (blue) xobsa = 0.75 * xobs & yobsa = 0.75 * yobs & zobsa = 0.75 * zobs zobsb = 0.6 * zobs & pl = [relazi_deg - 8.0, obszen_deg] res = cv_coord(from_polar = pl, / to_rect, / degrees) xobsb = - res(1) / 90 * ext * 0.6 & yobsb = - res(0) / 90 * ext * 0.6 zobsc = 0.6 * zobs & pl = [relazi_deg + 8.0, obszen_deg] res = cv_coord(from_polar = pl, / to_rect, / degrees) xobsc = - res(1) / 90 * ext * 0.6 & yobsc = - res(0) / 90 * ext * 0.6 polyfill, [xobsa, xobsb, xobsc], [yobsa, yobsb, yobsc], $ [zobsa, zobsb, zobsc], / T3D, / data, col = col_obs ;; y-start point for observer phi-arc at x=0 in ground area for ;; indicator of phi-direction pl = [0, obszen_deg] res = cv_coord(from_polar = pl, / to_rect, $ / degrees) & yobs0 = res(0) / 90 * ext oplot, / T3D, xcirc(90:90 + relazi_deg) * yobs0, $ - ycirc(90:90 + relazi_deg) * yobs0, col = col_azi, thick = 2 ; arc ;; 3 points for the relative azimuth arrow head (red); one at the ;; ground projection: xobs,yobs pl = [relazi_deg - 5, obszen_deg + 5] res = cv_coord(from_polar = pl, / to_rect, / degrees) xobsb = - res(1) / 90 * ext & yobsb = res(0) / 90 * ext pl = [relazi_deg - 5, obszen_deg - 5] res = cv_coord(from_polar = pl, / to_rect, / degrees) xobsc = - res(1) / 90 * ext & yobsc = res(0) / 90 * ext polyfill, [xobsb, xobsc, xobs], [ - yobsb, - yobsc, yobs], $ [0, 0, 0], / T3D, / data, col = col_azi ;; return current color table tvlct, r_curr, g_curr, b_curr END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** PRO Show_1 ;;***************************************************************************** ;; PURPOSE: display the calculate single BRF value ;;***************************************************************************** ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl ;; declare a COMMON block to hold the output data derived from the routine COMMON Output, obs_deg, rel_deg, brf, image, acroread_exe, AnisView_dir ;; temporarily assign current color table to 39 to ensure readable display tvlct, r_curr, g_curr, b_curr, / get & loadct,39 widget_control, w_rdpx, set_value = '' ;; output the single BRF as a function of solar & observer zenith and ;; relative azimuth angle: plot, [0, 1], [0, 1], / nodata, xstyle = 4, ystyle = 4, background = 255 xyouts, 0.5, 0.5, 'BRF = ' + strtrim(brf, 2), / normal, alignment = 0.5, $ charsize = 2, color = 0, charthick = 2 ;; return current color table tvlct, r_curr, g_curr, b_curr END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** PRO Show_2_PLANE ;;***************************************************************************** ;; PURPOSE: display the BRFs as a function of all observation angles ;; for variable solar zenith and relative azimuth angle ;;***************************************************************************** ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl ;; declare a COMMON block to hold the values of the angular and ;; physical variables obtained from the widgets: COMMON Vars_params, illzen_deg, illzen_rad, obszen_deg, obszen_rad, $ relazi_deg, relazi_rad, rhopar, kpar, thetapar, hspar ;; declare a COMMON block to hold the output data derived from the routine COMMON Output, obs_deg, rel_deg, brf, image, acroread_exe, AnisView_dir ;; temporarily assign current color table to 39 to ensure readable display tvlct, r_curr, g_curr, b_curr, / get & loadct,39 widget_control, w_rdpx, set_value = '' ;; set title to appear in 2-D plot p1 = strtrim(fix(relazi_deg), 2) + '!9%!3' p2 = strtrim(fix(relazi_deg) + 180, 2) + '!9%!3' tit = 'BRFs along the relative azimuth !7u!3: ' + p1 + ' !96!3 ' + p2 xt1 = ['90', '60', '30', '0', '-30', '-60', '-90'] xt2 = ['80', '40', '0', '-40', '-80'] xt3 = ['-80', '-40', '0', '40', '80'] ;; color settings for the display backgr = 255 & col_frame = 0 & col_plot = 254 & col_sol = 200 col_sens = 70 & chs = 1.2 & chs2 = chs ;; change color settings to bw when printing to PS-device IF bw_sel EQ 1 THEN BEGIN col_plot = 0 & col_sol = 0 & col_sens = 0 ENDIF ;; draw the frame in black color with the appropriate azimuthal ;; directions and indicate the solar position and bw/fw-scattering ;; direction y0 = 0.9 * min(brf) & y1 = 1.1 * max(brf) IF (y0 EQ y1 AND y0 EQ 0.0) THEN yr = [ - 0.1, 0.1] ELSE yr = [y0, y1] ;; Define a circle with 16 points and set the filled flag to define ;; the solar symbol q = findgen(17) * (!pi * 2 / 16.) & usersym, cos(q), sin(q), / fill IF relazi_deg LE 90.0 THEN BEGIN plot, obs_deg, rotate(brf, 2), xrange = [ - 90, 90], / xstyle, $ xticks = 6, charsize = chs, xtickname = xt1, title = tit, $ xtitle = 'Observation zenith angle !7h!3 [!9%!3]', $ ytitle = 'BRF [-]', / nodata, color = col_frame, Font = - 1, $ background = backgr, yrange = yr, / ystyle, / ynozero ysol = !y.crange(1) & oplot, [illzen_deg, illzen_deg], $ [ - 0.1, ysol], col = col_sol ysol = !y.crange(0) + 0.95 * (!y.crange(1) - !y.crange(0)) anno = !y.crange(0) + 0.05 * (!y.crange(1) - !y.crange(0)) plots, [illzen_deg, illzen_deg], [ysol, ysol], psym = 8, $ symsize = 1.5, col = col_sol plots, [illzen_deg, illzen_deg], [ysol, ysol], psym = 2, $ symsize = 3.5, thick = 2, col = col_sol xyouts, 0.0, anno, alignment = 0.5, $ '!94!3 forward < scattering direction > backward !96!3', $ charsize = chs, col = col_frame ENDIF ELSE BEGIN plot, obs_deg, rotate(brf, 2), xrange = [ - 90, 90], / xstyle, $ xticks = 6, charsize = chs, ytitle = 'BRF [-]', / nodata, Font = - 1, $ xtitle = 'observation zenith angle !7h!3 [!9%!3]', title = tit, $ color = 0, background = backgr, yrange = yr, / ystyle, / ynozero ysol = !y.crange(1) & oplot, [ - illzen_deg, - illzen_deg], $ [ - 0.1, ysol], col = col_sol ysol = !y.crange(0) + 0.95 * (!y.crange(1) - !y.crange(0)) anno = !y.crange(0) + 0.05 * (!y.crange(1) - !y.crange(0)) plots, [ - illzen_deg, - illzen_deg], [ysol, ysol], psym = 8, $ symsize = 1.5, col = col_sol plots, [ - illzen_deg, - illzen_deg], [ysol, ysol], psym = 2, $ symsize = 3.5, thick = 2, col = col_sol xyouts, 0.0, anno, alignment = 0.5, $ '!94!3 backward < scattering direction > forward !96!3', $ charsize = chs, col = col_frame ENDELSE ;; draw the 2-d plot of the brf as a function of observation zenith angle oplot, obs_deg, rotate(brf, 2), color = col_plot ;; add sensor viewing directions if requested annot_sensor = ['', 'ATSR', 'AVHRR/MODIS', 'MISR', 'SPECTRA'] xyouts, obs_deg(0), !y.Crange(0) + 0.9 * (!y.Crange(1) - !y.Crange(0)), $ annot_sensor(sens_sel), col = col_sens, charthick = 2, charsize = 1.4 case sens_sel of 0: GOTO, FIN 1: BEGIN atsr_angl = [55.0, 0.0] ; ATSR brf_atsr = interpol(rotate(brf, 2), obs_deg, atsr_angl) oplot, atsr_angl, brf_atsr, psym = 4, col = col_sens, thick = 3, $ symsize = 2 END 2: BEGIN ; AVHRR/MODIS oplot, [obs_deg(80), obs_deg(80)], [brf(80), brf(80)], psym = 4, $ col = col_sens, thick = 3, symsize = 2 END 3: BEGIN ; MISR misr_angl = $ [ - 70.5, - 60.0, - 45.6, - 26.1, 0.0, 26.1, 45.6, 60.0, 70.5] brf_misr = interpol(rotate(brf, 2), obs_deg, misr_angl) oplot, misr_angl, brf_misr, psym = 4, col = col_sens, thick = 3, $ symsize = 2 END 4: BEGIN ; SPECTRA spectra_angl = [ - 70.5, - 60, - 45, 0, 45, 60, 70.5] spectra_angl = spectra_angl(sort(spectra_angl)) brf_spectra = interpol(rotate(brf, 2), obs_deg, spectra_angl) oplot, spectra_angl, brf_spectra, psym = 4, col = col_sens, $ thick = 3, symsize = 2 END ELSE: BEGIN ENDELSE ENDCASE FIN: ;; return current color table tvlct, r_curr, g_curr, b_curr END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** PRO Show_2_CONT, show ;;***************************************************************************** ;; PURPOSE: display the BRDF as a contour plot ;;***************************************************************************** ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl ;; declare a COMMON block to hold the values ofthe angular and ;; physical variables obtained from the widgets: COMMON Vars_params, illzen_deg, illzen_rad, obszen_deg, obszen_rad, $ relazi_deg, relazi_rad, rhopar, kpar, thetapar, hspar ;; declare a COMMON block to hold the output data derived from the routine COMMON Output, obs_deg, rel_deg, brf, image, acroread_exe, AnisView_dir COMMON Oldtheta, thetapar_mrpv_old, thetapar_rpv_old, outside, $ outside_p, epsilon widget_control, w_rdpx, set_value = '' ;; if bw-plot IF bw_sel EQ 1 THEN BEGIN ;; temporarily store current color table and load color table bw tvlct, r_curr, g_curr, b_curr, / get & loadct, 0 ENDIF ;; display BRF field again requires to put it back into the original, ;; non rotated state IF show EQ 1 THEN BEGIN brf = rotate(brf, 1) GOTO, show_again ENDIF ;; in case of ps-file: do not redo these steps after initial drawing ;; because the brf has now a different dimension and is already available IF !d.Name EQ my_device THEN BEGIN ;;generate BRF field in polar coordinates with high resolution brf = polar_surface(brf, obs_deg, rel_deg * !dtor, / Grid, $ spacing = [1.0, 1.0]) ENDIF show_again: ;; get dimension and resize axis array iz = size(brf) & x = (1. - 2 * findgen(iz(1)) / (iz(1) - 1)) * 80 y = (1. - 2 * findgen(iz(1)) / (iz(2) - 1)) * 80 ;; initial determination of field outside the circular BRF field but ;; inside the rectangular 161,161 display area. This done only once. IF n_elements(outside) EQ 1 THEN BEGIN min0 = min(brf) & dat = brf(where(brf GT min0)) & offs = min(dat) outside = brf LT offs ENDIF ;; get range of brf array valid = outside * 10.0 + brf mindat = min(valid) & maxdat = max(brf) IF !d.Name EQ my_device THEN BEGIN brf = outside * mindat + (outside EQ 0b) * brf brf = rotate(brf, 3) & cha = 1.3 & sens_sym_thick = 3 ENDIF ELSE BEGIN ;; for ps-file: do not turn image again and change annotation color ;; to black cha = 2.5 & sens_sym_thick = 7 ENDELSE ;; x/y-axis annotation labels xtm = ['80', '40', '0', '-40', '-80'] & coll = 0 ;; to plot a circle xcirc = sin(findgen(361) * !dtor) & Ycirc = cos(findgen(361) * !dtor) ;; Temporarily store the previously calculated pxim and pyim ;; calculated for my_device because ps-device will give different ;; settings within tvim which can THEN no longer be used to read out ;; the brf values from the screen=my_device IF strupcase(!d.Name) EQ 'PS' THEN BEGIN pxim_tmp = pxim & pyim_tmp = pyim ENDIF ;; draw the 3-D polar plot of brf as a function of the observation ;; zenith and rel. azimuth angles: call_procedure, 'tvim', brf, xrange = [ - 80, 80], yrange = [ - 80, 80], $ range = [mindat, maxdat], scbr = 0.9, / scale, scchar = 1.0, $ charsize = 1.0, aspect = 0.8, xoffset = 1.8, yoffset = 2.7, $ ticks = 1, xticks = 4, xtickname = xtm, yticks = 4, ytickname = xtm, $ color = coll, background = 255, outside = outside ;; draw the circles for the observer zenith angles 30, 60, and 80 degrees oplot, xcirc * 30, ycirc * 30, lin = 5, col = 255, thick = cha oplot, xcirc * 60, ycirc * 60, lin = 5, col = 255, thick = cha oplot, xcirc * 80, ycirc * 80, lin = 5, col = 255, thick = cha xyouts, - 70, 50, '!7h!3=80!9%!3', / data, orientation = 47, col = 0, $ charsize = 1.3 ;; draw the graticule for the relative azimuth oplot, [0, 0], [ - 100, 90], lin = 0, / noclip, col = coll oplot, [ - 98, 80], [0, 0], lin = 0, / noclip, col = coll xyouts, 2, 84, '!7u!3=180!9%!3', / data, col = coll, charsize = 1.3 xyouts, 2, - 98, '!7u!3=0!9%!3', / data, col = coll, charsize = 1.3 xyouts, - 92, 3, '!7u!3=90!9%!3', / data, orientation = 90, $ col = coll, charsize = 1.3 IF !d.Name NE my_device THEN BEGIN ; ps-format oplot, [0, 0], [ - 80, 80], lin = 0, col = 255 oplot, [ - 80, 80], [0, 0], lin = 0, col = 255 ENDIF ;; write further annotations xtitle = 'X = !7h!3 !9*!3 sin(!7u!3) [!9%!3]' ytitle = 'Y = !7h!3 !9*!3 cos(!7u!3) [!9%!3]' title = 'Solar zenith angle !7h!I!30!N = ' + strtrim(illzen_deg, 2) + $ '!9%!3' xyouts, / data, 0, 110, alignment = 0.5, title, charsize = 1.5, color = 0 xyouts, / data, 0, - 118, alignment = 0.5, xtitle, charsize = 1.3, $ color = 0 xyouts, / data, - 114, 0, alignment = 0.5, orientation = 90, ytitle, $ charsize = 1.3, color = 0 xyouts, / data, 85, 88, charsize = 1.3, 'BRF', color = 0 ;; settings for contour plot, define levels levels = findgen(60) / 50.0 & step = (levels(1) - levels(0)) nr_cl = (maxdat - mindat) / step ; # of levels IF nr_cl GT 300.0 THEN GOTO, skip ; no levels due to too many levels lev_int = fix(nr_cl / 5) ; level interval to be selected IF nr_cl GT 5 THEN BEGIN ; to have 4 levels in total q = levels - mindat & q = where(q GT 0.0, count) ; first level IF count GT 0 THEN BEGIN sel_lev = levels(q(0)) + findgen(5) * levels(lev_int) ; sel. levels ENDIF ENDIF ELSE BEGIN sel_lev = levels ENDELSE cla = replicate(1, n_elements(sel_lev)) ; draw annotation for each level cls = replicate(1, n_elements(sel_lev)) ; dotted linestyle ;; draw contour plot contour, / overplot, brf, - x, - y, $ xrange = [ - 80, 80], yrange = [ - 80, 80], / xstyle, / ystyle, $ levels = sel_lev, c_labels = cla, c_linestyle = cls, $ col = 0, charsize = cha, charthick = 2, thick = cha skip: ;; image field for interactive BRF readout: restore pxim and pyim in ;; case of ps-device IF strupcase(!d.Name) EQ 'PS' THEN BEGIN pxim = pxim_tmp & pyim = pyim_tmp ENDIF image = congrid(brf, pxim(1) - pxim(0), pyim(1) - pyim(0)) widget_control, w_rdpx, $ set_value = 'Move pointer in BRF field to readout geometry and BRFs.' ;; add sensor viewing directions IF requested annot_sensor = ['', 'ATSR', 'AVHRR/MODIS', 'MISR', 'SPECTRA'] IF sens_sel GT 0 THEN begin xyouts, - 100, 85, / data, '!9V!3', col = 0, $ charthick = 1.5 * cha, charsize = 1.5 xyouts, - 90, 85, / data, annot_sensor(sens_sel), col = 0, $ charthick = 1.5 * cha, charsize = 1.5 endif CASE sens_sel OF 0: GOTO, fin 1: BEGIN ; ATSR angl = [ 55.0, 0.0] FOR id = 0, n_elements(angl) - 1 DO BEGIN res = cv_coord(from_polar = [60.0, angl(id)], / to_rect, $ / degrees) oplot, [res(0), res(0)], [res(1), res(1)], psym = 4, $ col = 255, thick = sens_sym_thick, symsize = 2 ENDFOR END 2: BEGIN ; AVHRR/MODIS oplot, [0, 0], [0, 0], psym = 4, col = 255, $ thick = sens_sym_thick, symsize = 2 END 3: BEGIN ; MISR angl = [- 70.0, - 60.0, - 45.6, - 26.1, 0.0, 26.1, 45.6, 60.0, 70.0] FOR id = 0, n_elements(angl) - 1 DO BEGIN res = cv_coord(from_polar = [60.0, angl(id)], / to_rect, $ / degrees) oplot, [res(0), res(0)], [res(1), res(1)], psym = 4, $ col = 255, thick = sens_sym_thick, symsize = 2 ENDFOR END 4: BEGIN ; SPECTRA angl = [ - 70, - 60, - 45, 0, 45, 60, 70] FOR id = 0, n_elements(angl) - 1 DO BEGIN res = cv_coord(from_polar = [60.0, angl(id)], / to_rect, $ / degrees) oplot, [res(0), res(0)], [res(1), res(1)], psym = 4, $ col = 255, thick = sens_sym_thick, symsize = 2 ENDFOR END ELSE: BEGIN ENDELSE ENDCASE fin: ;; if bw-plot return current color table IF bw_sel EQ 1 THEN tvlct, r_curr, g_curr, b_curr END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** PRO Show_3_RECT ;;***************************************************************************** ;; PURPOSE: display the BRDF in a rectangular grid ;;***************************************************************************** ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl ;; declare a COMMON block to hold the values ofthe angular and ;; physical variables obtained from the widgets: COMMON Vars_params, illzen_deg, illzen_rad, obszen_deg, obszen_rad, $ relazi_deg, relazi_rad, rhopar, kpar, thetapar, hspar ;; declare a COMMON block to hold the output data derived from the routine COMMON Output, obs_deg, rel_deg, brf, image, acroread_exe, AnisView_dir ;; if bw-plot IF bw_sel EQ 1 THEN BEGIN ;; temporarily store current color table and load color table bw tvlct, r_curr, g_curr, b_curr, / get & loadct, 0 ENDIF zmin = min(brf) & zmax = max(brf) IF abs(zmax - zmin) LT 0.000001 THEN BEGIN brf( * , * ) = zmin & zmin = 0.95 * zmin & zmax = 1.05 * zmax IF zmax LT 0.000001 THEN zmax = 0.000001 ENDIF widget_control, w_rdpx, set_value = '' IF !d.N_colors LT 257 THEN BEGIN ; pseudo color display, 8 bit ;; set maximum color index IF !d.Name EQ my_device THEN BEGIN ; on screen color_max = fix(!p.Color - 1) ENDIF ELSE BEGIN ; post script IF strupcase(my_device) EQ 'WIN' THEN color_max = 234 ELSE $ color_max = 254 ENDELSE ENDIF ELSE BEGIN color_max = 254 ENDELSE ;; draw the 3-D plot of brf as a function of the observation zenith ;; and relative azimuth angles: shade_surf, brf, obs_deg, rel_deg, yrange = [0, 180], / ystyle, $ xrange = [0, 80], / xstyle, zrange = [zmin, zmax], / save, $ xticks = 4, yticks = 6, ztickformat = '(f9.6)', color = 0, $ charsize = 1.5, ax = 50, az = 10, background = 255, font = - 1, $ shades = bytscl(brf, top = color_max), $ xtitle = 'Observation zenith angle !7h!3 [!9%!3]', $ ytitle = 'Relative azimuth angle !7u!3 [!9%!3]' title = 'Solar zenith angle !7h!I!30!N = ' + strtrim(illzen_deg, 2) + $ '!9%!3' xyouts, / normal, 0.5, 0.95, alignment = 0.5, title, charsize = 1.6, $ color = 0, font = - 1 xyouts, / normal, 0.17, 0.93, alignment = 0.5, 'B R F [-]', $ charsize = 1.1, color = 0, font = - 1 IF !d.Name EQ my_device THEN sens_sym_thick = 3 ELSE sens_sym_thick = 8 ;; add sensor viewing directions IF requested annot_sensor = ['', 'ATSR', 'AVHRR/MODIS', 'MISR', 'SPECTRA'] & cha = 1.5 IF sens_sel GT 0 THEN xyouts, 0.02, 0.96, / normal, '!9V!3', col = 0, $ charthick = 1.5 * cha, charsize = 1.5 xyouts, 0.05, 0.96, / normal, annot_sensor(sens_sel), col = 0, $ charthick = 1.5 * cha, charsize = 1.5 obszen_rad_old = obszen_rad & relazi_rad_old = relazi_rad relazi_rad = 30.0 * !dtor Case sens_sel OF 0: GOTO, fin 1: BEGIN ; ATSR angl = [ 55, 0] FOR id = 0, n_elements(angl) - 1 DO BEGIN obszen_rad = angl(id) * !dtor & Zz = rahmanbrf() xx = abs(angl(id)) & yy = abs((angl(id) LT 0.0) * 180.0 - 30.0) plots, [xx, xx], [yy, yy], [zz, zz], / t3d, psym = 4, $ col = 255, thick = sens_sym_thick, symsize = 4 ENDFOR END 2: BEGIN ; AVHRR/MODIS obszen_rad = 0.0 & relazi_rad = 0.0 & zz = rahmanbrf() plots, [0, 0], [0, 0], [zz, zz], / T3D, psym = 4, col = 255, $ thick = sens_sym_thick, symsize = 4 END 3: BEGIN ; MISR angl = [- 70.0, - 60.0, - 45.6, - 26.1, 0.0, 26.1, 45.6, 60.0, 70.0] FOR id = 0, n_elements(angl) - 1 DO BEGIN obszen_rad = angl(id) * !dtor & Zz = rahmanbrf() xx = abs(angl(id)) & yy = abs((angl(id) LT 0.0) * 180.0 - 30.0) plots, [xx, xx], [yy, yy], [zz, zz], / t3d, psym = 4, $ col = 255, thick = sens_sym_thick, symsize = 4 ENDFOR END 4: BEGIN ; SPECTRA angl = [ - 70, - 60, - 45, 0, 45, 60, 70] FOR id = 0, n_elements(angl) - 1 DO BEGIN obszen_rad = angl(id) * !dtor & Zz = rahmanbrf() xx = abs(angl(id)) & yy = abs((angl(id) LT 0.0) * 180.0 - 30.0) plots, [xx, xx], [yy, yy], [zz, zz], / t3d, psym = 4, $ col = 255, thick = sens_sym_thick, symsize = 4 ENDFOR END ELSE: BEGIN ENDELSE ENDCASE fin: ;; reset to original values obszen_rad = obszen_rad_old & relazi_rad = relazi_rad_old ;; if bw-plot return current color table IF bw_sel EQ 1 THEN tvlct, r_curr, g_curr, b_curr END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** PRO Show_3_POL, show ;;***************************************************************************** ;; PURPOSE: display the BRDF in a polar diagram ;;***************************************************************************** ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl ;; declare a COMMON block to hold the values ofthe angular and ;; physical variables obtained from the widgets: COMMON Vars_params, illzen_deg, illzen_rad, obszen_deg, obszen_rad, $ relazi_deg, relazi_rad, rhopar, kpar, thetapar, hspar ;; declare a COMMON block to hold the output data derived from the routine COMMON Output, obs_deg, rel_deg, brf, image, acroread_exe, AnisView_dir COMMON Oldtheta, thetapar_mrpv_old, thetapar_rpv_old, outside, $ outside_p, epsilon widget_control, w_rdpx, set_value = '' ;; if bw-plot IF bw_sel EQ 1 THEN BEGIN ;; temporarily store current color table and load color table bw tvlct, r_curr, g_curr, b_curr, / get & loadct, 0 ENDIF ;; display BRF field again requires to put it back into the original, ;; non rotated state IF show EQ 1 THEN BEGIN brf = rotate(brf, 1) GOTO, show_again ENDIF IF !d.Name EQ my_device THEN BEGIN ;; get BRF field in polar coordinates with very high resolution brf = polar_surface(brf, obs_deg, rel_deg * !dtor, / Grid, $ spacing = [0.4, 0.4]) ENDIF show_again: ;; get dimension and resize axis array iz = size(brf) x = 1. - 2 * findgen(iz(1)) / (iz(1) - 1) & x = rotate(x, 2) y = 1. - 2 * findgen(iz(1)) / (iz(2) - 1) & y = rotate(y, 2) ;; initial determination of field outside the circular BRF field but ;; inside the rectangular 161,161 display area. This done only once. IF n_elements(outside_p) EQ 1 THEN BEGIN min0 = min(brf) & dat = brf(where(brf GT min0)) & offs = min(dat) outside_p = brf LT offs ENDIF ;; get range of brf array valid = outside_p * 10.0 + brf mindat = min(valid) & maxdat = max(brf) IF !d.Name EQ my_device THEN BEGIN brf = outside_p * mindat + (outside_p EQ 0b) * brf & brf = rotate(brf, 3) ENDIF IF abs(maxdat - mindat) LT epsilon * 10.0 THEN BEGIN brf( * , * ) = mindat IF mindat LT 0.000018 THEN BEGIN mindat = 0.0 & maxdat = 0.00002 ENDIF ELSE BEGIN mindat = 0.9 * mindat & maxdat = 1.1 * maxdat ENDELSE ENDIF ;; x/y-axis annotation labels xtm = ['80', '40', '0', '-40', '-80'] IF !d.n_colors LT 257 THEN BEGIN ; pseudo color display, 8 bit ;; set maximum color index IF !d.Name EQ my_device THEN BEGIN ; on screen color_max = fix(!p.Color - 1) ENDIF ELSE BEGIN ; post script IF strupcase(my_device) EQ 'win' THEN color_max = 234 ELSE $ color_max = 254 ENDELSE ENDIF ELSE BEGIN color_max = 254 ENDELSE ;; draw the 3-d polar plot of brf as a function of the observation ;; zenith and rel. azimuth angles: shade_surf, brf, x, y, charsize = 1.7, ztickformat = '(f9.6)', $ shades = bytscl(brf, top = color_max), $ xticks = 4, xtickname = xtm, yticks = 4, ytickname = xtm, $ zrange = [mindat, maxdat], / zstyle, ax = 55, az = 10, $ xtitle = 'x = !7h !9*!3 sin(!7u!3) [!9%!3]', $ ytitle = 'y = !7h !9*!3 cos(!7u!3) [!9%!3]', color = 0, $ background = 255 title = 'Solar zenith angle !7h!i!30!n = ' + $ strtrim(illzen_deg, 2) + '!9%!3' xyouts, / normal, 0.5, 0.95, alignment = 0.5, title, charsize = 1.6, $ color = 0 xyouts, / normal, 0.12, 0.91, 'B R F [-]', charsize = 1.3, color = 0 ;; if bw-plot return current color table IF bw_sel EQ 1 THEN tvlct, r_curr, g_curr, b_curr END ;;***************************************************************************** ;;***************************************************************************** ;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;; ;; P R O C E D U R E T O C A L C U L A T E B R F S ;; ;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;***************************************************************************** ;;***************************************************************************** PRO Calc_1 ;;***************************************************************************** ;; PURPOSE: calculate single BRF value ;;***************************************************************************** ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl ;; declare a COMMON block to hold the output data derived from the routine COMMON Output, obs_deg, rel_deg, brf, image, acroread_exe, AnisView_dir ;; declare a COMMON block to hold the values of the angular and ;; physical variables obtained from the widgets: COMMON Vars_params, illzen_deg, illzen_rad, obszen_deg, obszen_rad, $ relazi_deg, relazi_rad, rhopar, kpar, thetapar, hspar widget_control, w_ill_zen, sensitive = 1 widget_control, w_obs_zen, sensitive = 1 widget_control, w_rel_azi, sensitive = 1 brf = rahmanbrf () call_procedure, "show_1" END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** PRO Calc_2_PLANE ;;***************************************************************************** ;; PURPOSE: calculate BRFS along azimuthal plane for given illumination ;;***************************************************************************** ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl ;; declare a COMMON block to hold the output data derived from the routine COMMON Output, obs_deg, rel_deg, brf, image, acroread_exe, AnisView_dir ;; declare a COMMON block to hold the values of the angular and ;; physical variables obtained from the widgets: COMMON Vars_params, illzen_deg, illzen_rad, obszen_deg, obszen_rad, $ relazi_deg, relazi_rad, rhopar, kpar, thetapar, hspar widget_control, w_ill_zen, sensitive = 1 widget_control, w_obs_zen, sensitive = 0 widget_control, w_rel_azi, sensitive = 1 ;; declare the arrays for the observation zenith angles and the brfs: obs_deg = indgen (161) - 80 & obs_rad = obs_deg * !dtor Relazi_rad = relazi_deg * !dtor Brf = fltarr (161) ;; compute the brf values for all observation zenith angles along the ;; azimuthal plane selected: FOR i = 0, 160 DO BEGIN obszen_rad = obs_rad [i] brf [i] = rahmanbrf () ENDFOR widget_control, / hourglass call_procedure, "show_2_plane" END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** PRO Calc_2_CONT ;;***************************************************************************** ;; PURPOSE: calculate BRDF for a contour diagramm ;;***************************************************************************** ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl ;; declare a COMMON block to hold the output data derived from the routine COMMON Output, obs_deg, rel_deg, brf, image, acroread_exe, AnisView_dir ;; declare a COMMON block to hold the values ofthe angular and ;; physical variables obtained from the widgets: COMMON Vars_params, illzen_deg, illzen_rad, obszen_deg, obszen_rad, $ relazi_deg, relazi_rad, rhopar, kpar, thetapar, hspar widget_control, w_ill_zen, sensitive = 1 widget_control, w_obs_zen, sensitive = 0 widget_control, w_rel_azi, sensitive = 0 ;; declare the arrays for the observation zenith angles and the BRFS: obs_deg = indgen (161) - 80 & obs_rad = obs_deg * !dtor Rel_deg = indgen (181) & rel_rad = rel_deg * !dtor Brf = fltarr (161, 181) ;; compute the BRDF values for the selected solar zenith angle: FOR i = 0, 160 DO BEGIN obszen_rad = obs_rad [i] FOR j = 0, 180, 1 DO BEGIN relazi_rad = rel_rad [j] brf [i, j] = rahmanbrf () ENDFOR ENDFOR widget_control, / hourglass call_procedure, "show_2_cont", 0 END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** PRO Calc_3_RECT ;;***************************************************************************** ;; PURPOSE: calculate BRDF in a rectangular grid ;;***************************************************************************** ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl ;; declare a COMMON block to hold the output data derived from the routine COMMON Output, obs_deg, rel_deg, brf, image, acroread_exe, AnisView_dir ;; declare a COMMON block to hold the values ofthe angular and ;; physical variables obtained from the widgets: COMMON Vars_params, illzen_deg, illzen_rad, obszen_deg, obszen_rad, $ relazi_deg, relazi_rad, rhopar, kpar, thetapar, hspar widget_control, w_ill_zen, sensitive = 1 widget_control, w_obs_zen, sensitive = 0 widget_control, w_rel_azi, sensitive = 0 ;; declare the arrays for the observation zenith angles and the brfs: obs_deg = indgen (81) & obs_rad = obs_deg * !dtor Rel_deg = indgen (181) & rel_rad = rel_deg * !dtor Brf = fltarr (81, 181) ;; compute the BRDF for the selected solar zenith angle: FOR i = 0, 80 DO BEGIN obszen_rad = obs_rad [i] FOR j = 0, 180 DO BEGIN relazi_rad = rel_rad [j] brf [i, j] = rahmanbrf () ENDFOR ENDFOR widget_control, / hourglass call_procedure, "show_3_rect" END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** PRO Calc_3_POL ;;***************************************************************************** ;; PURPOSE: calculate BRDF in a polar diagramm ;;***************************************************************************** ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl ;; declare a COMMON block to hold the output data derived from the routine COMMON Output, obs_deg, rel_deg, brf, image, acroread_exe, AnisView_dir ;; declare a COMMON block to hold the values ofthe angular and ;; physical variables obtained from the widgets: COMMON Vars_params, illzen_deg, illzen_rad, obszen_deg, obszen_rad, $ relazi_deg, relazi_rad, rhopar, kpar, thetapar, hspar widget_control, w_ill_zen, sensitive = 1 widget_control, w_obs_zen, sensitive = 0 widget_control, w_rel_azi, sensitive = 0 ;; declare the arrays for the observation zenith angles and the BRFS: obs_deg = indgen (161) - 80 & obs_rad = obs_deg * !dtor Rel_deg = indgen (181) & rel_rad = rel_deg * !dtor Brf = fltarr (161, 181) ;; compute the BRDF for the selected solar zenith angle: FOR i = 0, 160 DO BEGIN obszen_rad = obs_rad [i] FOR j = 0, 180, 1 DO BEGIN relazi_rad = rel_rad [j] brf [i, j] = rahmanbrf () ENDFOR ENDFOR widget_control, / hourglass call_procedure, "show_3_pol", 0 END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;+ ; NAME: ; TVREAD ; ; PURPOSE: ; ; To get accurate screen dumps with the IDL command TVRD on 24-bit ; PC and Macintosh computers, you have to be sure to set color ; decomposition on. This program adds that capability automatically. ; In addition, the program will optionally write BMP, GIF, JPEG, ; PICT, PNG, and TIFF color image files of the screen dump. ; It will also convert the background and foreground color from ; white/black ; ; AUTHOR: ; ; FANNING SOFTWARE CONSULTING ; David Fanning, Ph.D. ; 1645 Sheely Drive ; Fort Collins, CO 80526 USA ; Phone: 970-221-0438 ; E-mail: davidf@dfanning.com ; Coyote's Guide to IDL Programming: http://www.dfanning.com ; ; CATEGORY: ; ; Graphics ; ; CALLING SEQUENCE: ; ; image = TVREAD(xstart, ystart, ncols, nrows) ; ; The returned image will be a 2D image on 8-bit systems and ; a 24-bit pixel interleaved true-color image on 24-bit systems. ; A -1 will be returned IF a file output keyword is used ; (e.g., JPEG, TIFF, etc.). ; ; OPTIONAL INPUTS: ; ; XSTART -- The starting column index. By default, 0. ; ; YSTART -- The starting row index. By default, 0. ; ; NCOLS -- The number of columns to read. By default, ; !D.X_Size - XSTART ; ; NROWS -- The number of rows to read. By default, !D.Y_Size - YSTART. ; ; KEYWORD PARAMETERS: ; ; BMP -- Set this keyword to write the screen dump as a color BMP file ; ; COLORS -- IF a 24-bit image has to be quantized, this will set ; the number of colors in the output image. Set to 256 ; by default. Applies to BMP, GIF, PICT, and PNG ; formats written from 24-bit displays.(See the ; COLOR_QUAN documentation for details.) ; ; CUBE -- IF this keyword is set to a value between 2 and 6 the color ; quantization will use a cubic method of ; quantization. Applies to BMP, GIF, PICT, and PNG formats ; written from 24-bit displays.(See the COLOR_QUAN ; documentation for details.) ; ; DITHER -- IF this keyword is set the quantized image will be ; dithered. Applies to BMP, GIF, PICT, and PNG formats written ; from 24-bit displays. (See the COLOR_QUAN documentation for ; details.) ; ; FILENAME -- The base name of the output file. (No file extensions; ; they will be added automatically.) This name may be ; changed by the user. ; ; image = TVREAD(Filename='myfile', /JPEG) ; ; No file will be written unless a file output keyword is used ; (e.g., JPEG, TIFF, etc.) in the call. By default the FILENAME is ; set to "idl". The file extension will be set automatically ; to match the type of file created. ; ; GIF -- Set this keyword to write the screen dump as a color ; GIF file. ; ; JPEG -- Set this keyword to write the screen dump as a color ; JPEG file. ; ; NODIALOG -- Set this keyword IF you wish to avoid the ; DIALOG_PICKFILE dialog that asks you to name the ; output file. This keyword should be set, for ; example, IF you are processing screens in batch ; mode. ; ; PICT -- Set this keyword to write the screen dump as a color ; PICT file. ; ; PNG -- Set this keyword to write the screen dump as a color ; PNG file. ; ; TIFF -- Set this keyword to write the screen dump as a color ; TIFF file. ; ; QUALITY -- This keyword sets the amount of compression for ; JPEG images. It should be set to a value between 0 ; and 100. It is set to 75 by default. (See the ; WRITE_JPEG documentation for details.) ; ; WID -- The index number of the window to read from. The ; current graphics window (!D.Window) is selected by ; default. An error is issued IF no windows are currently ; open on a device that supports windows. ; ; _EXTRA -- Any keywords that are appropriate for the WRITE_*** ; routines are also accepted via keyword inheritance. ; ; COMMON BLOCKS: ; ; None ; ; RESTRICTIONS: Requires ERROR_MESSAGE from the Coyote Library: ; ; http://www.dfanning.com/programs/error_message.pro ; ; Requires IDL 5.2 and higher. ; ; MODIFICATION HISTORY: ; ; Written by David Fanning, 9 AUG 2000. ; Added changes to make the program more device independent. 16 ; SEP 2000. DWF. ; Removed GIF file support for IDL 5.4 and above. 18 JAN 2001. DWF. ; Added NODIALOG keyword. 28 MAR 2001. DWF. ;- ; ;############################################################################## ; ; LICENSE ; ; This software is OSI Certified Open Source Software. ; OSI Certified is a certification mark of the Open Source Initiative. ; ; Copyright � 2000 Fanning Software Consulting. ; ; This software is provided "as-is", without any express or ; implied warranty. In no event will the authors be held liable ; for any damages arising from the use of this software. ; ; Permission is granted to anyone to use this software for any ; purpose, including commercial applications, and to alter it and ; redistribute it freely, subject to the following restrictions: ; ; 1. The origin of this software must not be misrepresented; you must ; not claim you wrote the original software. IF you use this software ; in a product, an acknowledgment in the product documentation ; would be appreciated, but is not required. ; ; 2. Altered source versions must be plainly marked as such, and must ; not be misrepresented as being the original software. ; ; 3. This notice may not be removed or altered from any source distribution. ; ; For more information on Open Source Software, visit the Open Source ; web site: http://www.opensource.org. ; ;############################################################################## ; PLEASE NOTE : ; the function TVREAD as listed below is a *modified* adapted to fit ; the "AnisView.pro" code the original version of D.Fanning can be ; downloaded from http://www.dfanning.com. ;############################################################################## FUNCTION Tvread, BMP = bmp, Colors = colors, Cube = cube, $ Dither = dither, Quality = quality, $ _Extra = extra, Dialog = dialog, GIF = gif, $ JPEG = jpeg, PICT = pict, PNG = png, TIFF = tiff ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl ;; Check for availability of GIF files. thisVersion = Float(!Version.Release) IF thisVersion LT 5.3 THEN haveGIF = 1 ELSE haveGIF = 0 ;; ensure window is visible for screen shot wset, win_num IF Keyword_Set(bmp) THEN BEGIN writeImage = 1 fileType = 'BMP' extension = 'bmp' ENDIF ELSE IF Keyword_Set(gif) THEN BEGIN IF havegIF THEN BEGIN writeImage = 1 fileType = 'GIF' extension = 'gif' ENDIF ELSE BEGIN st = 'GIF files not supported in this IDL version. ' st = st + 'Replacing with PNG.' ok = Dialog_Message(st) writeImage = 1 fileType = 'PNG' extension = 'png' ENDELSE ENDIF ELSE IF Keyword_Set(jpeg) THEN BEGIN writeImage = 1 fileType = 'JPEG' extension = 'jpg' ENDIF ELSE IF Keyword_Set(PICT) THEN BEGIN writeImage = 1 fileType = 'PICT' extension = 'pict' ENDIF ELSE IF Keyword_Set(png) THEN BEGIN writeImage = 1 fileType = 'PNG' extension = 'png' ENDIF ELSE IF Keyword_Set(tiff) THEN BEGIN writeImage = 1 fileType = 'TIFF' extension = 'tif' ENDIF ;; if bw-plot we need to re-display the current color plot as bw ;; before doing the screen shot IF bw_sel EQ 1 THEN BEGIN ;; temporarily store current color table and load color table bw tvlct, r_tvr, g_tvr, b_tvr, / get & loadct, 0 CASE sel_out OF 0: BEGIN call_procedure, "show_0" END 1: BEGIN call_procedure, "show_1" END 2: BEGIN call_procedure, "show_2_plane" END 3: BEGIN call_procedure, "show_2_cont", 1 END 4: BEGIN call_procedure, "show_3_rect" END 5: BEGIN call_procedure, "show_3_pol", 1 END ELSE: BEGIN ENDELSE ENDCASE ENDIF IF N_Elements(colors) EQ 0 THEN colors = 256 IF N_Elements(quality) EQ 0 THEN quality = 75 dither = Keyword_Set(dither) ;; On 24-bit displays, make sure color decomposition is ON. IF (!D.Flags AND 256) NE 0 THEN BEGIN Device, Get_Decomposed = theDecomposedState, Get_Visual_Depth = theDepth IF theDepth GT 8 THEN BEGIN Device, Decomposed = 1 truecolor = 1 ENDIF ELSE truecolor = 0 ENDIF ELSE BEGIN truecolor = 0 theDepth = 8 ENDELSE ;; Get the screen dump. 2D image on 8-bit displays. 3D image on 24-bit ;; displays. image = TVRD(0, 0, !D.X_Size, !D.Y_Size, True = truecolor) IF theDepth GT 8 THEN Device, Decomposed = theDecomposedState ;; get the current timestamp for the file name mm = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', $ 'Oct', 'Nov', 'Dec'] tt = systime() qm = where(strmid(tt, 4, 3) EQ mm) & qm = strtrim(qm(0) + 1, 2) IF strlen(qm) THEN qm = '0' + qm & qd = strmid(tt, 8, 2) IF strmid(qd,0,1) eq ' ' then qd = '0' + strmid(qd,1,1) timestamp = strmid(tt, 20, 4) + '_' + qm + '_' + qd + $ '_' + strmid(tt, 11, 2) + '-' + $ strmid(tt, 14, 2) + '-' + strmid(tt, 17, 2) IF rpv_sel EQ 1 THEN fns = 'rpv_' + timestamp + '.' ELSE $ fns = 'mrpv_' + timestamp + '.' filename = fns + StrLowCase(extension) IF dialog THEN $ filename = $ Dialog_Pickfile( / Write, File = filename, / fix_filter, $ filter = '*.' + StrLowCase(extension)) IF filename EQ '' THEN BEGIN ; no image is saved widget_control, w_info, set_value = '' IF bw_sel EQ 1 THEN GOTO, col_def ELSE GOTO, fin ENDIF ;; Write the file. CASE fileType OF 'BMP': BEGIN IF truecolor THEN BEGIN CASE Keyword_Set(cube) OF 0: image2D = Color_Quan(image, 1, r, g, b, Colors = colors, $ Dither = dither) 1: image2D = Color_Quan(image, 1, r, g, b, Cube = 2 > cube < 6) ENDCASE ENDIF ELSE BEGIN TVLCT, r, g, b, / Get image2D = image ENDELSE Write_BMP, filename, image2D, r, g, b, _Extra = extra END 'GIF': BEGIN IF truecolor THEN BEGIN CASE Keyword_Set(cube) OF 0: image2D = Color_Quan(image, 1, r, g, b, Colors = colors, $ Dither = dither) 1: image2D = Color_Quan(image, 1, r, g, b, Cube = 2 > cube < 6) ENDCASE ENDIF ELSE BEGIN TVLCT, r, g, b, / Get image2D = image ENDELSE Write_GIF, filename, image2D, r, g, b, _Extra = extra END 'JPEG': BEGIN IF truecolor THEN BEGIN image3D = image ENDIF ELSE BEGIN s = Size(image, / Dimensions) image3D = BytArr(3, s[0], s[1]) TVLCT, r, g, b, / Get image3D[0, * , * ] = r[image] image3D[1, * , * ] = g[image] image3D[2, * , * ] = b[image] ENDELSE Write_JPEG, filename, image3D, True = 1, Quality = quality, $ _Extra = extra END 'PICT': BEGIN IF truecolor THEN BEGIN CASE Keyword_Set(cube) OF 0: image2D = Color_Quan(image, 1, r, g, b, Colors = colors, $ Dither = dither) 1: image2D = Color_Quan(image, 1, r, g, b, Cube = 2 > cube < 6) ENDCASE ENDIF ELSE BEGIN TVLCT, r, g, b, / Get image2D = image ENDELSE Write_PICT, filename, image2D, r, g, b END 'PNG': BEGIN IF truecolor THEN BEGIN CASE Keyword_Set(cube) OF 0: image2D = Color_Quan(image, 1, r, g, b, Colors = colors, $ Dither = dither) 1: image2D = Color_Quan(image, 1, r, g, b, Cube = 2 > cube < 6) ENDCASE ENDIF ELSE BEGIN TVLCT, r, g, b, / Get image2D = image ENDELSE Write_PNG, filename, image2D, r, g, b, _Extra = extra END 'TIFF': BEGIN IF truecolor THEN BEGIN image3D = Reverse(image, 3) ENDIF ELSE BEGIN s = Size(image, / Dimensions) image3D = BytArr(3, s[0], s[1]) TVLCT, r, g, b, / Get image3D[0, * , * ] = r[image] image3D[1, * , * ] = g[image] image3D[2, * , * ] = b[image] image3D = Reverse(Temporary(image3D), 3) ENDELSE Write_TIFF, filename, image3D, 1, _Extra = extra END ENDCASE widget_control, w_info, set_value = 'Your ' + $ StrLowCase(extension) + '- file has been saved.' col_def: ;; if bw-plot then re-setting to default color display IF bw_sel EQ 1 THEN BEGIN bw_sel = 0 ;; return current color table tvlct, r_tvr, g_tvr, b_tvr CASE sel_out OF 0: BEGIN call_procedure, "show_0" END 1: BEGIN call_procedure, "show_1" END 2: BEGIN call_procedure, "show_2_plane" END 3: BEGIN call_procedure, "show_2_cont", 1 END 4: BEGIN call_procedure, "show_3_rect" END 5: BEGIN call_procedure, "show_3_pol", 1 END ELSE: BEGIN ENDELSE ENDCASE ENDIF fin: RETURN, - 1 END ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** PRO Plot_ps, encapsulate = encapsulate COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl ;; get the output file name ;; get the current timestamp for the file name mm = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', $ 'Oct', 'Nov', 'Dec'] tt = systime() qm = where(strmid(tt, 4, 3) EQ mm) & qm = strtrim(qm(0) + 1, 2) IF strlen(qm) THEN qm = '0' + qm & qd = strmid(tt, 8, 2) IF strmid(qd,0,1) eq ' ' then qd = '0' + strmid(qd,1,1) timestamp = strmid(tt, 20, 4) + '_' + qm + '_' + qd + $ '_' + strmid(tt, 11, 2) + '-' + $ strmid(tt, 14, 2) + '-' + strmid(tt, 17, 2) IF rpv_sel EQ 1 THEN fns = 'rpv_' + timestamp ELSE fns = 'mrpv_' + timestamp IF keyword_set(encapsulate) THEN ty = 'eps' ELSE ty = 'ps' filename = fns + '.' + ty filename = $ Dialog_Pickfile( / Write, File = filename, / fix_filter, $ filter = '*.' + ty) IF filename eq '' THEN GOTO, fin set_plot, 'ps' & !p.Font = - 1 & !p.Charthick = 1.4 & !p.Thick = 2. !x.Thick = 2. & !y.Thick = 2. & !p.Charsize = 1.4 device, / helvetica, / color, / portrait, $ encapsulate = keyword_set(encapsulate), font_size = 12, file = filename, $ bits_per_pixel = 8, xoffset = 1.5, yoffset = 6, ysize = 18, xsize = 18 CASE sel_out OF 0: BEGIN call_procedure, "show_0" END 1: BEGIN call_procedure, "show_1" END 2: BEGIN call_procedure, "show_2_plane" END 3: BEGIN call_procedure, "show_2_cont", 0 END 4: BEGIN call_procedure, "show_3_rect" END 5: BEGIN call_procedure, "show_3_pol", 0 END ELSE: BEGIN ENDELSE ENDCASE ; Clean up. !p.Charsize = 1. & !p.Charthick = 1. & !p.Thick = 1. & !x.Thick = 1. !y.Thick = 1. device, / close & set_plot, my_device widget_control, w_info, set_value = 'Your ' + ty + '-file has been saved.' fin: END ;;***************************************************************************** ;;***************************************************************************** ;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;; ;; P R O C E D U R E T O H A N D L E D I F F E R E N T E V E N T S ;; ;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;***************************************************************************** ;;***************************************************************************** PRO AnisView_event, event ;;***************************************************************************** ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl COMMON Oldtheta, thetapar_mrpv_old, thetapar_rpv_old, outside, $ outside_p, epsilon COMMON Stats, BRF_min, BRF_min_th, BRF_min_phi, $ BRF_max, BRF_max_th, BRF_max_phi, BRF_nad, BRF_hot, alb ; declare a COMMON block to hold the values of the angular and ; physical variables obtained from the widgets: COMMON Vars_params, illzen_deg, illzen_rad, obszen_deg, obszen_rad, $ relazi_deg, relazi_rad, rhopar, kpar, thetapar, hspar ;; declare a COMMON block to hold the output data derived from the routine COMMON Output, obs_deg, rel_deg, brf, image, acroread_exe, AnisView_dir ;; switch to indicate new calculation of statistics depending on the ;; selected event new_stat = 0 eventval = '' ;; find out the type of event that has occurred: ;;----------------------------------------------------------------------------- widget_control, event.id, get_uvalue = eventval ;; initiate actions depending on the type of event: ;;----------------------------------------------------------------------------- CASE eventval OF ;; display events (click or move cursor in display window) ;;----------------------------------------------------------------------------- "draw": BEGIN IF sel_out NE 3 THEN GOTO, fin s = size(image) & s[1] = s[1] - 1 & s[2] = s[2] - 1 x = event.x - pxim(0) & y = event.y - pyim(0) IF (x le s[1]) AND (y le s[2]) AND (x ge 0) AND (y ge 0) THEN BEGIN ;; get the position and the BRF value IF (!order Eq 1) THEN yy = s[2] - y ELSE yy = y xim = 80 - 160.0 / (pxim(1) - pxim(0)) * x yim = 80 - 160.0 / (pyim(1) - pyim(0)) * y & zim = Image[x, yy] ;; conversion to polar coordinates including transition to ;; original non-rotated image res = cv_coord(from_rect = [yim, xim], / to_polar, / degrees) theta = res(1) & phi = res(0) IF phi LT 0.0 THEN phi = 360.0 + phi IF theta GT 80.0 THEN msg = $ 'Move pointer in BRF field to readout geometry and BRFs.' $ ELSE msg = 'theta = ' + strtrim(theta, 2) + $ '[°], phi = ' + strtrim(phi, 2) + $ '[°], BRF = ' + strtrim(Image[x, yy], 2) + '[-]' widget_control, w_rdpx, set_value = msg ENDIF END ;; menue events ;;----------------------------------------------------------------------------- ;; file menu ;;============================ "open_sav": BEGIN IF rpv_sel EQ 1 THEN fns = 'rpv_time.sav' ELSE fns = 'mrpv_time.sav' again1: fname = $ dialog_pickfile(file = fns, filter = '*.sav', / read, / must_exist) ;; restore IDL.sav formatted file and get old color table IF fname EQ '' THEN GOTO, fin ;; test if sav-file is program file: cut of last 12 letter to ;; see if they coorespond to 'AnisView.sav' sav_fil = strupcase (strmid(fname, strlen(fname) - 12, 12)) IF sav_fil EQ 'ANISVIEW.SAV' THEN BEGIN result = $ dialog_message ('This is your program code! Try again...', $ / information) & GOTO, again1 ENDIF sav_fil = strupcase (strmid(fname, strlen(fname) - 4, 4)) IF sav_fil ne '.SAV' THEN BEGIN result = dialog_message ('Invalid file type! Try again...',$ /information) & GOTO, again1 ENDIF restore, fname & tvlct, r, g ,b IF rpv_sel EQ 1 THEN BEGIN tit = 'AnisView; BRF-model in use: RPV' widget_control, w_tlb, tlb_set_title = tit widget_control, w_param_theta_hg, $ set_value = [thetapar, - 0.5, 0.5], sensitive = 1 widget_control, w_asym_label, $ set_value = 'Asymmetry parameter theta_HG:' widget_control, w_rt_rpv, sensitive = 0 widget_control, w_rt_mrpv, sensitive = 1 ENDIF ELSE BEGIN tit = 'AnisView; BRF-model in use: MRPV' widget_control, w_tlb, tlb_set_title = tit ;; asymmetry parameter theta_hg now corresponds to b_m widget_control, w_param_theta_hg, $ set_value = [thetapar, - 1.5, 1.5], sensitive = 1 widget_control, w_asym_label, sensitive = 1, $ set_value = 'Asymmetry parameter b_M:' widget_control, w_rt_rpv, sensitive = 1 widget_control, w_rt_mrpv, sensitive = 0 ENDELSE widget_control, w_ill_zen, set_value = illzen_deg illzen_rad = illzen_deg * !dtor widget_control, w_obs_zen, set_value = obszen_deg obszen_rad = obszen_deg * !dtor widget_control, w_rel_azi, set_value = relazi_deg relazi_rad = relazi_deg * !dtor widget_control, w_param_rho, set_value = rhopar, sensitive = 1 widget_control, w_param_k, set_value = kpar, sensitive = 1 IF hs_sel EQ 0b THEN BEGIN widget_control, w_param_hs, sensitive = 0, set_value = rhopar widget_control, w_hotspot, set_value = 0, sensitive = 1 ENDIF ELSE BEGIN widget_control, w_param_hs, sensitive = 1, set_value = hspar widget_control, w_hotspot, set_value = 1, sensitive = 1 ENDELSE IF stat_sel EQ 0b THEN BEGIN widget_control, w_stat_sel, set_value = 0, sensitive = 1 BRF_min = ' --- ' & BRF_min_th = ' --- ' & BRF_min_phi = ' --- ' BRF_max = ' --- ' & BRF_max_th = ' --- ' & BRF_max_phi = ' --- ' BRF_nad = ' --- ' & BRF_hot = ' --- ' & alb = ' --- ' list = transpose([BRF_min, BRF_min_th, BRF_min_phi, BRF_max, $ BRF_max_th, BRF_max_phi, BRF_nad, BRF_hot, alb]) widget_control, w_tabl, set_value = list ENDIF ELSE BEGIN widget_control, w_stat_sel, set_value = 1, sensitive = 1 BRF_min = ' --- ' & BRF_min_th = ' --- ' & BRF_min_phi = ' --- ' BRF_max = ' --- ' & BRF_max_th = ' --- ' & BRF_max_phi = ' --- ' BRF_nad = ' --- ' & BRF_hot = ' --- ' & alb = ' --- ' call_procedure, 'statistics' list = transpose([BRF_min, BRF_min_th, BRF_min_phi, BRF_max, $ BRF_max_th, BRF_max_phi, BRF_nad, BRF_hot, alb]) widget_control, w_tabl, set_value = list ENDELSE sel_out = 2 ; 2-D plane display widget_control, w_0d, set_button = 0 widget_control, w_1d, set_button = 0 widget_control, w_2d_plane, set_button = 1 widget_control, w_2d_cont, set_button = 0 widget_control, w_3d_rect, set_button = 0 widget_control, w_3d_pol, set_button = 0 widget_control, w_sensor0, sensitive = 1 widget_control, w_sensor1, sensitive = 1 widget_control, w_sensor2, sensitive = 1 widget_control, w_sensor3, sensitive = 1 widget_control, w_sensor4, sensitive = 1 widget_control, w_xpal, sensitive = 0 widget_control, w_col_tbl, sensitive = 0 call_procedure, "calc_2_plane" & call_procedure, "show_2_plane" widget_control, w_info, $ set_value = 'Your IDL-sav file has been restored.' END "open_ascii": BEGIN IF rpv_sel EQ 1 THEN fns = 'rpv_time.dat' ELSE fns = 'mrpv_time.dat' again2: fname = $ dialog_pickfile(file = fns, filter = '*.dat', / read, / must_exist) IF fname EQ '' THEN GOTO, fin input = strarr(20) & li = '' openr, u, fname, / get_lun, error = err IF err NE 0 THEN BEGIN ; problem opening file widget_control, w_info, set_value = !error_state.Sys_msg + ' :-(' GOTO, again2 ENDIF readf, u, li ; read first line of file to be restored IF li EQ 'Input parameters of the MRPV BRF-model:' THEN BEGIN rpv_sel = 0 tit = 'AnisView; BRF-model in use: MRPV' widget_control, w_tlb, tlb_set_title = tit widget_control, w_param_theta_hg, sensitive = 1, $ set_value = [thetapar, - 1.5, 1.5] widget_control, w_rt_rpv, sensitive = 1 widget_control, w_rt_mrpv, sensitive = 0 ENDIF ELSE IF li EQ 'Input parameters of the RPV BRF-model:' THEN BEGIN rpv_sel = 1 tit = 'AnisView; BRF-model in use: RPV' widget_control, w_tlb, tlb_set_title = tit widget_control, w_param_theta_hg, sensitive = 1, $ set_value = [thetapar, - 0.5, 0.5] widget_control, w_rt_rpv, sensitive = 0 widget_control, w_rt_mrpv, sensitive = 1 ENDIF ELSE BEGIN res = dialog_message ('Invalid AnisView file. Try again...', $ / information) & free_lun, u & GOTO, again2 ENDELSE FOR i = 1, 19 DO BEGIN readf, u, li & input(i) = li ENDFOR free_lun, u illzen_deg = float(strmid(input(4), 0, 12)) illzen_rad = illzen_deg * !dtor obszen_deg = float(strmid(input(5), 0, 12)) obszen_rad = obszen_deg * !dtor relazi_deg = float(strmid(input(6), 0, 12)) relazi_rad = relazi_deg * !dtor rhopar = float(strmid(input(10), 0, 12)) kpar = float(strmid(input(11), 0, 12)) thetapar = float(strmid(input(12), 0, 12)) hspar = float(strmid(input(13), 0, 12)) hs_sel = byte(fix(strmid(input(14), 0, 12))) stat_sel = byte(fix(strmid(input(18), 0, 12))) sens_sel = byte(fix(strmid(input(19), 0, 12))) widget_control, w_ill_zen, set_value = illzen_deg widget_control, w_obs_zen, set_value = obszen_deg widget_control, w_rel_azi, set_value = relazi_deg widget_control, w_param_rho, set_value = rhopar, sensitive = 1 widget_control, w_param_k, set_value = kpar, sensitive = 1 IF hs_sel EQ 0b THEN BEGIN widget_control, w_param_hs, sensitive = 0, set_value = rhopar widget_control, w_hotspot, set_value = 0, sensitive = 1 ENDIF ELSE BEGIN widget_control, w_param_hs, sensitive = 1, set_value = hspar widget_control, w_hotspot, set_value = 1, sensitive = 1 ENDELSE IF stat_sel EQ 0b THEN BEGIN widget_control, w_stat_sel, set_value = 0, sensitive = 1 BRF_min = ' --- ' & BRF_min_th = ' --- ' & BRF_min_phi = ' --- ' BRF_max = ' --- ' & BRF_max_th = ' --- ' & BRF_max_phi = ' --- ' BRF_nad = ' --- ' & BRF_hot = ' --- ' & alb = ' --- ' list = transpose([BRF_min, BRF_min_th, BRF_min_phi, BRF_max, $ BRF_max_th, BRF_max_phi, BRF_nad, BRF_hot, alb]) widget_control, w_tabl, set_value = list ENDIF ELSE BEGIN widget_control, w_stat_sel, set_value = 1, sensitive = 1 BRF_min = ' --- ' & BRF_min_th = ' --- ' & BRF_min_phi = ' --- ' BRF_max = ' --- ' & BRF_max_th = ' --- ' & BRF_max_phi = ' --- ' BRF_nad = ' --- ' & BRF_hot = ' --- ' & alb = ' --- ' call_procedure, 'statistics' list = transpose([BRF_min, BRF_min_th, BRF_min_phi, BRF_max, $ BRF_max_th, BRF_max_phi, BRF_nad, BRF_hot, alb]) widget_control, w_tabl, set_value = list ENDELSE sel_out = 2 ; 2-D plane display widget_control, w_0d, set_button = 0 widget_control, w_1d, set_button = 0 widget_control, w_2d_plane, set_button = 1 widget_control, w_2d_cont, set_button = 0 widget_control, w_3d_rect, set_button = 0 widget_control, w_3d_pol, set_button = 0 widget_control, w_sensor0, sensitive = 1 widget_control, w_sensor1, sensitive = 1 widget_control, w_sensor2, sensitive = 1 widget_control, w_sensor3, sensitive = 1 widget_control, w_sensor4, sensitive = 1 widget_control, w_xpal, sensitive = 0 widget_control, w_col_tbl, sensitive = 0 call_procedure, "calc_2_plane" & call_procedure, "show_2_plane" widget_control, w_info, set_value = 'Your dat-file has been restored.' END "sav": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ;; get the current timestamp for the file name mm = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', $ 'Oct', 'Nov', 'Dec'] tt = systime() qm = where(strmid(tt, 4, 3) EQ mm) & qm = strtrim(qm(0) + 1, 2) IF strlen(qm) THEN qm = '0' + qm & qd = strmid(tt, 8, 2) IF strmid(qd,0,1) eq ' ' then qd = '0' + strmid(qd,1,1) timestamp = strmid(tt, 20, 4) + '_' + qm + '_' + qd + $ '_' + strmid(tt, 11, 2) + '-' + $ strmid(tt, 14, 2) + '-' + strmid(tt, 17, 2) IF rpv_sel EQ 1 THEN fns = 'rpv_' + timestamp + '.sav' $ ELSE fns = 'mrpv_' + timestamp + '.sav' fname = dialog_pickfile(file = fns, filter = '*.sav', / write) IF fname eq '' THEN GOTO, fin tvlct, r, g, b, / get IF stat_sel EQ 1b THEN BEGIN obszen_rad_old = obszen_rad & relazi_rad_old = relazi_rad brf_mat = fltarr(7, 6) phi_mat = [0, 30, 60, 90, 120, 150, 180] * !dtor Obs_mat = [0, 15, 30, 45, 60, 75] * !dtor FOR icol = 0, 6 DO BEGIN FOR ilin = 0, 5 DO BEGIN obszen_rad = obs_mat(ilin) & relazi_rad = phi_mat(icol) brf_mat(icol, ilin) = rahmanbrf() ENDFOR ENDFOR ;; reset to original values obszen_rad = obszen_rad_old & relazi_rad = relazi_rad_old save, illzen_deg, obszen_deg, relazi_deg, rhopar, kpar, $ thetapar, hspar, hs_sel, stat_sel, sens_sel, BRF_min, BRF_min_th, $ BRF_min_phi, BRF_max, BRF_max_th, BRF_max_phi, $ BRF_nad, BRF_hot, alb, brf_mat, r, g, b, rpv_sel, filename = fname ENDIF ELSE BEGIN save, illzen_deg, obszen_deg, relazi_deg, rhopar, kpar, $ thetapar, hspar, hs_sel, stat_sel, sens_sel, $ r, g, b, rpv_sel, filename = fname ENDELSE widget_control, w_info, $ set_value = 'Your IDL-sav file has been saved.' END "ascii": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ;; get the current timestamp for the file name mm = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', $ 'Oct', 'Nov', 'Dec'] tt = systime() qm = where(strmid(tt, 4, 3) EQ mm) & qm = strtrim(qm(0) + 1, 2) IF strlen(qm) THEN qm = '0' + qm & qd = strmid(tt, 8, 2) IF strmid(qd,0,1) eq ' ' then qd = '0' + strmid(qd,1,1) timestamp = strmid(tt, 20, 4) + '_' + qm + '_' + qd + $ '_' + strmid(tt, 11, 2) + '-' + $ strmid(tt, 14, 2) + '-' + strmid(tt, 17, 2) IF rpv_sel EQ 1 THEN fns = 'rpv_' + timestamp + '.dat' ELSE $ fns = 'mrpv_' + timestamp + '.dat' fname = dialog_pickfile(file = fns, filter = '*.dat', / write) IF fname EQ '' THEN GOTO, fin openw, u, fname, / get_lun IF rpv_sel EQ 1 THEN $ printf, u, 'Input parameters of the RPV BRF-model:' $ ELSE printf, u, 'Input parameters of the MRPV BRF-model:' printf, u, '---------------------------------------------------------' printf, u, 'a) Geometrical input parameters (in degrees):' printf, u, '' printf, u, format = '(f12.6,a40)', illzen_deg, $ 'illumination zenith angle (theta_0)' printf, u, format = '(f12.6,a40)', obszen_deg, $ 'observation zenith angle (theta)' printf, u, format = '(f12.6,a40)', relazi_deg, $ 'relative azimuth angle (phi)' printf, u, '' printf, u, 'b) Physical input parameters:' printf, u, '' printf, u, format = '(f12.6,a40)', rhopar, $ 'amplitude of the BRF field (rho)' printf, u, format = '(f12.6,a40)', kpar, 'Minnaert parameter (k)' IF rpv_sel EQ 1 THEN BEGIN printf, u, format = '(f12.6,a40)', thetapar, $ 'asymmetry parameter (theta_HG)' ENDIF ELSE BEGIN printf, u, format = '(f12.6,a40)', thetapar, $ 'asymmetry parameter (b_M)' ENDELSE printf, u, format = '(f12.6,a40)', hspar, 'hotspot parameter (rho_HS)' printf, u, format = '(11x,i1,a40)', fix(hs_sel), $ 'hotspot use selected y/n (1/0)' printf, u, '' printf, u, 'c) Display parameters:' printf, u, '' printf, u, format = '(11x,i1,a40)', fix(stat_sel), $ 'BRF statistics selected y/n (1/0)' printf, u, format = '(11x,i1,a40)', fix(sens_sel), $ 'Sensor selected [0, 1, 2, 3, 4]' printf, u, format = '(a52)', $ '[None, ATSR, AVHRR/MODIS, MISR, SPECTRA]' printf, u, '---------------------------------------------------------' printf, u, '' IF stat_sel EQ 1b THEN BEGIN printf, u, '' printf, u, 'Statistics of the corresponding BRF field:' printf, u, $ '---------------------------------------------------------' printf, u, format = '(a12,a40)', strtrim(BRF_min, 2), 'minimum BRF' printf, u, format = '(a12,a40)', strtrim(BRF_min_th, 2), $ 'theta(minimum BRF)' printf, u, format = '(a12,a40)', strtrim(BRF_min_phi, 2), $ 'phi(minimum BRF)' printf, u, format = '(a12,a40)', strtrim(BRF_max, 2), $ 'maximum BRF' printf, u, format = '(a12,a40)', strtrim(BRF_max_th, 2), $ 'theta(maximum BRF)' printf, u, format = '(a12,a40)', strtrim(BRF_max_phi, 2), $ 'phi(maximum BRF)' printf, u, format = '(a12,a40)', strtrim(BRF_nad, 2), 'nadir BRF' printf, u, format = '(a12,a40)', strtrim(BRF_hot, 2), 'hotspot BRF' printf, u, format = '(a12,a40)', strtrim(alb, 2), $ 'hemispherical albedo' printf, u, $ '---------------------------------------------------------' printf, u, '' ;; calculate BRF matrix obszen_rad_old = obszen_rad & relazi_rad_old = relazi_rad brf_mat = fltarr(7, 6) phi_mat = [0, 30, 60, 90, 120, 150, 180] * !dtor Obs_mat = [0, 15, 30, 45, 60, 75] * !dtor FOR icol = 0, 6 DO BEGIN FOR ilin = 0, 5 DO BEGIN obszen_rad = obs_mat(ilin) & relazi_rad = phi_mat(icol) brf_mat(icol, ilin) = rahmanbrf() ENDFOR ENDFOR ;; reset to original values obszen_rad = obszen_rad_old & relazi_rad = relazi_rad_old printf, u, 'BRF = f(theta_0, physical input parameters)' printf, u, $ '---------------------------------------------------------' printf, u, ' relative azimuth angle phi' printf, u, $ 'theta 0.0 30.0 60.0 90.0 120.0 150.0 180.0' printf, u, format = '(a6,7f7.4)', ' 0.0 ', brf_mat( * , 0) printf, u, format = '(a6,7f7.4)', '15.0 ', brf_mat( * , 1) printf, u, format = '(a6,7f7.4)', '30.0 ', brf_mat( * , 2) printf, u, format = '(a6,7f7.4)', '45.0 ', brf_mat( * , 3) printf, u, format = '(a6,7f7.4)', '60.0 ', brf_mat( * , 4) printf, u, format = '(a6,7f7.4)', '75.0 ', brf_mat( * , 5) printf, u, $ '---------------------------------------------------------' printf, u, '' printf, u, 'NB: Modifying any values in this file may render' printf, u, ' the restore process useless. Use the GUI instead.' printf, u, ' ' ENDIF free_lun, u widget_control, w_info, set_value = 'Your dat-file has been saved.' END "exit": BEGIN widget_control, event.top, / destroy END "gif_col": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN img = tvread( / gif, / dialog) ENDELSE END "gif_bw": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN bw_sel = 1 & img = tvread( / gif, / dialog) ENDELSE END "png_col": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN img = tvread( / png, / dialog) ENDELSE END "png_bw": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN bw_sel = 1 & img = tvread( / png, / dialog) ENDELSE END "pict_col": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN img = tvread( / pict, / dialog) ENDELSE END "pict_bw": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN bw_sel = 1 & img = tvread( / pict, / dialog) ENDELSE END "jpg_col": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN img = tvread( / jpg, / dialog) ENDELSE END "jpg_bw": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN bw_sel = 1 & img = tvread( / jpg, / dialog) ENDELSE END "tif_col": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN img = tvread( / tiff, / dialog) ENDELSE END "tif_bw": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN bw_sel = 1 & img = tvread( / tiff, / dialog) ENDELSE END "bmp_col": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN img = tvread( / bmp, / dialog) ENDELSE END "bmp_bw": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN bw_sel = 1 & img = tvread( / bmp, / dialog) ENDELSE END "ps_col": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN call_procedure, 'plot_ps' ENDELSE END "ps_bw": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN bw_sel = 1 & call_procedure, 'plot_ps' & bw_sel = 0 ENDELSE END "eps_col": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN call_procedure, 'plot_ps', / encapsulate ENDELSE END "eps_bw": BEGIN res = lmgr( / demo) IF res EQ 1 THEN BEGIN result = $ dialog_message ('Feature not allowed in IDL Demo Mode.', $ / information) & GOTO, fin ENDIF ELSE BEGIN bw_sel = 1 & call_procedure, 'plot_ps', / encapsulate & bw_sel = 0 ENDELSE END ;; options ;;===================================== "xloadct": BEGIN xloadct, group = event.top, / block & !p.font = -1 & GOTO, show_it END "xpalette": BEGIN xpalette, group = event.top, / block & !p.font = -1 & GOTO, show_it END "rt_rpv": BEGIN tit = 'AnisView; BRF-model in use: RPV' widget_control, w_tlb, tlb_set_title = tit widget_control, w_rt_rpv, sensitive = 0 widget_control, w_rt_mrpv, sensitive = 1 thetapar_mrpv_old = thetapar IF thetapar_rpv_old GT - 5.0 THEN $ thetapar = thetapar_rpv_old ELSE thetapar = 0.0 widget_control, w_param_theta_hg, set_value = [thetapar, - 0.5, 0.5] widget_control, w_asym_label, $ set_value = 'Asymmetry parameter theta_HG:' tit = 'Select a type of graphical output or change the ' tit = tit + 'geometrical or physical settings.' widget_control, w_info, set_value = tit rpv_sel = 1 & new_stat = 1 GOTO, new_calc END "rt_mrpv": BEGIN tit = 'AnisView; BRF-model in use: MRPV' widget_control, w_tlb, tlb_set_title = tit ;; asymmetry parameter theta_hg now corresponds to b_m widget_control, w_rt_rpv, sensitive = 1 widget_control, w_rt_mrpv, sensitive = 0 thetapar_rpv_old = thetapar IF thetapar_mrpv_old GT - 5.0 THEN $ thetapar = thetapar_mrpv_old ELSE thetapar = 0.0 widget_control, w_param_theta_hg, set_value = [thetapar, - 1.5, 1.5] widget_control, w_asym_label, $ set_value = 'Asymmetry parameter b_M:' tit = 'Select a type of graphical output or change the ' tit = tit + 'geometrical or physical settings.' widget_control, w_info, set_value = tit rpv_sel = 0 & new_stat = 1 GOTO, new_calc END ;; help ;;====================================== "guide" : BEGIN cmd = acroread_exe + ' "' + AnisView_dir + 'AnisView_guide.pdf' + '"' CASE !version.Os_family OF 'Windows': BEGIN pushd, AnisView_dir spawn, 'start AnisView_guide.pdf',/ nowait popd END 'unix': BEGIN spawn, cmd + ' &' END ENDCASE END "physics" : BEGIN cmd = acroread_exe + ' "' + AnisView_dir + 'AnisView_physics.pdf' + '"' CASE !version.Os_family OF 'Windows': BEGIN pushd, AnisView_dir spawn, 'start AnisView_physics.pdf',/ nowait popd END 'unix': BEGIN spawn, cmd + ' &' END ENDCASE END 'homepage':BEGIN CASE !version.Os OF 'darwin': BEGIN spawn, 'open https://forest.jrc.ec.europa.eu/en/activities/lpa/anisview/' GOTO, fin END 'Win32': BEGIN spawn, 'start https://forest.jrc.ec.europa.eu/en/activities/lpa/anisview/',/hide GOTO, fin END 'linux': BEGIN ;; check for browser html_view = ['firefox', 'google-chrome', 'chrome', 'chromium', 'iceweasel', $ 'opera', 'mozilla', 'flock', 'galeon', 'dillo', 'epiphany', 'seamonkey'] nx = n_elements(html_view) & id = 0 html_again1: spawn, 'which ' + html_view(id) + ' 2>/dev/null', res & res = res(0) IF strmid(res, 0, 1) EQ '/' THEN BEGIN ;; application found html_exe = res & GOTO, htmlcont ENDIF ELSE BEGIN ;; application not found id = id + 1 ;; check the next application IF id LT nx THEN GOTO, html_again1 ELSE GOTO, htmlcont ENDELSE END ENDCASE htmlcont: ;; Linux IF strlen(html_exe) EQ 0 THEN BEGIN st = "No html-browser found. Please install Firefox or Google-Chrome." result = dialog_message(st, / information) GOTO, fin ENDIF ELSE BEGIN cmd = html_exe + ' https://forest.jrc.ec.europa.eu/en/activities/lpa/anisview/' spawn, cmd + ' &' ENDELSE END "license" : BEGIN cmd = acroread_exe + ' "' + AnisView_dir + 'EULA_AnisView.pdf' + '"' CASE !version.Os_family OF 'Windows': BEGIN pushd, AnisView_dir spawn, 'start EULA_AnisView.pdf',/ nowait popd END 'unix': BEGIN spawn, cmd + ' &' END ENDCASE END "changelog" : BEGIN xdisplayfile, AnisView_dir + 'changelog.txt', title = 'AnisView changelog: ', $ done_button = 'Close', / block, / modal END "about" : BEGIN result = $ dialog_message (title = 'About AnisView', / information, $ 'AnisView, Version 1.5, May 2021' + string(10b) + 'Copyright ' + $ string(169b) + ' 2021 Peter Vogt, Michel M. Verstraete' + $ string(10b) + ' ' + string(10b) + 'Latest version at:' + $ string(10b) + 'https://forest.jrc.ec.europa.eu/en/activities/lpa/anisview/' + string(10b) + $ string(10b) + 'Please send bug reports and suggestions to:' + $ string(10b) + 'Peter.Vogt@ec.europa.eu and MMVerstraete@gmail.com') END ;; graphical output events ;;-------------------------------------------------------------------------- ;; 0-D plot selected (geometry) ;;-------------------------------------------------------------------------- "hit_0d": BEGIN sel_out = 0 widget_control, w_lambert, sensitive = 0 widget_control, w_isotropic, sensitive = 0 widget_control, w_sensor0, sensitive = 0 widget_control, w_sensor1, sensitive = 0 widget_control, w_sensor2, sensitive = 0 widget_control, w_sensor3, sensitive = 0 widget_control, w_sensor4, sensitive = 0 widget_control, w_xpal, sensitive = 0 widget_control, w_col_tbl, sensitive = 0 widget_control, w_obs_zen, sensitive = 1 widget_control, w_rel_azi, sensitive = 1 widget_control, w_stat_sel, sensitive = 1 widget_control, w_param_rho, sensitive = 0 widget_control, w_param_k, sensitive = 0 widget_control, w_param_theta_hg, sensitive = 0 widget_control, w_asym_label, sensitive = 0 widget_control, w_param_hs, sensitive = 0 widget_control, w_hotspot, sensitive = 0 widget_control, w_info, set_value = $ 'Show the geometric conditions selected ' + $ 'on the right or select a different type of graphic output.' GOTO, new_calc END ;; 1-D plot selected ;;-------------------------------------------------------------------------- "hit_1d": BEGIN sel_out = 1 widget_control, w_lambert, sensitive = 1 widget_control, w_isotropic, sensitive = 1 widget_control, w_sensor0, sensitive = 0 widget_control, w_sensor1, sensitive = 0 widget_control, w_sensor2, sensitive = 0 widget_control, w_sensor3, sensitive = 0 widget_control, w_sensor4, sensitive = 0 widget_control, w_xpal, sensitive = 0 widget_control, w_col_tbl, sensitive = 0 widget_control, w_stat_sel, sensitive = 1 widget_control, w_param_rho, sensitive = 1 widget_control, w_param_k, sensitive = 1 widget_control, w_param_theta_hg, sensitive = 1 widget_control, w_asym_label, sensitive = 1 IF hs_sel EQ 0b THEN widget_control, w_param_hs, sensitive = 0 $ ELSE widget_control, w_param_hs, sensitive = 1 widget_control, w_hotspot, sensitive = 1 widget_control, w_info, set_value = $ 'Show the BRF for the geometric and ' + $ 'physical settings shown on the right.' GOTO, new_calc END ;; 2-D plot selected ;;-------------------------------------------------------------------------- "hit_2d_plane": BEGIN sel_out = 2 widget_control, w_lambert, sensitive = 1 widget_control, w_isotropic, sensitive = 1 widget_control, w_sensor0, sensitive = 1 widget_control, w_sensor1, sensitive = 1 widget_control, w_sensor2, sensitive = 1 widget_control, w_sensor3, sensitive = 1 widget_control, w_sensor4, sensitive = 1 widget_control, w_xpal, sensitive = 0 widget_control, w_col_tbl, sensitive = 0 widget_control, w_stat_sel, sensitive = 1 widget_control, w_param_rho, sensitive = 1 widget_control, w_param_k, sensitive = 1 widget_control, w_param_theta_hg, sensitive = 1 widget_control, w_asym_label, sensitive = 1 IF hs_sel EQ 0b THEN widget_control, w_param_hs, sensitive = 0 $ ELSE widget_control, w_param_hs, sensitive = 1 widget_control, w_hotspot, sensitive = 1 widget_control, w_info, set_value = $ 'Show the BRFs as a function of observation ' + $ 'zenith angle, along the specified azimuthal plane.' GOTO, new_calc END ;; 2-D contour plot selected ;;-------------------------------------------------------------------------- "hit_2d_cont": BEGIN sel_out = 3 widget_control, w_lambert, sensitive = 1 widget_control, w_isotropic, sensitive = 1 widget_control, w_sensor0, sensitive = 1 widget_control, w_sensor1, sensitive = 1 widget_control, w_sensor2, sensitive = 1 widget_control, w_sensor3, sensitive = 1 widget_control, w_sensor4, sensitive = 1 widget_control, w_xpal, sensitive = 1 widget_control, w_col_tbl, sensitive = 1 widget_control, w_stat_sel, sensitive = 1 widget_control, w_param_rho, sensitive = 1 widget_control, w_param_k, sensitive = 1 widget_control, w_param_theta_hg, sensitive = 1 widget_control, w_asym_label, sensitive = 1 IF hs_sel EQ 0b THEN widget_control, w_param_hs, sensitive = 0 $ ELSE widget_control, w_param_hs, sensitive = 1 widget_control, w_hotspot, sensitive = 1 widget_control, w_info, set_value = $ 'Show a contour diagram of the BRF field as a function of ' + $ 'both the observation zenith and the relative azimuth angles.' GOTO, new_calc END ;; 3-D rectangular plot selected ;;-------------------------------------------------------------------------- "hit_3d_rect": BEGIN sel_out = 4 widget_control, w_lambert, sensitive = 1 widget_control, w_isotropic, sensitive = 1 widget_control, w_sensor0, sensitive = 1 widget_control, w_sensor1, sensitive = 1 widget_control, w_sensor2, sensitive = 1 widget_control, w_sensor3, sensitive = 1 widget_control, w_sensor4, sensitive = 1 widget_control, w_xpal, sensitive = 1 widget_control, w_col_tbl, sensitive = 1 widget_control, w_stat_sel, sensitive = 1 widget_control, w_param_rho, sensitive = 1 widget_control, w_param_k, sensitive = 1 widget_control, w_param_theta_hg, sensitive = 1 widget_control, w_asym_label, sensitive = 1 IF hs_sel EQ 0b THEN widget_control, w_param_hs, sensitive = 0 $ ELSE widget_control, w_param_hs, sensitive = 1 widget_control, w_hotspot, sensitive = 1 widget_control, w_info, set_value = $ 'Show a rectangular diagram of the BRF field as a function of ' + $ 'both the observation zenith and the relative azimuth angles.' GOTO, new_calc END ;; 3-D polar plot selected ;;-------------------------------------------------------------------------- "hit_3d_pol": BEGIN sel_out = 5 widget_control, w_lambert, sensitive = 1 widget_control, w_isotropic, sensitive = 1 widget_control, w_sensor0, sensitive = 0 widget_control, w_sensor1, sensitive = 0 widget_control, w_sensor2, sensitive = 0 widget_control, w_sensor3, sensitive = 0 widget_control, w_sensor4, sensitive = 0 widget_control, w_xpal, sensitive = 1 widget_control, w_col_tbl, sensitive = 1 widget_control, w_stat_sel, sensitive = 1 widget_control, w_param_rho, sensitive = 1 widget_control, w_param_k, sensitive = 1 widget_control, w_param_theta_hg, sensitive = 1 widget_control, w_asym_label, sensitive = 1 IF hs_sel EQ 0b THEN widget_control, w_param_hs, sensitive = 0 $ ELSE widget_control, w_param_hs, sensitive = 1 widget_control, w_hotspot, sensitive = 1 widget_control, w_info, set_value = $ 'Show a polar diagram of the BRF field as a function of ' + $ 'both the observation zenith and the relative azimuth angles.' GOTO, new_calc END ;; display (or not) the statistics of the BRF field ;;-------------------------------------------------------------------------- "statistics": BEGIN stat_sel = (event.select EQ 1) IF stat_sel EQ 1b THEN BEGIN ;; list the statistics about the BRF field widget_control, / hourglass call_procedure, 'statistics' list = $ transpose([strtrim(BRF_min, 2), strtrim(BRF_min_th, 2), $ strtrim(BRF_min_phi, 2), strtrim(BRF_max, 2), $ strtrim(BRF_max_th, 2), strtrim(BRF_max_phi, 2), $ strtrim(BRF_nad, 2), strtrim(BRF_hot, 2), $ strtrim(alb, 2)]) widget_control, w_tabl, set_value = list GOTO, fin ENDIF ELSE BEGIN ;; set the statistics about the BRF field to 0.0 list = transpose(replicate (' --- ', 9)) widget_control, w_tabl, set_value = list GOTO, fin ENDELSE END ;; changing solar zenith ;;-------------------------------------------------------------------------- "ill_zen": BEGIN widget_control, event.id, get_value = illzen_deg illzen_rad = illzen_deg * !dtor widget_control, w_info, set_value = $ 'The illumination zenith angle is the acute angle between the ' + $ 'local vertical and the direction of the incoming radiation.' new_stat = 1 GOTO, new_calc END ;; changing observer zenith ;;-------------------------------------------------------------------------- "obs_zen": BEGIN widget_control, event.id, get_value = obszen_deg obszen_rad = obszen_deg * !dtor widget_control, w_info, set_value = $ 'The observation zenith angle is the acute angle between the ' + $ 'local vertical and the direction of the sensor.' GOTO, new_calc END ;; CHANGING RELATIVE AZIMUTH ;;-------------------------------------------------------------------------- "rel_azi": BEGIN widget_control, event.id, get_value = relazi_deg relazi_rad = relazi_deg * !dtor widget_control, w_info, set_value = $ 'The relative azimuth angle is the angle between the ' + $ 'azimuths of the illumination and observation directions.' GOTO, new_calc END ;; changing amplitude parameter rho ;;-------------------------------------------------------------------------- "rho_param": BEGIN widget_control, event.id, get_value = rhopar IF hs_sel EQ 0b THEN BEGIN widget_control, w_param_hs, sensitive = 0, set_value = rhopar ENDIF widget_control, w_info, set_value = $ 'The amplitude parameter rho controls the overall reflectance ' + $ 'level of the geophysical system.' new_stat = 1 GOTO, new_calc END ;; changing Minnaert parameter k ;;-------------------------------------------------------------------------- "k_param": BEGIN widget_control, event.id, get_value = kpar widget_control, w_info, set_value = $ 'The Minnaert parameter k controls the bowl (k<1) or bell (k>1) shape of ' + $ 'the reflectance of the geophysical system.' new_stat = 1 GOTO, new_calc END ;; changing asymmetry parameter theta ;;-------------------------------------------------------------------------- "theta_HG_param": BEGIN widget_control, event.id, get_value = thetapar IF rpv_sel EQ 1 THEN txt = 'theta_HG' ELSE txt = 'b_m' widget_control, w_info, set_value = $ 'The asymmetry parameter ' + txt + ' controls the preferentially forward (' + $ txt + '>0) or backward (' + txt + '<0) reflectance of the geophysical system.' new_stat = 1 GOTO, new_calc END ;; set value for hotspot parameter for RT-model in use ;;-------------------------------------------------------------------------- "hs_param": BEGIN widget_control, event.id, get_value = hspar IF rpv_sel EQ 0 THEN BEGIN ; MRPV model widget_control, w_info, set_value = $ 'The hotspot parameter rho_HS indicates the deviation ' + $ 'from an isotropic (rho_HS=1.0) BRF field' ENDIF ELSE BEGIN ; RPV model widget_control, w_info, set_value = $ 'The hotspot parameter rho_HS is an indicator for the ' + $ 'surface roughness of the geophysical system (default: rho_HS = rho, if not explicitly set).' ENDELSE new_stat = 1 GOTO, new_calc END ;; select/deselect use of hotspot parameter in RT-model ;;-------------------------------------------------------------------------- "hotspot": BEGIN hs_sel = (event.select EQ 1) ;; de-select use of rho_hs IF hs_sel EQ 0b THEN BEGIN widget_control, w_param_hs, get_value = hspar IF hspar eq rhopar THEN BEGIN ;; no new_calc required widget_control, w_param_hs, sensitive = 0 GOTO,fin ENDIF ELSE BEGIN ;; reset hspar and new_calc hspar = rhopar widget_control, w_param_hs, sensitive = 0, $ set_value = hspar new_stat = 1 GOTO, new_calc ENDELSE ;; select use of rho_hs ENDIF ELSE BEGIN IF rpv_sel EQ 0 THEN BEGIN ; MRPV model widget_control, w_info, set_value = $ 'The hotspot parameter rho_HS indicates the deviation ' + $ 'from an isotropic (rho_HS=1.0) BRF field' ENDIF ELSE BEGIN ; RPV model widget_control, w_info, set_value = $ 'The hotspot parameter rho_HS is an indicator for the ' + $ 'surface roughness of the geophysical system.' ENDELSE widget_control, w_param_hs, sensitive = 1, get_value = hspar ENDELSE GOTO, fin END ;; select use of initial parameter settings ;;-------------------------------------------------------------------------- "initial": BEGIN ;; initial settings: Geometry display, RPV, no statistics, no ;; hotspot, no sensor widget_control, w_ill_zen, set_value = 30 widget_control, w_obs_zen, set_value = 60 widget_control, w_rel_azi, set_value = 30 IF sel_out EQ 0 THEN sens = 0 ELSE sens = 1 stat_sel = 0b & hs_sel = 0b & sens_sel = 0b BRF_min = ' --- ' & BRF_min_th = ' --- ' & BRF_min_phi = ' --- ' BRF_max = ' --- ' & BRF_max_th = ' --- ' & BRF_max_phi = ' --- ' BRF_nad = ' --- ' & BRF_hot = ' --- ' & alb = ' --- ' list = $ transpose([BRF_min, BRF_min_th, BRF_min_phi, BRF_max, BRF_max_th, $ BRF_max_phi, BRF_nad, BRF_hot, alb]) widget_control, w_tabl, set_value = list widget_control, w_stat_sel, sensitive = 1, set_value = 0b widget_control, w_param_rho, sensitive = sens, set_value = 0.25 rhopar = 0.25 widget_control, w_param_k, sensitive = sens, set_value = 0.8 kpar = 0.8 widget_control, w_param_theta_hg, sensitive = sens, set_value = 0.0 thetapar = 0.0 widget_control, w_param_hs, sensitive = 0, set_value = 0.25 widget_control, w_hotspot, sensitive = sens, set_value = 0b widget_control, w_sensor0, sensitive = 1 widget_control, w_sensor1, sensitive = 0 widget_control, w_sensor2, sensitive = 0 widget_control, w_sensor3, sensitive = 0 widget_control, w_sensor4, sensitive = 0 widget_control, w_xpal, sensitive = 0 widget_control, w_col_tbl, sensitive = 0 sens_sel = 0 & loadct, 39 widget_control, w_info, set_value = $ "The initial settings have been restored." GOTO, new_calc END ;; select/deselect use of isotropic parameter settings ;;-------------------------------------------------------------------------- "isotropic": BEGIN widget_control, w_param_rho, get_value = rhopar widget_control, w_param_k, sensitive = 1, set_value = 1.0 & kpar = 1.0 widget_control, w_param_theta_hg, sensitive = sens, set_value = 0.0 thetapar = 0.0 widget_control, w_param_hs, sensitive = 1, set_value = 1.0 hspar = 1.0 widget_control, w_hotspot, sensitive = 1, set_value = 1b & hs_sel = 1b IF stat_sel EQ 1b THEN BEGIN BRF_min_th = 'arbitrary' & BRF_min_phi = BRF_min_th BRF_max_th = BRF_min_th & BRF_max_phi = BRF_min_th BRF_min = strtrim(rhopar, 2) & BRF_max = BRF_min BRF_nad = BRF_min & BRF_hot = BRF_min & alb = BRF_min list = $ transpose([BRF_min, BRF_min_th, BRF_min_phi, BRF_max, $ BRF_max_th, BRF_max_phi, BRF_nad, BRF_hot, alb]) widget_control, w_tabl, set_value = list ENDIF widget_control, w_info, set_value = $ "The isotropic settings have been applied." GOTO, new_calc END ;; select/deselect use of lambert parameter settings ;;-------------------------------------------------------------------------- "lambert": BEGIN widget_control, w_param_rho, set_value = 1.0 & rhopar = 1.0 widget_control, w_param_k, sensitive = 1, set_value = 1.0 & kpar = 1.0 widget_control, w_param_theta_hg, sensitive = sens, set_value = 0.0 thetapar = 0.0 widget_control, w_param_hs, sensitive = 1, set_value = 1.0 hspar = 1.0 widget_control, w_hotspot, sensitive = 1, set_value = 1b & hs_sel = 1b IF stat_sel EQ 1b THEN BEGIN BRF_min_th = 'arbitrary' & BRF_min_phi = BRF_min_th BRF_max_th = BRF_min_th & BRF_max_phi = BRF_min_th BRF_min = strtrim(rhopar, 2) & BRF_max = BRF_min BRF_nad = BRF_min & BRF_hot = BRF_min & alb = BRF_min list = $ transpose([BRF_min, BRF_min_th, BRF_min_phi, BRF_max, $ BRF_max_th, BRF_max_phi, BRF_nad, BRF_hot, alb]) widget_control, w_tabl, set_value = list ENDIF widget_control, w_info, set_value = $ "The Lambert settings have been applied." GOTO, new_calc END ;; select/deselect sensor ;;-------------------------------------------------------------------------- "sensor0": BEGIN sens_sel = 0 widget_control, w_info, set_value = $ "Sensor overlay disabled" GOTO, new_calc END "sensor1": BEGIN sens_sel = 1 widget_control, w_info, set_value = $ "ATSR directions of observation (diamonds)." GOTO, new_calc END "sensor2": BEGIN sens_sel = 2 widget_control, w_info, set_value = $ "AVHRR/MODIS directions of observation (diamonds)." GOTO, new_calc END "sensor3": BEGIN sens_sel = 3 widget_control, w_info, set_value = $ "MISR directions of observation (diamonds)." GOTO, new_calc END "sensor4": BEGIN sens_sel = 4 widget_control, w_info, set_value = $ "SPECTRA directions of observation (diamonds)." GOTO, new_calc END ENDCASE GOTO, fin ;; re-calculate the BRF field with the new settings ;;----------------------------------------------------------------------------- new_calc: widget_control, w_ill_zen, get_value = illzen_deg illzen_rad = illzen_deg * !dtor widget_control, w_obs_zen, get_value = obszen_deg obszen_rad = obszen_deg * !dtor widget_control, w_rel_azi, get_value = relazi_deg relazi_rad = relazi_deg * !dtor CASE sel_out OF 0: BEGIN call_procedure, "show_0" END 1: BEGIN call_procedure, "calc_1" END 2: BEGIN call_procedure, "calc_2_plane" END 3: BEGIN call_procedure, "calc_2_cont" END 4: BEGIN call_procedure, "calc_3_rect" END 5: BEGIN call_procedure, "calc_3_pol" END ELSE: BEGIN ENDELSE ENDCASE IF new_stat EQ 1 and stat_sel EQ 1b THEN BEGIN ;; reflect new settings in statistics about the BRF field widget_control, / hourglass call_procedure, 'statistics' list = $ transpose([strtrim(BRF_min, 2), strtrim(BRF_min_th, 2), $ strtrim(BRF_min_phi, 2), strtrim(BRF_max, 2), $ strtrim(BRF_max_th, 2), strtrim(BRF_max_phi, 2), $ strtrim(BRF_nad, 2), strtrim(BRF_hot, 2), $ strtrim(alb, 2)]) widget_control, w_tabl, set_value = list ENDIF GOTO, fin ;; display the same BRF field with the new settings; this requires no ;; new calculation ;;----------------------------------------------------------------------------- show_it: CASE sel_out OF 0: BEGIN widget_control, / hourglass call_procedure, "show_0" END 1: BEGIN widget_control, / hourglass call_procedure, "show_1" END 2: BEGIN widget_control, / hourglass call_procedure, "show_2_plane" END 3: BEGIN widget_control, / hourglass call_procedure, "show_2_cont", 1 END 4: BEGIN widget_control, / hourglass call_procedure, "show_3_rect" END 5: BEGIN widget_control, / hourglass call_procedure, "show_3_pol", 1 END ELSE: BEGIN ENDELSE ENDCASE GOTO, fin fin: END ;;***************************************************************************** ;;***************************************************************************** ;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;; ;; M A I N M O D U L E ( D E F I N E W I D G E T S) ;; ;;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;;***************************************************************************** ;;***************************************************************************** PRO AnisView, group = group ;;***************************************************************************** ;; widget hierachy: ;;- Top level base (tlb) widget with menu bar ;;- menu widgets ;;- main widgets in GUI set up in three (3) rows. ;; Row 1 = display ;; Row 2 = information ;; Row 3 = copyright ;; ;; Row 1 is subdivided in 3 major columns, each containing a set of ;; boxes defined as: ;; ;; LEFT COLUMN ;; -> GUI_left: w_visual ;; -> GUI_left_box_1: w_123d: graphic output selection box ;; -> GUI_left_box_2: w_stats: BRF field statistics box ;; ;; CENTER COLUMN ;; -> GUI_center: w_exhibit ;; -> GUI_center_box_1: w_draw: final graphic result box ;; -> GUI_center_box_2: w_rdpx: readout of geometry & BRF in 2-D contour ;; ;; RIGHT COLUMN ;; -> GUI_right: w_science ;; -> GUI_right_box_1: w_geometry: geometric variables box ;; -> GUI_right_box_2: w_physics: physical variables box ;; ;;***************************************************************************** ;; declare a COMMON block to hold the widget ids of the widgets that ;; need to be controlled by other widgets, the window number of the ;; draw widget, and the type of output desired: COMMON Widget_ids, w_0d, w_1d, w_2d_plane, w_2d_cont, w_3d_rect, $ w_3d_pol, w_draw, w_tlb, win_num, my_device, sel_out, stat_sel, $ hs_sel, sens_sel, pxim, pyim, w_ill_zen, w_obs_zen, bw_sel, $ w_rel_azi, w_tabl, w_stat_sel, w_info, w_asym_label, rpv_sel, $ w_param_rho, w_param_k, w_param_theta_hg, w_param_hs, w_hotspot, $ w_rdpx, w_initial, w_lambert, w_isotropic, w_sensor1, w_sensor2, $ w_sensor3, w_sensor4, w_sensor0, w_rt_rpv, w_rt_mrpv, w_xpal, w_col_tbl COMMON Oldtheta, thetapar_mrpv_old, thetapar_rpv_old, outside, $ outside_p, epsilon COMMON Stats, BRF_min, BRF_min_th, BRF_min_phi, $ BRF_max, BRF_max_th, BRF_max_phi, BRF_nad, BRF_hot, alb ;; declare a COMMON block to hold the values of the angular and ;; physical variables obtained from the widgets (initial or ;; user-selected values): COMMON Vars_params, illzen_deg, illzen_rad, obszen_deg, obszen_rad, $ relazi_deg, relazi_rad, rhopar, kpar, thetapar, hspar ;; declare a COMMON block to hold the output data derived from the routine COMMON Output, obs_deg, rel_deg, brf, image, acroread_exe, AnisView_dir ;; Only one copy of the RPV tool can run at a time, so check for other ;; copies: IF (xregistered("AnisView") NE 0) THEN BEGIN print, 'Please close your previous application before running a new one' return ENDIF VERSION = WIDGET_INFO( / VERSION) ;; test on widget availability, current device name IF (STRPOS(VERSION.STYLE, 'Windows') NE - 1) THEN my_device = 'WIN' $ ELSE IF (STRPOS(VERSION.STYLE, 'Motif') NE - 1) THEN my_device = 'X' $ ELSE IF (!D.Flags and 65536) EQ 0 THEN BEGIN print, 'you can not use this code because your current device ' + $ 'does not support widgets' print, 'check your device using "print,!D"' print, 'try "device,/close" and reset your device to ' print, 'either set_plot,"X", set_plot,"WIN"' widget_control, event.top, / destroy return ENDIF ;; get screen size and set space between boxes device, get_screen_size = scrsiz siz_disp = 0.4 * scrsiz(0) space = 5 ;;***************************************************************************** ;;*** TOP LEVEL BASE (TLB) WIDGET WITH MENU BAR ******************************* ;;***************************************************************************** w_tlb = $ widget_base (title = 'AnisView; BRF-model in use: RPV', $ mbar = w_menu, / column) ;;***************************************************************************** ;;*** MENU WIDGETS IN TLB WIDGET ********************************************** ;;***************************************************************************** ;;----------------------------------------------------------------------------- ;;---------------------------- the file menu ---------------------------------- ;;----------------------------------------------------------------------------- w_file = $ widget_button (w_menu, value = 'File', / menu) w_save_as_dat = $ widget_button (w_file, value = 'Save data', / menu) w_save_as_dat_sav = $ widget_button (w_save_as_dat, value = 'IDL.sav-file', uvalue = 'sav') w_save_as_dat_ascii = $ widget_button (w_save_as_dat, value = 'ASCII-file', uvalue = 'ascii') w_save_as_im = $ widget_button (w_file, value = 'Save image', / menu) w_im_col= $ widget_button (w_save_as_im, value = 'color', / menu) w_im_bw= $ widget_button (w_save_as_im, value = 'b/w', / menu) thisVersion = float(!Version.Release) IF thisVersion LT 5.4 THEN BEGIN ;; check for availability of gif-files w_im_col_gif = $ widget_button (w_im_col, value = 'gif-file', uvalue = 'gif_col') w_im_bw_gif = $ widget_button (w_im_bw, value = 'gif-file', uvalue = 'gif_bw') ENDIF w_im_col_png = $ widget_button (w_im_col, value = 'png-file', uvalue = 'png_col') w_im_bw_png = $ widget_button (w_im_bw, value = 'png-file', uvalue = 'png_bw') w_im_col_pict = $ widget_button (w_im_col, value = 'pict-file', uvalue = 'pict_col') w_im_bw_pict = $ widget_button (w_im_bw, value = 'pict-file', uvalue = 'pict_bw') w_im_col_tif = $ widget_button (w_im_col, value = 'tif-file', uvalue = 'tif_col') w_im_bw_tif = $ widget_button (w_im_bw, value = 'tif-file', uvalue = 'tif_bw') w_im_col_bmp = $ widget_button (w_im_col, value = 'bmp-file', uvalue = 'bmp_col') w_im_bw_bmp = $ widget_button (w_im_bw, value = 'bmp-file', uvalue = 'bmp_bw') w_im_col_ps = $ widget_button (w_im_col, value = 'ps-file', uvalue = 'ps_col') w_im_bw_ps = $ widget_button (w_im_bw, value = 'ps-file', uvalue = 'ps_bw') w_im_col_eps = $ widget_button (w_im_col, value = 'eps-file', uvalue = 'eps_col') w_im_bw_eps = $ widget_button (w_im_bw, value = 'eps-file', uvalue = 'eps_bw') w_open = $ widget_button (w_file, value = 'Restore data', / menu) w_open_idl = $ widget_button (w_open, value = 'IDL.sav-file', uvalue = 'open_sav') w_open_ascii = $ widget_button (w_open, value = 'ASCII-file', uvalue = 'open_ascii') w_exit = $ widget_button (w_file, / separator, value = 'Exit', uvalue = 'exit') ;;----------------------------------------------------------------------------- ;;---------------------------- the options menu ------------------------------- ;;----------------------------------------------------------------------------- w_options = $ widget_button (w_menu, value = 'Options', / menu) w_col_tbl = $ widget_button (w_options, value = 'Xloadct', uvalue = 'xloadct') w_xpal = $ widget_button (w_options, value = 'Xpalette', uvalue = 'xpalette') w_rt_model = $ widget_button (w_options, value = 'RT-model', / menu) w_rt_rpv = $ widget_button (w_rt_model, value = 'RPV', uvalue = 'rt_rpv') w_rt_mrpv = $ widget_button (w_rt_model, value = 'MRPV', uvalue = 'rt_mrpv') w_platform = $ widget_button (w_options, value = 'Sensor', / menu) w_sensor0 = $ widget_button (w_platform, value = 'None', uvalue = 'sensor0') w_sensor1 = $ widget_button (w_platform, value = 'ATSR', uvalue = 'sensor1') w_sensor2 = $ widget_button (w_platform, value = 'AVHRR/MODIS', uvalue = 'sensor2') w_sensor3 = $ widget_button (w_platform, value = 'MISR', uvalue = 'sensor3') w_sensor4 = $ widget_button (w_platform, value = 'SPECTRA', uvalue = 'sensor4') ;;----------------------------------------------------------------------------- ;;--------------------------- the settings menu ------------------------------- ;;----------------------------------------------------------------------------- w_settings = $ widget_button (w_menu, value = 'Settings', / menu) w_initial = $ widget_button (w_settings, value = 'Initial settings', uvalue = 'initial') w_isotropic = $ widget_button (w_settings, value = 'Isotropic settings', $ uvalue = 'isotropic') w_lambert = $ widget_button (w_settings, value = 'Lambert settings', uvalue = 'lambert') ;;----------------------------------------------------------------------------- ;;--------------------------- the help menu ----------------------------------- ;;----------------------------------------------------------------------------- w_help = $ widget_button (w_menu, value = 'Help', / help, / menu) w_help1 = $ widget_button (w_help, value = 'User Guide', uvalue = 'guide') w_help2 = $ widget_button (w_help, value = 'Physics', uvalue = 'physics') w_help3 = $ widget_button (w_help, / separator, value = 'Homepage', $ uvalue = 'homepage') w_help4 = $ widget_button (w_help, value = 'License', uvalue = 'license') w_help41 = $ widget_button (w_help, value = 'Changelog', uvalue = 'changelog') w_help5 = $ widget_button (w_help, value = 'About AnisView', uvalue = 'about') ;;***************************************************************************** ;;*** END OF MENU WIDGETS ***************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;*** SETUP OF MAIN WIDGETS IN TLB WIDGET ************************************* ;;***************************************************************************** w_display = $ widget_base (w_tlb, / row) ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;; ROW 1, LEFT COLUMN ;;***************************************************************************** ;;----------------------------------------------------------------------------- ;;------ GUI_left: w_visual --------------------------------------------------- ;;----------------------------------------------------------------------------- w_visual = $ widget_base (w_display, / column, / frame, space = space) ;;----------------------------------------------------------------------------- ;;------ GUI_left_box_1: w_123d: (graphic output selection box ) -------------- ;;----------------------------------------------------------------------------- w_123d = $ widget_base (w_visual, / column, / frame) w_dim_type = $ widget_label (w_123d, / align_center, value = 'Type of graphic output:') ;; exclusive base just for holding the radio buttons: w_123d_excl = $ widget_base (w_123d, / column, / exclusive) ;; geometry options in the graphic output box: w_0d = $ widget_button (w_123d_excl, / align_left, value = 'Geometry', $ uvalue = 'hit_0d', / no_release) w_1d = $ widget_button (w_123d_excl, / align_left, value = 'Single BRF value', $ uvalue = 'hit_1d', / no_release) w_2d_plane = $ widget_button (w_123d_excl, / align_left, value = '2-D plot', $ uvalue = 'hit_2d_plane', / no_release) w_2d_cont = $ widget_button (w_123d_excl, / align_left, value = '2-D contour plot', $ uvalue = 'hit_2d_cont', / no_release) w_3d_rect = $ widget_button (w_123d_excl, / align_left, value = '3-D rectangular plot', $ uvalue = 'hit_3d_rect', / no_release) w_3d_pol = $ widget_button (w_123d_excl, / align_left, value = '3-D polar plot', $ uvalue = 'hit_3d_pol', / no_release) ;;----------------------------------------------------------------------------- ;;------ GUI_left_box_2: w_stats: (BRF field statistics box) ------------------ ;;----------------------------------------------------------------------------- w_space = $ widget_base(w_visual, / column, space = space) ;; label of the statistic box: w_stats = $ widget_base (w_visual, / column, / frame) ;; label of the statistic box: w_stats_label = $ widget_label (w_stats, / align_center, value = "Statistics of the BRF field:") w_tabl = $ widget_table(w_stats, xsize = 1, ysize = 9, value = transpose(strarr(9)), $ row_labels = ['min', 'theta(min)', 'phi(min)', 'max', $ 'theta(max)', 'phi(max)', 'nadir', 'hotspot', $ 'albedo'], column_labels = ['value']) w_stat_sel = $ CW_BGROUP(w_stats, 'Calculate statistics', / NONEXCLUSIVE, $ uvalue = 'statistics') ;;***************************************************************************** ;; END OF ROW 1, LEFT COLUMN ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;; ROW 1, CENTER COLUMN ;;***************************************************************************** ;;----------------------------------------------------------------------------- ;;------ GUI_center: w_exhibit ------------------------------------------------ ;;----------------------------------------------------------------------------- w_exhibit = $ widget_base (w_display, / column, / frame, space = space) ;;----------------------------------------------------------------------------- ;;------ GUI_center_box_1: w_draw: final graphic result box ------------------- ;;----------------------------------------------------------------------------- w_draw = $ widget_draw (w_exhibit, $ retain = 2, color_model = 1, colors = 256, $ / button_events, / motion_events, uvalue = 'draw', $ xsize = siz_disp, ysize = siz_disp) ;;----------------------------------------------------------------------------- ;;------ GUI_center_box_2: w_rdpx: readout of geometry & BRF ;; in 2-D contourfinal graphic result box -------- ;;----------------------------------------------------------------------------- ;; insert an empty buffer widget to make some space for the readpix ;; label which can hardly be seen when running on Motif IF my_device NE 'WIN' THEN BEGIN w_buffer = $ widget_label(w_exhibit, / align_center, xsize = siz_disp, ysize = 40, $ value = '') ENDIF w_rdpx = $ widget_label (w_exhibit, / align_center, xsize = siz_disp, ysize = 40, $ value = '') ;;***************************************************************************** ;; END OF ROW 1, CENTER COLUMN ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;; ROW 1, RIGHT COLUMN ;;***************************************************************************** ;;----------------------------------------------------------------------------- ;;------ GUI_right: w_science ------------------------------------------------- ;;----------------------------------------------------------------------------- w_science = $ widget_base (w_display, / column, / frame, space = space) ;;----------------------------------------------------------------------------- ;;------ GUI_right_box_1: w_geometry: geometric variables box ----------------- ;;----------------------------------------------------------------------------- w_geometry = $ widget_base (w_science, / column, / frame, space = space) w_geo_label = $ widget_label (w_geometry, / align_center, $ value = 'Geometrical input parameters:') ;; sliders for geometry and initial values: w_ill_zen = $ widget_slider (w_geometry, minimum = 0, maximum = 80, $ title = "Illumination zenith angle, theta_0 [" + string(176b) + "]", $ value = 30, uvalue = 'ill_zen') illzen_deg = 30 & illzen_rad = illzen_deg * !dtor w_obs_zen = $ widget_slider (w_geometry, minimum = 0, maximum = 80, $ title = "Observation zenith angle, theta [" + string(176b) + "]", $ value = 60, uvalue = 'obs_zen') obszen_deg = 60 & obszen_rad = obszen_deg * !dtor w_rel_azi = $ widget_slider (w_geometry, minimum = 0, maximum = 180, $ title = "Relative azimuth angle, phi [" + string(176b) + "]", $ value = 30, uvalue = 'rel_azi') relazi_deg = 30 & relazi_rad = relazi_deg * !dtor ;;----------------------------------------------------------------------------- ;;------ GUI_right_box_2: w_physics: physical variables box ------------------- ;;----------------------------------------------------------------------------- w_space = $ widget_base(w_science, / column, space = space) w_phys = $ widget_base (w_science, / column, / frame, space = space) w_phys_label = $ widget_label (w_phys, / align_center, $ value = 'Physical input parameters:') w_phys2 = $ widget_base (w_phys, / column) w_physics = $ widget_base (w_phys2, / column, space = space) ;; sliders for physics and initial values: w_space = $ widget_base(w_physics, / column, space = space) w_param_rho = $ cw_fslider (w_physics, minimum = 0.0, maximum = 1.0, xsize = 150, / edit, $ title = "Amplitude parameter rho", $ value = 0.25, uvalue = 'rho_param') rhopar = 0.25 w_space = $ widget_base(w_physics, / column, space = space) w_param_k = $ cw_fslider (w_physics, minimum = 0.2, maximum = 1.8, xsize = 150, / edit, $ title = "Minnaert parameter k", $ value = 0.8, uvalue = 'k_param') kpar = 0.8 ;; defining extra widget to insert param_HG, this is required because ;; the title of the widget is depending on the RT-model in use and can ;; thus not be set with cw_fslider w_space = $ widget_base(w_physics, / column, space = space) w_param_theta_hg = $ cw_fslider (w_physics, minimum = - 0.5, maximum = 0.5, xsize = 150, $ / edit, value = 0.0, uvalue = 'theta_HG_param') thetapar = 0.0 ;; label of asymmetry parameter widget: ;; this is done seperately to be able to change the title when using MRPV w_asym_label = $ widget_label (w_param_theta_hg, / align_left, $ value = 'Asymmetry parameter theta_HG') w_space = $ widget_base(w_physics, / column, space = space) w_param_hs = $ cw_fslider (w_physics, minimum = 0.0, maximum = 1.0, xsize = 150, / edit, $ title = "Hotspot parameter rho_HS", $ value = rhopar, uvalue = 'hs_param') hspar = rhopar w_hotspot = $ CW_BGROUP(w_physics, 'Modify hotspot parameter', / NONEXCLUSIVE, $ uvalue = 'hotspot') ;;***************************************************************************** ;; END OF ROW 1, CENTER COLUMN ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;; ROW 2, INFORMATION WIDGET IN TLB WIDGET ;;***************************************************************************** w_info = $ widget_text (w_tlb, value = 'Show the geometric conditions selected on' + $ ' the right or select a different type of graphic output.', $ / frame) ;;***************************************************************************** ;; END OF ROW 2 ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;; ROW 3, COPYRIGHT WIDGET IN TLB WIDGET ;;***************************************************************************** w_copyright = $ widget_label (w_tlb, / align_center, value = 'Copyright ' + $ string(169b) + ' 2021 Peter Vogt, Michel M. Verstraete') ;;***************************************************************************** ;; END OF ROW 3 ;;***************************************************************************** ;;***************************************************************************** ;;***************************************************************************** ;;END OF SETUP OF MAIN WIDGETS IN TLB WIDGET, ALL WIDGETS ARE NOW DEFINED ;;***************************************************************************** ;; initial settings: Geometry display, RPV, no statistics, no hotspot sel_out = 0 & rpv_sel = 1 & stat_sel = 0b & hs_sel = 0b & sens_sel = 0 BRF_min = ' --- ' & BRF_min_th = ' --- ' & BRF_min_phi = ' --- ' BRF_max = ' --- ' & BRF_max_th = ' --- ' & BRF_max_phi = ' --- ' BRF_nad = ' --- ' & BRF_hot = ' --- ' & alb = ' --- ' list = transpose([BRF_min, BRF_min_th, BRF_min_phi, BRF_max, BRF_max_th, $ BRF_max_phi, BRF_nad, BRF_hot, alb]) thetapar_mrpv_old = - 5.0 & thetapar_rpv_old = - 5.0 & bw_sel = 0 outside = - 5.0 & outside_p = -5.0 & epsilon = 0.0000001 & AnisView_dir = '' widget_control, w_tabl, set_value = list widget_control, w_stat_sel, sensitive = 1 widget_control, w_param_rho, sensitive = 0 widget_control, w_param_k, sensitive = 0 widget_control, w_param_theta_hg, sensitive = 0 widget_control, w_asym_label, sensitive = 0 widget_control, w_param_hs, sensitive = 0 widget_control, w_hotspot, sensitive = 0, set_value = hs_sel widget_control, w_initial, sensitive = 1 widget_control, w_lambert, sensitive = 0 widget_control, w_isotropic, sensitive = 0 widget_control, w_rt_rpv, sensitive = 0 widget_control, w_sensor0, sensitive = 1 widget_control, w_sensor1, sensitive = 0 widget_control, w_sensor2, sensitive = 0 widget_control, w_sensor3, sensitive = 0 widget_control, w_sensor4, sensitive = 0 widget_control, w_xpal, sensitive = 0 widget_control, w_col_tbl, sensitive = 0 widget_control, w_0d, / set_button ;;============================================================================= IF !version.os EQ 'linux' THEN BEGIN ; test on availability of TrueColor mode for the local display spawn, 'xdpyinfo', res q = strpos(res, 'TrueColor') & q = where(q NE - 1, ct) IF ct GT 0 THEN device, true_color = 24 ENDIF device, retain = 2, decomposed = 0 & loadct, 39 ;; read or set the path to the AnisView installation directory ;;============================================================================= AVversion = 1.4 & acroread_exe = '' cd, current = current & AnisView_dir = current + path_sep() my_os = !version.os IF !version.os_family EQ 'Windows' THEN my_os = 'windows' IF my_os EQ 'darwin' THEN my_os = 'apple' CASE my_os OF 'windows': BEGIN acroread_exe = 'start' close, 1 & openw,1, AnisView_dir + 'IDLVM\save_add\AVversion.txt' & printf,1,format='(f5.3)', AVversion & close,1 GOTO, inst_chk END 'linux': BEGIN close, 1 & openw,1, AnisView_dir + 'idl/AVversion.txt' & printf,1,format='(f5.3)', AVversion & close,1 ;; test for pdf-viewer applications, first by xdg, if that does not work then use a list of apps spawn, 'unset LD_LIBRARY_PATH; which xdg-mime 2>/dev/null', res & res = res[0] IF strmid(res, 0, 1) EQ '/' THEN BEGIN ;; xdg-mime found spawn, 'unset LD_LIBRARY_PATH; xdg-mime query default application/pdf', res & res = res[0] if strlen(res) gt 0 then begin ;; association found, take off the .desktop res=(strsplit(res, '.',/extract))[0] ;; test if it actually works spawn, 'unset LD_LIBRARY_PATH; which '+ res + ' 2>/dev/null', res2 & res2 = res2[0] IF strmid(res2, 0, 1) EQ '/' THEN BEGIN ;; application found acroread_exe = res2 GOTO, inst_chk ENDIF endif ENDIF ;; path to any pdf-file application pdf_view = ['acroread', 'okular', 'kghostview', 'kpdf', 'xpdf', 'mupdf', $ 'FoxitReader', 'evince', 'epdfview', 'gpdf', 'gv', 'ggv', 'atril'] res = '' FOR id = 0, n_elements(pdf_view) - 1 DO BEGIN spawn, 'unset LD_LIBRARY_PATH; which ' + pdf_view(id) + ' 2>&1',res & res=res[0] IF strmid(res, 0, 1) EQ '/' THEN BEGIN acroread_exe = res & GOTO, inst_chk ENDIF ENDFOR msg='No pdf-reader found. Please install any of: ' + string(10b) + $ 'acroread, okular, kghostview, kpdf, xpdf, mupdf' + string(10b) + $ 'FoxitReader, evince, epdfview, gpdf, gv, ggv, atril' + string(10b) + $ 'or let me know which different pdf-reader you use!' + string(10b) + 'Exiting...' result = dialog_message(st, / information) & GOTO, inst_chk END 'apple': BEGIN close, 1 & openw,1, AnisView_dir + 'save_add\AVversion.txt' & printf,1,format='(f5.3)', AVversion & close,1 acroread_exe = 'open ' GOTO, inst_chk END ENDCASE inst_chk: res = lmgr( / demo) IF res EQ 1 THEN res = $ dialog_message ('Note: IDL Demo Mode does not allow saving files', $ / information) ;;============================================================================= ;; center the widget hierarchy on the screen in x-direction only and ;; realize it wsize = widget_info(w_tlb, / geometry) xoff = (scrsiz(0) - wsize.scr_xsize) / 2. widget_control, w_tlb, xoffset = xoff, / realize ;; get the window number from the draw widget. this can only be done ;; after the widget has been realized: widget_control, w_draw, get_value = win_num wset, win_num ;; display initial setting as outlined above call_procedure, "show_0" ;; start the widget manager xmanager, 'AnisView', w_tlb, event_handler = 'AnisView_event', $ group_leader = groupLeader, / no_block fin: END ;;***************************************************************************** ;;*****************************************************************************