;+ ; NAME: ; forecast_html ; PURPOSE: ; Creates all the html files that drive the IPS forecast site ; (except title_top.html and splash.html) ; CATEGORY: ; WWW: html ; CALLING SEQUENCE: ; forecast_html, root, quick_refresh=quick_refresh, slow_refresh=slow_refresh ; INPUTS: ; dir scalar; type: string ; directory where the html files are stored ; If not specified then html files are created in ; $smei/html/forecast in subdirecteries 'slow' and 'fast'. ; OPTIONAL INPUT PARAMETERS: ; quick_refresh=quick_refresh ; scalar; type: integer; default: 300 ; refresh rate applied to single images (hourly updates) ; slow_refresh=slow_refresh ; scalar; type: integer; default: 300 ; refresh rate applied to movies, aft- and forecast plots ; OUTPUTS: ; (updated html files are stored in 'root') ; CALLS: ; InitVar, CheckDir, TimeGet, TimeSystem, who_am_i, vu_type_insitu, vu_type_skymap ; PROCEDURE: ; So far we have 10 different types of displays. ; Seven of these are directly accessed from leftmenu.html ; The other three are indirectly accessed from the _info files. ; 'label' is used to generate the necessary file names ; 'title' is used as title in each html file. ; ; 'sublabel' and 'subtitle' are 2D array with the first dim ; listing the data types (speed, density, brad and btang) and the ; 2nd dim corresponding to a display type. ; ; Each of the split files fires up a pair of html files, each of which ; display some graphics. These is either a pair of IPS velocity and g-level, ; or a pair of solar wind velocity and density maps. ; ; For all of the individual graphics an html file loading the corresponding ; png or gif is made. For most (but not all) there is an html file loading a mng ; or gif animation. ; MODIFICATION HISTORY: ; SEP-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; May-2004, Susan Rappoport (UCSD/CASS; srappoport@ucsd.edu) ; Fixed problem with width of left menu (now 250 pixels wide) ; Added link to Solar System Space Weather page. ; Jul-2021, Matthew Bracamontes (UCSD/CASS; mtbracam@ucsd.edu) ; Updated links, STELab -> ISEE ;- ; Creates the file name for the html file that launches an item from ; the list in leftmenu.html. ; ; The file contains the frame definition to split a window into two ; frames one above the other. The lower will be used to display the ; explanation for the display. The upper contains the images. FUNCTION forecast_html_launch, label, extralabel, sublabel @compile_opt.pro ; On error, return to caller RETURN, label+extralabel+sublabel[0]+sublabel[1]+'.html' END ; Creates the file name for the html file containing the information ; for each item in the leftmenu lists. It is loaded by the launch ; file (see above). FUNCTION forecast_html_info, label, extralabel, sublabel @compile_opt.pro ; On error, return to caller RETURN, label+'_info'+sublabel[0]+sublabel[1]+'.html' END ; Creates the file name for the file containing the frame ; definition to split a window into a left and right frame, each ; of which display an image or movie. ; The file is loaded by the launch file (see above). FUNCTION forecast_html_split, label, extralabel, sublabel @compile_opt.pro ; On error, return to caller RETURN, label+extralabel+'_split'+sublabel[0]+sublabel[1]+'.html' END ; Creates the base file name (withouth extension) to load any ; of the individual images. ; It is used in the split files (see above). FUNCTION forecast_html_image, label, extralabel, sublabel @compile_opt.pro ; On error, return to caller RETURN, label+extralabel+sublabel END ; Creates the html code block to create the header for each of the ; lists in leftmenu.html FUNCTION forecast_html_leftmenu_header, title @compile_opt.pro ; On error, return to caller RETURN, ' '+[ $ '' , $ ' ' , $ '
'+title+'' , $ ' ' , $ '' ] END ; Creates the hmtl code block to create an item in the lists ; in leftmenu.html FUNCTION forecast_html_leftmenu_block, title, file, target=target @compile_opt.pro ; On error, return to caller InitVar, target, 'middle' RETURN, ' '+[ $ '' , $ ' ' , $ ' ' , $ ' '+title+'' , $ ' ' , $ ' ' , $ '' ] END ; Creates the top page for the web site (for plasma or magnetic data). ; It contains the basic frame definition. ; It loads the following html files: ; clock_time.html (also created here) ; clock_date.html (also created here) ; title_top.html (not created) ; splash.html (not created) ; leftmenu_*.html (also created here) ; Only the last (leftmenu) is created here. The others should exist already. PRO forecast_html_index, root, created, bodytop, noframes, expires, no_cache, $ tag, index, splash, leftmenu, cgi_bin, big_splash, $ message_banner=message_banner @compile_opt.pro ; On error, return to caller banner = 'banner.html' clock_date = 'clock_date.html' clock_time = 'clock_time.html' solar_home = 'http://cass.ucsd.edu/solar' stelab_home = 'http://stsw1.isee.nagoya-u.ac.jp/index-e.html' isee_home = 'http://stsw1.isee.nagoya-u.ac.jp/index-e.html' clearsp = 'images/clearsp.gif' ; Used in clock_date.html cass = 'images/solar_cass_vsm.gif' ; Logos for banner.html cass_ucsd = 'images/sm_ucsd_cass2.gif' japan = 'images/japan2.gif' stelogo = 'images/stelogo_vsm.jpg' glowy = 'images/glowyanim3.gif' ; Create top page index_v_n.html or index_br_bt.html ; Contains the frame definitions. banner_rows = 90+IsType(message_banner,/string)*30 clock_rows = strjoin(strcompress(replicate(banner_rows/2,2),/rem),',') banner_rows = strcompress(banner_rows,/rem) content = [ $ '' , $ '' , $ '' , $ ' IPS Space Weather Forecast: CASS/ISEE Cooperative Project' , $ created , $ '' , $ '',$ '' , $ '' , $ '' , $ ' ', $ ' ' , $ ' ' , $ ' ' , $ ' ' , $ ' ' , $ ' ' , $ ' ', $ ' ' , $ '' , $ noframes , $ '' ] openw, /get_lun, iu, filepath(root=root, index) FOR i=0,n_elements(content)-1 DO printf, iu, content[i] free_lun, iu ; Create banner.html (contains the logos in the top frame) content = [ $ '' , $ '' , $ ' CASS/ISEE IPS Forecast Banner' , $ created , $ '' , $ '' , $ bodytop , $ '' , $ '', $ ' ' , $ ' ' , $ '' , $ ' ' , $ '' , $ ' ' , $ ' ' , $ '' ] IF IsType(message_banner,/string) THEN $ boost, content, [ $ ' ' , $ ' ' , $ ' ' ] boost, content, [ $ '
' , $ ' ' , $ ' Center for Astrophysics & Space Sciences',$ ' ' , $ ' ' , $ '
' , $ ' ' , $ '
' , $ ' ' , $ ' Solar-Terrestrial Environment Laboratory' , $ ' ' , $ '
' , $ ' ' , $ ' ' , $ ' '+message_banner+'.' , $ ' ' , $ ' ' , $ '
' , $ '' , $ '' , $ '' ] openw, /get_lun, iu, filepath(root=root, banner) FOR i=0,n_elements(content)-1 DO printf, iu, content[i] free_lun, iu ; Create splash.html content = [ $ '' , $ '' , $ '' , $ '' , $ 'CASS/ISEE IPS Forecast Project Splash Page',$ '' , $ created , $ '' , $ '' , $ bodytop , $ '' , $ '
' , $ '' , $ '', $ ' ' , $ ' ' , $ ' ' , $ '' , $ ' ' , $ ' ' , $ ' ' , $ '' , $ ' ' , $ ' ' , $ ' ' , $ '' , $ ' ' , $ ' ' , $ ' ' , $ '' , $ ' ' , $ ' ' , $ ' ' , $ '
' , $ ' ' , $ '
' , $ ' ' , $ '
' , $ ' ' , $ '
' , $ ' ' , $ '
' , $ ' ' , $ ' ' , $ ' ' , $ ' ' , $ '
' , $ ' ' , $ '
', $ '
' , $ '' , $ '' , $ '' ] openw, /get_lun, iu, filepath(root=root, splash) FOR i=0,n_elements(content)-1 DO printf, iu, content[i] free_lun, iu ; Create clock_date.html ; Check whether daylight savings time is active, Count.cgi is not aware of ; daylight savings time and will always add 8 hours to to the machine time ; to calculate UT. The extra offset '-0100' added when daylight saving is ; in effect compensates for this. ;spawn, 'date +%Z', PDT ;PDT = (['-0100',''])[strpos(PDT,'DT') EQ -1] ;date = 'Count.cgi?display=date&timezone=GMT'+PDT+'&dformat=ddmmyy&expire=0' ;time = 'Count.cgi?display=clock&timezone=GMT'+PDT+'&tformat=24&expire=0' ;content = [ $ ; '' , $ ; '' , $ ; '' , $ ; 'UT Clock Date' , $ ; created , $ ; '' , $ ; expires , $ ; no_cache , $ ; ' ', $ ; '' , $ ; '' , $ ; bodytop , $ ; '' , $ ; '' , $ ; ' ' , $ ; ' ' , $ ; ' ' , $ ; '
', $ ; ' ',$ ; '
' , $ ; '' , $ ; '' , $ ; ''] ;openw, /get_lun, iu, filepath(root=root, clock_date) ;FOR i=0,n_elements(content)-1 DO printf, iu, content[i] ;free_lun, iu ; Create clock_time.html ;content = [ $ ; '' , $ ; '' , $ ; '' , $ ; 'UT Clock Time' , $ ; created , $ ; '' , $ ; expires , $ ; no_cache , $ ; ' ', $ ; '' , $ ; '' , $ ; bodytop , $ ; '' , $ ; '' , $ ; ' ' , $ ; ' ' , $ ; ' ' , $ ; '
', $ ; ' ',$ ; ' UT',$ ; '
' , $ ; '' , $ ; '' , $ ; ; '' ] ;openw, /get_lun, iu, filepath(root=root, clock_time) ;FOR i=0,n_elements(content)-1 DO printf, iu, content[i] ;free_lun, iu RETURN & END ; Creates the leftmenu.html file for plasma and magnetic web sites. PRO forecast_html_leftmenu, root, created, body, p0, z, main_list, magnetic, label, extralabel, sublabel, $ menu, other_tag, splash, leftmenu, little_splash @compile_opt.pro ; On error, return to caller content = [ $ '' , $ '' , $ '' , $ ' CASS/ISEE IPS Forecast Main Menu' , $ created , $ '' , $ '' , $ body , $ '' , $ '' , $ '' , $ ' ' , $ ' ' , $ ' ' , $ '' , $ ' ' , $ ' ' , $ ' ' , $ '
' , $ '' , $ ' ' , $ ' ' , $ ' ' , $ ' ' , $ '
' , $ ' ', $ ' ' , $ ' ' , $ '
' , $ '' , $ '
' , $ '' , $ '
', $ '' , $ ' ' , $ '' ] FOR n=0,n_elements(other_tag)-1 DO BEGIN other_file = './index'+other_tag[n]+'.html' CASE 1 OF strpos(other_tag[n], 'wson') NE -1: other_title = 'Magnetic Field (WSO/NOAA)' strpos(other_tag[n], 'nson') NE -1: other_title = 'Magnetic Field (NSO/NOAA)' ELSE: other_title = 'Velocity/Density' ENDCASE boost, content, forecast_html_leftmenu_block(other_title,other_file,target="_top") ENDFOR ; Build the introductory links at the top of the menu intro_file = 'intro/'+['space_weather_links','intro_gen' ,'intro_tech' ]+'.html' intro_title = ['Space Weather Links','Public Introduction' ,'Science Introduction'] FOR n=0,n_elements(intro_file)-1 DO $ boost, content, forecast_html_leftmenu_block(intro_title[n],intro_file[n]) other_file = 'index_ss.html' other_title = 'Solar System Space Weather' boost, content, forecast_html_leftmenu_block(other_title,other_file,target="_top") ; Build the two list of links for corotating and time-dependent tomography head = ['Corotating','Time-Dependent'] subdir = ['slow','fast']+'/' FOR l=0,1 DO BEGIN boost, content, forecast_html_leftmenu_header(head[l]) FOR n=0,main_list-1 DO $ IF p0 EQ 0 OR magnetic[z[n]] THEN $ boost, content, forecast_html_leftmenu_block(menu[z[n]], $ subdir[l]+forecast_html_launch(label[z[n]], extralabel[z[n]], sublabel[p0:p0+1,z[n]])) ENDFOR boost, content, [ $ '
', $ '' , $ '
' , $ '' , $ '' , $ '' , $ '' ] openw, /get_lun, iu, filepath(root=root, leftmenu) FOR i=0,n_elements(content)-1 DO printf, iu, content[i] free_lun, iu RETURN & END ;============================== ; Main procedure. PRO forecast_html, root, quick_refresh=quick_refresh, slow_refresh=slow_refresh, $ big_splash=big_splash, little_splash=little_splash, bkg_gif=bkg_gif, $ movie_type=movie_type, message_banner=message_banner @compile_opt.pro ; On error, return to caller created = ' ' expires = ' ' no_cache = ' ' InitVar, movie_type, '.gif' ; Supporting images: splash image, background. InitVar, big_splash , 'images/edited_perspcme_cropped.jpg' ; Used in splash.html InitVar, little_splash , 'images/edited_perspcme_sm.jpg' ; Used in leftmenu InitVar, bkg_gif , 'images/bkg_starry.gif' ; Used everywhere ; Location of Count.cgi script used to display UT date and time cgi_bin = 'http://cass185.ucsd.edu/cgi-bin/' noframes = [ $ '' , $ '' , $ ' <body>' , $ ' <p>Please, use a browser that supports frames</p>', $ ' </body>' , $ '' , $ '' ] body = '' bodytop = '' lab_vn = [ (vu_type_insitu(/speed )).label, $ (vu_type_insitu(/density)).label, $ (vu_type_insitu(/bradial)).label+'_wson', $ (vu_type_insitu(/btang )).label+'_wson', $ (vu_type_insitu(/bradial)).label+'_nson', $ (vu_type_insitu(/btang )).label+'_nson'] lab_vg = [ (vu_type_skymap(/ips_speed )).label, $ (vu_type_skymap(/ips_glevel)).label, $ (vu_type_insitu(/bradial)).label+'_wson', $ (vu_type_insitu(/btang )).label+'_wson', $ (vu_type_insitu(/bradial)).label+'_nson', $ (vu_type_insitu(/btang )).label+'_nson'] title_vn = [(vu_type_insitu(/speed )).title, $ (vu_type_insitu(/density)).title, $ (vu_type_insitu(/bradial)).title, $ (vu_type_insitu(/btang )).title, $ (vu_type_insitu(/bradial)).title, $ (vu_type_insitu(/btang )).title] title_vg = [(vu_type_skymap(/ips_speed )).title, $ (vu_type_skymap(/ips_glevel)).title, $ (vu_type_insitu(/bradial)).title, $ (vu_type_insitu(/btang )).title, $ (vu_type_insitu(/bradial)).title, $ (vu_type_insitu(/btang )).title] ; 'label' is used in file name construction ; The first 'main_list' of these appear in leftmenu.html main_list = 8 zperm = [4,6,2,3,1,0, 7,5] ; Permutation controlling order of appearance cross = [8,-1,-1,-1,-1,-1,-1, 11, 0,-1,-1, 7] movie = cross EQ -1 ; For all display types density and velocity images are made. ; Indicate for which also magnetic displays are to be made. ;magnetic = [0,1,0,0,1,1,1 ,1 ,0,0,0, 1] magnetic = [1,1,0,0,1,1,1 ,1 ,1,0,0, 1] label = [ $ 'cast_correlation' , $ 'earth_insitu' , $ 'earth_skysnap' , $ 'earth_skysweep' , $ 'earth_remoteview' , $ 'earth_solardisk' , $ 'synoptic' , $ 'raw_timeseries' , $ ; Temporary: ea vs nv3d 'cast_correlation' , $ 'earth_skysnap' , $ 'earth_skysweep' , $ 'raw_correlation' ] ; Temporary; ea vs nv3d extralabel = [ $ '_f024' , $ '' , $ '_ecl_hammer' , $ '_ecl_hammer' , $ '' , $ '' , $ '' , $ '' , $ ; Temporary '_a120' , $ '_ecl_fisheye' , $ '_ecl_fisheye' , $ '' ] ; Temporary menu = [ $ 'Correlations' , $ 'Time Series' , $ 'Sky Map' , $ 'Sky Sweep' , $ 'Remoteview' , $ 'Disk Map' , $ 'Synoptic Map' , $ 'Raw t-series' ] ; Temporary title = [ $ 'In-situ 1-Day Forecast' , $ 'In-situ Time Series' , $ 'Hammer-Aitoff Skymap' , $ 'Hammer-Aitoff Skysweep' , $ 'Remoteview' , $ 'Full-disk Map' , $ 'Synoptic Map' , $ 'Raw timeseries' , $ ; Temporary 'In-situ 5-Day Aftcast' , $ 'Fish-eye Skymap' , $ 'Fish-eye Skysweep' , $ 'Raw correlation' ] ; Temporary sublabel = [ [lab_vn+'_c'], [lab_vn], [lab_vg], [lab_vg], [lab_vn], [lab_vn], [lab_vn], [lab_vn], $ [lab_vn+'_c'], [lab_vg], [lab_vg], [lab_vn+'_c'] ] subtitle = [ [title_vn], [title_vn], [title_vg], [title_vg], [title_vn], [title_vn], [title_vn] , [title_vn], $ [title_vn], [title_vg], [title_vg] , [title_vn] ] IF IsType(root, /undefined) THEN BEGIN root = filepath(root=getenv('HTM'), 'forecast') IF NOT CheckDir(root) THEN BEGIN message, /info, 'destination directory does not exist: '+root RETURN ENDIF ; Create plasma and magnetic index and leftmenu files npage = (size(sublabel,/dim))[0]/2 p0 = 2*indgen(npage) all_tags = sublabel[ p0, zperm[0]]+sublabel[1+p0,zperm[0]] FOR ipage=0,npage-1 DO BEGIN p0 = 2*ipage tag = all_tags[ipage] ;sublabel[p0,zperm[0]]+sublabel[p0+1,zperm[0]] other_tag = all_tags[where(indgen(npage) ne ipage)] ;sublabel[2-p0,zperm[0]]+sublabel[2-p0+1,zperm[0]] index = 'index'+tag+'.html' splash = 'splash'+tag+'.html' leftmenu = 'leftmenu'+tag+'.html' forecast_html_index, root, created, bodytop, noframes, expires, no_cache, $ tag, index, splash, leftmenu, cgi_bin, big_splash, message_banner=message_banner forecast_html_leftmenu, root, created, bodytop, p0, zperm, main_list, magnetic, $ label, extralabel, sublabel, menu, other_tag, splash, leftmenu, little_splash ENDFOR ; If root is not specified then write to the slow and fast subdirectories ; in $htm/forecast by doing two recursive calls. forecast_html, filepath(root=root, 'slow'), movie_type=movie_type forecast_html, filepath(root=root, 'fast'), movie_type=movie_type RETURN ENDIF IF NOT CheckDir(root) THEN BEGIN message, /info, 'destination directory does not exist: '+root RETURN ENDIF message, /info, 'writing html files to '+root InitVar, quick_refresh, 300 InitVar, slow_refresh , 7200 quick_refresh = strcompress(quick_refresh, /rem) slow_refresh = strcompress( slow_refresh, /rem) quick_refresh = ' ' slow_refresh = ' ' ;===================== ; Main html links npage = (size(sublabel,/dim))[0]/2-1 FOR n=0,main_list-1 DO BEGIN FOR m=0,npage*magnetic[n] DO BEGIN p0 = 2*m p1 = p0+1 head = title[n]+': '+subtitle[p0,n]+' and ' +subtitle[p1,n] file = forecast_html_launch(label[n], extralabel[n], sublabel[p0:p1,n]) split = forecast_html_split (label[n], extralabel[n], sublabel[p0:p1,n]) info = './current/'+forecast_html_info (label[n], extralabel[n], sublabel[p0:p1,n]) content = [ $ '' , $ '' , $ '' , $ ' '+head+'' , $ created , $ '' , $ '' , $ '' , $ ' ' , $ ' ' , $ '', $ [noframes] , $ '' ] openw, /get_lun, iu, filepath(root=root, file) FOR i=0,n_elements(content)-1 DO printf, iu, content[i] free_lun, iu ENDFOR ENDFOR ;===================== ; Split frames: for each of these the frame definitions for a plit ; two-panel display (left and right) is set up. FOR n=0,n_elements(label)-1 DO BEGIN FOR m=0,npage*magnetic[n] DO BEGIN p0 = 2*m p1 = p0+1 head = title[n]+': '+subtitle[p0,n]+' and '+subtitle[p1,n] split = forecast_html_split(label[n], extralabel[n], sublabel[p0:p1,n]) left = forecast_html_image(label[n], extralabel[n], sublabel[p0 ,n])+'.img.html' right = forecast_html_image(label[n], extralabel[n], sublabel[p1 ,n])+'.img.html' content = [ $ '' , $ '' , $ '' , $ ' '+head+'' , $ created , $ '' , $ '' , $ '' , $ ' ' , $ ' ' , $ '' , $ noframes , $ '' ] openw, /get_lun, iu, filepath(root=root, split) FOR i=0,n_elements(content)-1 DO printf, iu, content[i] free_lun, iu ENDFOR ENDFOR FOR n=0,n_elements(label)-1 DO BEGIN FOR m=0,npage*magnetic[n] DO BEGIN p0 = 2*m FOR k=0,1 DO BEGIN p1 = p0+k head = title[n]+': '+subtitle[p1,n] image = forecast_html_image(label[n], extralabel[n], sublabel[p1,n]) IF movie[n] THEN BEGIN content = [ $ '' , $ '' , $ '' , $ ' '+head+' Map' , $ created , $ '' , $ expires , $ no_cache , $ quick_refresh , $ '' , $ '' , $ body , $ '' , $ '
' , $ '' , $ '
' , $ '' , $ '
' , $ 'Go to movie', $ '
' , $ '' , $ '' , $ '' , $ '' ] openw, /get_lun, iu, filepath(root=root, image+'.img.html') FOR i=0,n_elements(content)-1 DO printf, iu, content[i] free_lun, iu content = [ $ '' , $ '' , $ '' , $ ' '+head+' Movie' , $ created , $ '' , $ expires , $ no_cache , $ slow_refresh , $ '' , $ '' , $ body , $ '' , $ '
' , $ '' , $ '
' , $ '' , $ '
' , $ 'Go to present' , $ '
' , $ '' , $ '' , $ '' , $ '' ] openw, /get_lun, iu, filepath(root=root, image+'_movie.img.html') FOR i=0,n_elements(content)-1 DO printf, iu, content[i] free_lun, iu ENDIF ELSE BEGIN swap_title = title[cross[n]] swap_image = forecast_html_image(label[cross[n]],extralabel[cross[n]],sublabel[p1,cross[n]]) content = [ $ '' , $ '' , $ '' , $ ' '+head+' Map' , $ created , $ '' , $ expires , $ no_cache , $ slow_refresh , $ '' , $ '' , $ body , $ '' , $ '
' , $ '' , $ '
' , $ '' , $ '
' , $ 'Go to '+swap_title+'', $ '
' , $ '' , $ '' , $ '' , $ '' ] openw, /get_lun, iu, filepath(root=root, image+'.img.html') FOR i=0,n_elements(content)-1 DO printf, iu, content[i] free_lun, iu ENDELSE ENDFOR ENDFOR ENDFOR RETURN & END