pro IPSday, path=path, hammer=hammer, movie=movie, maxelo=maxelo @compile_opt.pro ; On error, return to caller ;+ ; NAME: ; IPSday ; PURPOSE: ; Display Cambridge IPS data (one day) in fish-eye format ; or in Hammer-Aitoff projection. ; CALLING SEQUENCE: ; IPSday, /hammer ; INPUTS: ; Hammer if set and nonzero, a Hammer-Aitoff projection is used ; instead of the standard fish-eye view ; CALLS: ; SetFileSpec, GetFileSpec, checkdir, gridgen ; flt_read, read_gg, TimeSet, TimeGST, CvSky, NewcombSun, ; sfloat, PA_pole, resetcolors, PlotEarthSkymap, HammerAitoff, view ; RESTRICTIONS: ; Unedited data files are read using the Fortran subroutine Read_GG. ; This module is called by call_external. The logical EXEIDL should be ; assigned to the executable file for Read_GG. (The logical is best ; defined in your login file; the executable can be created by the ; command procedure X$COM:IDLEXE.COM). ; PROCEDURE: ; > The procedure can be run in 'single file' mode and 'movie' mode. ; In 'single file' user is prompted for a single modified Julian day. ; In 'movie' mode a range of days should be specified. ; > User prompts: ; - data directory (is used to set logical X$DATA) ; - movie, or single file mode ; - modified Julian day , or range of modified Julian days ; - edited or unedited data files ; > Unedited data files are identified by the name 'Gxxxxx.' (where xxxxx ; stands for the 5-digit modified Julian day (these are the original ; Cambridge files in hex format) ; > Edited data files are identified by the name 'Exxxxx.DAT', (xxxxx is ; again the modified Julian day). These data files are created with the ; editing program IPSedit. ; MODIFICATION HISTORY: ; SEP-1992, Tom Davidson, Paul Hick (UCSD) ; JUL-1993, Paul Hick (UCSD); merged Tom's IPSHAM program for ; Hammer-Aitoff projections with this one ;- ; Works only for !TheTerminal and Z device if !D.name eq !ThePrinter then $ message, 'does not work for !D.name ='+!D.name hammer = keyword_set(hammer) movie = keyword_set(movie ) if n_elements(maxelo) eq 0 then maxelo = 110 if n_elements(path) eq 0 then $ path = filepath(root=getenv('SSW_SMEI_DAT'),subdir='cambridge','') if not checkdir(path, full_path, /stay) then $ message, 'invalid directory: '+path Nt = 72 ; # times Xt = gridgen(Nt, /open, range=1d0) ; UT times (days) marking centers of time bins Dec = [-7.8,1.9,9.8,16.9,23.4,29.5,35.4,41.0,46.6,52.1,57.7,63.2,68.9,74.8] ; Range of declinations of observations TopDec = 82. ; Phony declination to mark top of plot Yd = [Dec,TopDec] ; declinations set_plot, 'Z message, /info, 'Defining Z buffer device, set_colors=256, set_resolution=[600,600] message, /info, 'Z buffer resolution : '+strjoin(strcompress([!d.x_size,!d.y_size],/remove_all),' by ') while 1 do begin file = dialog_pickfile(path=full_path, /multiple_files) if file[0] eq '' then return count = n_elements(file) movie = count gt 1 file = file[sort(file)] SetFileSpec, file name = strlowcase(GetFileSpec(part='name')) for ii=0, count-1 do begin ; Loop over all days mjd = round( sfloat(name[ii]) ) edt = (where( strmid(name[ii],0,1) eq ['g','e'] ))[0] case edt of ; Read file 0: status = call_external('EXEIDL','read_gg', mjd,iok,xg) 1: iok = flt_read(file, xg, atleast=n_elements(dec)) endcase if iok then begin ; If file succesfully read if edt then xg = transpose(xg) mjd1 = mjd+0.5d0 T = TimeSet(mjd1=mjd1+Xt); Times (0 to 24h UT) in 20 min steps pa = TimeGST(T, /degrees) ; RA of Greenwich meridian at time T ; Get right ascension, declination (equatorial coordinates) and ecliptic ; longitude of the Sun at noon. T = TimeSet(mjd1=mjd1+mean(Xt)) ; Noon Sun = NewcombSun(T, /longitude, /latitude, /degrees) ; Position angle solar axis at noon pang = PA_pole(T, lngsun=Sun[0], /equatorial, /degrees) Sun = CvSky(T, fromecliptic=Sun, /toequatorial, /degrees) ; The rotation over dabg puts the Sun in the center of the fish-eye and ; the solar equator along the horizontal (the rotation is applied in FishEye) if hammer then begin ; dabg = [0,-Sun[1],0] ; dabg = [0,-Sun[1],-pang] endif else begin dabg = [0,-Sun[1],-pang] skyedge = maxelo endelse BreakVal = 0.+.5*8/!d.n_colors*findgen(!d.n_colors-1) set_plot, 'Z' reset_colors loadct, 5 PlotEarthSkymap, T, pa, Yd, xg, breakval=BreakVal, /equator, $ maxelo=skyedge, minelo=20.0, dabg=dabg, zero_phase=Sun[0], /degrees ; Label plot: file xyouts, /normal, .73, .05 , charsize=1.5, 'File: '+(['g','e'])[edt]+strcompress(mjd,/remove_all) tmp = tvrd() ;reverse(tvrd(),2) ; Read Z buffer, reverse scale tvlct, /get, red, green, blue device, /close ; Close Z buffer set_plot, !TheTerminal tvlct, red, green, blue view, in=tmp tif = count gt 1 if not tif then begin tif = dialog_message('Write display to TIF file', /question, /cancel) tif = (where( tif eq ['No','Yes','Cancel'] ))[0] if tif eq 2 then return endif if tif then begin tif_name = 'ips_' + strcompress(mjdold,/remove_all) + '.tif' message, /info, 'Writing TIF file: '+tif_name tiff_write, tif_name, tmp, 0 ,red=red,green=green,blue=blue ; Write to TIF file endif endif else $ message, 'Data file not read!', /info endfor if movie then print, 'movie finished' ; Tell the ARexx moviemaker ; that the movie is done. endwhile return & end