PRO Plot_map, dat
IF N_ELEMENTS (dat) EQ 0 THEN BEGIN
PRINT, '@(#)plot_map.pro 1.1: An input parameter must be specified'
RETURN
ENDIF
IF data_type (dat) NE 8 THEN BEGIN
PRINT, '@(#)plot_map.pro 1.1: The input parameter must be structure'
RETURN
ENDIF
dat_tags = TAG_NAMES (dat)
IF (WHERE (dat_tags EQ 'THETA')) (0) EQ -1 OR $
(WHERE (dat_tags EQ 'DTHETA')) (0) EQ -1 OR $
(WHERE (dat_tags EQ 'PHI')) (0) EQ -1 OR $
(WHERE (dat_tags EQ 'DPHI')) (0) EQ -1 OR $
(WHERE (dat_tags EQ 'PROJECT_NAME')) (0) EQ -1 OR $
(WHERE (dat_tags EQ 'DATA_NAME')) (0) EQ -1 $
THEN BEGIN
PRINT, "@(#)plot_map.pro 1.1: The input structure doesn't contain the necessary tags:"
PRINT, ' PHI, DPHI, THETA, DTHETA and DATA_NAME to draw the map'
RETURN
ENDIF
minphi = dat.phi(0, *) - dat.dphi/2.
maxphi = dat.phi(0, *) + dat.dphi/2.
mintheta = dat.theta(0, *) - dat.dtheta/2.
maxtheta = dat.theta(0, *) + dat.dtheta/2.
minx = MIN (minphi)
maxx = MAX (maxphi)
miny = MIN (mintheta)
maxy = MAX (maxtheta)
plotstart = 1
FOR i = 0, N_ELEMENTS(dat.theta(0, *))-1 DO BEGIN
IF plotstart THEN BEGIN
plotstart = 0
PLOT, TITLE = 'Angle Map of: ' + dat.project_name + ', ' $
+ dat.data_name, $
XTITLE = 'Phi (degrees)', $
YTITLE = 'Theta (degrees)', $
LINESTYLE = 3, $
XRANGE = [minx, maxx], YRANGE = [miny, maxy], $
XSTYLE = 1, YSTYLE = 1, $
[minphi(i), maxphi(i), maxphi(i), minphi(i)], $
[mintheta(i), mintheta(i), maxtheta(i), maxtheta(i)]
ENDIF ELSE BEGIN
OPLOT, $
LINESTYLE = 3, $
[minphi(i), maxphi(i), maxphi(i), minphi(i)], $
[mintheta(i), mintheta(i), maxtheta(i), maxtheta(i)]
ENDELSE
XYOUTS, ALIGN = 1.0, (minphi(i) + maxphi(i))/2., $
(mintheta(i) + maxtheta(i))/2., string(i)
ENDFOR
END