pro CompareInsitu, file, ut, $ delt = delt, $ ymin = ymin, $ ymax = ymax, $ _extra = _extra, $ from = from, $ hardcopy=hardcopy, $ xysize = xysize, $ noplot = noplot, $ nofuture= nofuture, $ ut_range= ut_range, $ tt_shift= tt_shift, $ tt_range= tt_range, $ tt_nfile= tt_nfile, $ correlation=correlation,$ data_path=data_path, $ data_filter=data_filter @compile_opt.pro ; On error, return to caller ;+ ; NAME: ; CompareInsitu ; PURPOSE: ; Wrapper program to control output from the href=PlotCompareInsitu= program. ; By default output goes to the screen, but can be redirected using ; the /hardcopy keyword or setting keyword 'destination' to a valid directory. ; CATEGORY: ; WWW ; CALLING SEQUENCE: ; CompareInsitu, file, ut, [parameters] ; INPUTS: ; file scalar or array[*]; type: string ; output files from the IPS tomography program ; OPTIONAL INPUT PARAMETERS: ; ut array[1]; type: time structure ; if ut is not specified then the time range covers the ; data in the input file. ; if ut is specified it is used in two ways: ; 1. the time series is centered on time ut[0] (see ; href=PlotCompareInsitu=) ; 2. if /nofuture is set, only times up to ut are plotted ; xysize=xysize array[2]; type: integer ; size of plot window and z-buffer ; from=from scalar; type: integer ; Identifies the in-situ instrument to be compared with ; the tomography data ; (use output from function href=Instrument=) ; destination=destination ; Writes graphic output to gif file ; /hardcopy Sends output to the default printer ; /noplot Suppress graphics output to screen ; /hardcopy takes precedence over /noplot ; If neither keyword is used then plot to the current ; graphics device ; /nofuture plot only data with times prior to ut ; (keyword is ignored if ut is not set) ; ut_range=ut_range array[1] or array[2]; type: time structure ; if scalar then only data prior to ut_range are used ; if array[2] then only data inside ut_range are used ; ; For additional keywords see href=PlotCompareInsitu=. To use the correlations ; between tomography and in situ data the 'delt' keyword MUST be set (if it ; is not set then the in situ values are not calculated for the same times as ; the tomography data). ; ; If one of the following three keywords is set then a single record from a ; group of ea* files is extracted (rather than reading one complete ea* file). ; ; tt_shift= tt_shift array[1]; time difference structure; default: 0 hours ; tt_range= tt_range array[1] or array[2]; time structure or float ; tt_nfile= tt_nfile scalar; type integer ; ; These three keywords are explained in href=ReadEarthFile= ; OUTPUTS: ; (screen, gif file or hardcopy) ; RESTRICTIONS: ; If one of the keywords tt_shift, tt_range, or tt_nfile is used then the ; first argument file is not used, but still needs to be present (e.g. set ; it to the null string.) ; CALLS: ; BadValue, ReadEarthFile, InsituTimeseries, Instrument, set_page ; PlotCompareInsitu, vu_get_page, get_page, reset_colors, TimeOp ; TimeGet, TimeUnit, Carrington, vu_type_insitu ; EXAMPLE: ; tt_shift = TimeSet(/diff, hour=-6) ; Time difference with forecast time ; tt_range = [1864,1865] ; Ea* files from Carrington rot 1864 ; tt_nfile = 25 ; Use only 25 most recent files ; ; CompareInsitu, '', delt=TimeSet(/diff, hour=6), from=instrument(/acesw), $ ; tt_shift=tt_shift, tt_range=tt_range, tt_nfile=tt_nfile ; PROCEDURE: ; MODIFICATION HISTORY: ; MAR-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- nofuture = keyword_set(nofuture) hardcopy = keyword_set(hardcopy) noplot = keyword_set(noplot ) correlation = keyword_set(correlation) single_rec = n_elements(tt_range) ne 0 or n_elements(tt_shift) ne 0 or n_elements(tt_nfile) ne 0 nfile = n_elements(file) ; The first call to ReadEarthFile will only read the first file in the 'file' argument. ok = ReadEarthFile(file, tt_shift=tt_shift, tt_range=tt_range, tt_nfile=tt_nfile, t1, f1, $ data_path=data_path, data_filter=data_filter) if not ok then return cdata = ['vel','den','br','bt','bn','bb'] if not InsituTimeseries(cdata, t1, t2, f2, delt=delt, from=from) then begin t2 = t1 f2 = replicate(BadValue(f1), n_elements(t2), n_elements(cdata)) endif tt_limit = -1 ; Check for limits on time. ; If /nofuture is specified, then in situ data with times later than the forecast ; time ut are flagged as bad. if nofuture then ut_range = Carrington(ut,/get_time) ; If ut_range is specified than all in situ data outside the time range specified by ; ut_range are flagged as bad. if n_elements(ut_range) ne 0 then begin if n_elements(ut_range) eq 1 then ut_range = [t1[0], ut_range[0]] tt_diff = TimeOp(/subtract, ut_range[1], ut_range[0], TimeUnit(/days), sign=tt_sign) tt_diff = tt_sign*tt_diff tt_limit = tt_sign*TimeOp(/subtract, t2, ut_range[0], TimeUnit(/days)) tt_limit = where(tt_limit lt 0 or tt_limit gt tt_diff) if tt_limit[0] ne -1 then f2[tt_limit,*] = BadValue(f2) endif if n_elements(xysize) eq 0 then xysize = 8*[50,28] case hardcopy of 0: begin ch_size = [!d.x_ch_size, !d.y_ch_size] old_device = !D.name set_plot, 'Z' device, z_buffering = 0, $ ; Forces zbuffer into 2D mode set_character_size = ch_size, $ set_resolution = xysize ; Set size of z-buffer reset_colors end 1: set_page, /printer, _extra=_extra endcase PlotCompareInsitu, t1, f1, t2, f2, ut=ut, sc_label=Instrument(from,/label), $ noplot=noplot, correlation=correlation, ymin=ymin, ymax=ymax, _extra=_extra case hardcopy of 0: begin name = (['compareinsitu','cast_insitu'])[single_rec] if single_rec then begin hr_shift = (TimeGet( tt_shift, /diff, TimeUnit(/hours) ))[0] name = name+'_'+(['a','f'])[hr_shift ge 0]+string(format='(I3.3)',abs(hr_shift)) endif type = vu_type_insitu('earth_insitu', _extra=_extra) name = name+type.label if correlation then name = name+'_c' tmp = strlen(file[0]) if tmp gt 3 then $ if strmid(file[0],tmp-3,3) eq '.gz' then $ file = strmid(file,0,tmp-3) vu_get_page, file, name, device=old_device, _extra=_extra end 1: get_page, /printer endcase return & end