;+ ; NAME: ; vu_remoteview ; PURPOSE: ; Reads tomography files for processing in href=RemoteView= ; CATEGORY: ; Volume rendering ; CALLING SEQUENCE: PRO vu_remoteview, hdr, ff, $ ut0 = ut0 , $ ihdr = ihdr , $ degrees = degrees , $ type_ff = type_ff , $ volsize = volsize , $ images = images , $ meshhcs = MeshHCS , $ mergehcs= MergeHCS , $ nearest = nearest , $ hdr_bb = hdr_bb , $ bb = bb , $ filter_bb=filter_bb , $ type_bb = type_bb , $ location=location , $ upto = upto , $ silent = silent , $ _extra = _extra , $ module = module ; INPUTS: ; hdr array[k]; type: header structure ; ff array[n,l,m,2,k]; data arrays associated with 'hdr' array ; (for k=1 the last dimension may be absent). If not ; specified, then data will be read using vu_getdata. ; OPTIONAL INPUT PARAMETERS: ; ihdr = ihdr scalar; type: integer ; ut0 = ut0 scalar; type: float ; array[1]; type: time structure ; keyywords are passed to href=vu_getdata= ; ; type_ff = type_ff ; array[1]; type: structure ; This structure is passed to vu_type_insitu, ; and is used to initialize some of the entries in its ; return structure. See href=vu_type_insitu=. ; ; volsize = volsize ; scalar, or array[2]; type: float ; inner and outer limit on radial distance displayed in ; the volume rendering. A scalar specifies only the outer ; limit (with the inner limit assumed to be zero). ; If not specified then the full range (extracted from the ; headers) is used. The values will be rounded to the ; nearest grid distances inside the specified range. ; /degrees if set, all angles are in degrees (default: radians) ; ; /meshhcs if set, the heliospheric current sheet is added to the ; display. This requires magnetic field data, either ; read from file or specified through keyword 'bb'. ; /mergehcs if set, the heliospheric current sheet is added to the ; display. This requires magnetic field data, either ; read from file or specified through keyword 'bb'. ; /nearest ??? ; ; bb = bb array[n,l,m,2,kk]; type: float ; (for kk=1 the last dimension may be absent) ; If kk=1 the same magnetic field matrix is used for ; k volume matrices. ; ; destination=destination ; directory where to write a gif file of the display ; (passed to href=vu_get_page=; useful only when processing ; single view). ; /png save image as png file ; /gif save image as gif file (this is the default) ; location=location ; array[3,k]; type: float ; viewing locations associated with each of the ; k data arrays. ; ; Keywords passed to href=RemoteView= are explained there. ; ; OUTPUTS: ; hdr array[k]; type: header structure ; ff array[n,l,m,2,k]; data arrays associated with 'hdr' array ; (for k=1 the last dimension may be absent) ; Data read using vu_getdata. ; OPTIONAL OUTPUT PARAMETERS: ; bb = bb array[n,l,m,2,kk]; type: float ; (for kk=1 the last dimension may be absent) ; Magnetic field data read from file. ; type_ff = type_ff ; array[1]; type: structure ; vu_type_insitu structure used in the display ; volsize = volsize ; array[2]; type: float ; actual inner and outer limit on radial distance ; displayed in the volume rendering. ; images = images ; array[k]; type: string ; INCLUDE: @compile_opt.pro ; On error, return to caller @vu_fnc_include.pro ; ; CALLS: ; InitVar, IsType, ToRadians, vu_getdata, vu_type_insitu, vu_prefix, Carrington ; AngleRange, RemoteView, vu_get_page, InitVar, TimeGet ; SetFileSpec, GetFileSpec, vu_select, vu_gettime, vu_get, TimeInterpol ; EXAMPLE: ; vu_remoteview, file=filepath(root=getenv('DAT'),subdir='tomography', $ ; 'nv3d1653.5000'), full_range=[5,40.0], /density, $ ; full_color=[125,225], full_opa=[0,0.5], ngrid=91, cme=[2,!pi,0], $ ; view_time=Carrington(1653.5d0) ; PROCEDURE: ; full_color = [125,225] ; full_opa = [0,.5] ; full_range = [5.0,40.0] ; ngrid = 91 ; MODIFICATION HISTORY: ; APR-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- InitVar, silent , 0 InitVar, nearest , /key InitVar, MeshHCS , /key InitVar, MergeHCS, /key GetBB = MeshHCS OR MergeHCS ihdr_set = IsType(ihdr, /defined) rpm = ToRadians(degrees=degrees) utt = vu_getdata(hdr, ff, ut0=ut0, ihdr=ihdr, count=count, silent=silent, _extra=_extra) IF count EQ 0 THEN RETURN utc = Carrington(utt, /get_variable) utt = Carrington(utt, /get_time ) IF silent LE 1 THEN message, /info, TimeGet(utt,/ymd,upto=TimeUnit(/minute))+strcompress(ihdr) IF GetBB AND IsType(bb, /undefined) THEN BEGIN ; /meshhcs is set then try to pick up magnetic field data. ; Find the magnetic field files by replacing 'nv' by 'bb' in ; the file name in hdr SetFileSpec, vu_get(hdr, /file) InitVar, filter_bb, vu_prefix(/magnetic,/silent) CASE nearest OF 0: file = GetFileSpec(upto='directory')+filter_bb+strmid(GetFileSpec(from='name'),4) 1: BEGIN file = (GetFileSpec(upto='directory'))[0]+filter_bb+'*.*' file = file_search(file, count=count_bb) GetBB = count_bb GT 0 END ENDCASE IF GetBB THEN BEGIN hdr_bb = vu_select(file, /check, /read, count=count_bb, ff=bb) GetBB = count_bb EQ count ENDIF ENDIF ; Select one of the matrices to be displayed in remoteview. ; This removes the time dimension from the data arrays. CASE ihdr_set OF 0: BEGIN hdri_nv = vu_gettime(hdr, ff, ut=utc, ff_ut=ffi) IF GetBB THEN hdri_bb = vu_gettime(hdr_bb, bb, ut=utc, ff_ut=bbi) END 1: BEGIN ; ihdr set explicitly hdri_nv = vu_gettime(hdr, ff, ut=vu_get(hdr[ihdr], /uttime), ff_ut=ffi, /fixgrid) IF GetBB THEN hdri_bb = vu_gettime(hdr_bb, bb, ut=vu_get(hdr_bb[ihdr], /uttime), ff_ut=bbi, /fixgrid) END ENDCASE type_ff = vu_type_insitu('earth_remoteview', _extra=_extra, type=type_ff) id = (where(type_ff.data))[0] ; Pick up one of the two data types (e.g. velocity or density). f3dmat = vu_fnc(id, ffi, /t3d_array) IF GetBB THEN BEGIN b3dmat = bbi[*,*,*,vu_t3d_brad] GetBB = total( finite(b3dmat) ) GT 0 IF NOT GetBB THEN BEGIN message, /info, 'no magnetic field available' destroyvar, b3dmat ENDIF ENDIF ;whatis, f3dmat, b3dmat CASE n_elements(location) OF 0 : 3 : loc_i = location ELSE: loc_i = TimeInterpol(location,vu_get(hdr,/uttime),vu_get(hdri_nv,/uttime)) ENDCASE matrix_time = vu_get(hdri_nv,/uttime) tmp = vu_get(hdri_nv,/array) tmp = (2*!pi/rpm)*reform(ceil(tmp[0,*])-tmp[0,*]) start_lng = AngleRange(tmp, /pi, degrees=degrees) ; Not necessary ??? radii = vu_get(hdri_nv, /all_radii) IF IsType(volsize, /defined) THEN BEGIN InitVar, volsize, [0,volsize], count=1 tmp = where(volsize[0] LE radii AND radii LE volsize[1], ntmp) IF ntmp NE 0 THEN BEGIN tmp = tmp[[0,ntmp-1]] volsize = radii[tmp] f3dmat = f3dmat[*,*,tmp[0]:tmp[1]] IF GetBB THEN b3dmat = b3dmat[*,*,tmp[0]:tmp[1]] ENDIF ENDIF InitVar, volsize, [min(radii), max(radii)] MeshHCS = MeshHCS and GetBB MergeHCS = MergeHCS and GetBB ; Needed to pick up the proper color table (should be _v or _n) postfix = strmid(type_ff.label,0,2) title = vu_fnc(id,/symbol,/norm)+' ('+vu_fnc(id,/unit)+')' RemoteView, f3dmat=f3dmat, b3dmat=b3dmat, matrix_time = matrix_time, $ volsize = volsize , $ start_lng=start_lng , $ degrees = degrees , $ images = images , $ xysize = type_ff.xysize , $ postfix = postfix , $ title = title , $ format = type_ff.format , $ meshhcs = MeshHCS , $ mergehcs= MergeHCS , $ location= loc_i , $ silent = silent , $ _extra=_extra IF IsType(module, /undefined) THEN BEGIN CASE GetBB OF 0: module = type_ff.display+type_ff.label 1: BEGIN case type_ff.label of (vu_type_insitu(/speed )).label: InitVar, type_bb, vu_type_insitu(/brad ) (vu_type_insitu(/density)).label: InitVar, type_bb, vu_type_insitu(/btang) ENDCASE module = type_ff.display+type_bb.label message, /info, 'plasma and B-field, '+module END ENDCASE ENDIF vu_get_page, hdri_nv, module, ut=utc, use_image=images, upto=upto, title='', silent=silent, _extra=_extra RETURN & END ;FOR i=0,M3D.nmatrix-1 DO BEGIN ; hdr_out = hdr ; hdr_out = vu_set(hdr_out, uttime=(*M3D.time)[i]) ; ff = (*M3D.F3D)[*,*,*,i] ; ff = SuperArray(ff, 2, /trail) ; ff[*,*,*,0] = BadValue(ff) ; vu_write, hdr_out, ff, userinfo='HELIOS/SOLWIND CME added', destination=getenv('TUB') ;ENDFOR ;RETURN & END