PRO qRemoteView_Pick, state ;+ ; NAME: ; qRemoteView_Pick ; PURPOSE: ; Select data file with 3D matrices ; CATEGORY: ; Widget: qRemoteView ; CALLING SEQUENCE: ; qRemoteView_Pick, state ; INPUTS: ; OPTIONAL INPUT PARAMETERS: ; OUTPUTS: ; OPTIONAL OUTPUT PARAMETERS: ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; SetFileSpec, GetFileSpec, vu_read, bin_read, AngleRange ; qRemoteView_AddData, qRemoteView_List, Carrington, big_eph ; jpl_body, CvSky, TimeGet ; COMMON BLOCKS: ; SIDE EFFECTS: ; RESTRICTIONS: ; PROCEDURE: ; MODIFICATION HISTORY: ; JUN-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- ; Pick up file filter from widget widget_control, state.wid_filter, get_value=filter filter = filter[0] ; Check for the presence of wildcards wildcard = strpos(filter, '*') NE -1 OR $ strpos(filter, '?') NE -1 OR $ strpos(filter, '%') NE -1 ; Use pickfile dialog if a wildcard was found; otherwise just try to read the file ; Select a single file. If no wildcard is present in filter then it is assumed to ; be a single file name. If a wildcard is present dialog_pickfile is called. CASE wildcard OF 0: file = filter 1: BEGIN ; Select single file SetFileSpec, filter file = dialog_pickfile( $ path = GetFileSpec(upto='directory'), $ filter = GetFileSpec(from='name',upto='type'), $ group = state.wid_matrix, title='Select image file') file = file[0] END ENDCASE status = file NE '' IF status THEN BEGIN widget_control, state.wid_tmatrix, get_uvalue=format SetFileSpec, file type = GetFileSpec(from='type', upto='type') name = GetFileSpec(from='name', upto='name') ok = 0B catch, ierror IF ierror EQ 0 THEN BEGIN IF (where(strmid(name,0,3) EQ ['nv3d','nv3f','bb3d']))[0] NE -1 THEN BEGIN hdr = vu_select(file, count=count) IF count GT 0 THEN f1 = vu_read(hdr, /get_roi, count=count) ok = count GT 0 IF ok THEN BEGIN xcrange = vu_get(hdr, /roi) radii = vu_get(hdr, /all_dist) f0 = f1[*,*,*,0] f1 = f1[*,*,*,1] CASE vu_get(hdr, /magnetic) OF 0: add_list = string(xcrange[0], format=format)+' '+['velocity','density'] 0: add_list = string(xcrange[0], format=format)+' '+['Brad','Btang'] ENDCASE ENDIF ENDIF ELSE IF strlowcase(type) EQ '.pph' THEN BEGIN status = bin_read(file, f3d, trailer=trailer) ok = n_elements( size(f0, /dim) ) EQ 3 IF ok THEN add_list='data' ENDIF ENDIF catch, /cancel IF ok THEN BEGIN qRemoteView_AddData, state, f0, f1, f2, add_list=add_list qRemoteView_List, state info = file IF n_elements(xcrange) NE 0 THEN BEGIN widget_control, state.wid_tlabel , get_uvalue=wid_unit ; XCrange[0] is the starting point of the matrix (in modified Carrington variable) ; We take the mean of XCrange[0] and XCrange[1] as the display time (i.e. midway ; through the rotation. The display time is also used to calculate the ; viewing location and direction. tmatrix = xcrange[0] tdisplay = mean(xcrange) tloc = tdisplay CASE wid_unit OF state.wid_uttime : BEGIN tmatrix = TimeGet(Carrington(tmatrix ), /ymd) tdisplay = TimeGet(Carrington(tdisplay), /ymd) END state.wid_rotation: BEGIN tmatrix = string(tmatrix , format=format) tdisplay = string(tdisplay, format=format) END ENDCASE widget_control, state.wid_tmatrix , set_value=tmatrix widget_control, state.wid_tdisplay, set_value=tdisplay ; The location of Earth at the display time is taken as the viewing location. ; The viewing direction is towards the Sun. tloc = Carrington(tloc) loc = big_eph( tloc, $ body = jpl_body(/earth,/string) , $ /to_ecliptic , $ /to_sphere , $ /degrees , $ /onebody , $ /silent ) widget_control, state.wid_clabel, get_uvalue=wid_unit IF wid_unit EQ state.wid_heliographic THEN loc = CvSky(tloc, from_ecliptic=loc, /to_heliographic, /deg) widget_control, state.wid_earth[0], set_value=loc[0] widget_control, state.wid_earth[1], set_value=loc[1] widget_control, state.wid_earth[2], set_value=loc[2] widget_control, state.wid_loc[0], set_value=loc[0] widget_control, state.wid_loc[1], set_value=loc[1] widget_control, state.wid_loc[2], set_value=loc[2] widget_control, state.wid_dir[0], set_value=AngleRange(loc[0]+180, /deg) widget_control, state.wid_dir[1], set_value=-loc[1] info = [info,'', 'Carrington range: '+string(xcrange[0], format=format)+ $ ' - '+string(xcrange[1], format=format)] ENDIF IF n_elements(radii) NE 0 THEN BEGIN rmin = min(radii, max=rmax) widget_control, state.wid_rmatrix[0], set_value=rmin widget_control, state.wid_rmatrix[1], set_value=rmax info = [info, 'Radial range (AU): '+string(rmin, format=format)+string(rmax, format=format)] ENDIF info = strjoin(info+string([13b,10b])) widget_control, state.wid_info, set_uvalue=info ENDIF ENDIF RETURN & END