PRO read_fire_ace_uwcv580_uwa ;================================================================================= ; Program: read_fire_ace_uwcv580_uwa ; ; Version: 1.0 ; ; Date: October 14, 1999 ; ; Function: Open and read FIRE_ACE_UWCV580_UWA HDF data files. ; Write minimum and maximum values of each parameter ; to the output file. ; A call to dialog_pickfile is used to create a dialog ; box for filename choice. This routine assumes those files ; are in the current directory. The 'PATH' parameter may ; need to be modified to correspond to the location ; of the input files. ; ; *** Please see the README file for further details *** ; ; Parameters: ; ; Field Description Units ; ----------------------------------------------------------------- ; timeh time - hhmmss UTC ; latgps latitude degs ; longps longitude degs ; tas air speed m/s ; azimth azimuth, clockwise from North deg ; pitchc pitch angle deg ; rollcr roll angle deg ; rolltn roll angle deg ; galt altitude m above mean sea level ; palt altitude m above mean sea level ; pstat air pressure mb ; tstat air temperature degrees C ; dp dew point degrees C ; rhhum relative humidity percent ; turb turbulence cm^(2/3)/second ; lwfspa liquid water content g/m^3 ; lwcp liquid water content g/m^3 ; lwpvm0 liquid water content g/m^3 ; sapvm0 particle surface area cm^2/m^3 ; reff effective particle radius micrometer ; erpvm0 effective particle radius micrometer ; cnc3 cloud condensation nuclei conc. number/cm^3 ; cpdn(15) part. conc. in 15 ch. 14-310um number/cm^3 ; fsp3dn(31) part. conc. in 31 ch. .3-20um number/cm^3 ; fspdna(15) part. conc. in 15 ch. 2-47um number/cm^3 ; pcasdn(15) part. conc. in 15 ch. .1-3um number/cm^3 ; bkspbl backscatter at 450nm (blue) inverse meters ; bkspgr backscatter at 550nm (green) inverse meters ; bksprd backscatter at 700nm (red) inverse meters ; tspbl total scatter coeff.at 450nm inverse meters ; tspgr total scatter coeff.at 550nm inverse meters ; tsprd total scatter coeff.at 700nm inverse meters ; pyrdn hemispheric up radiance .3-3um W/m^2 ; pyrup hemis. down radiance .3-3um W/m^2 ; uv hemis. down radiance .295-.39um W/m^2 ; uvbot hemis. up radiance .295-.39um W/m^2 ; ----------------------------------------------------------------- ; ; Algorithm: none ; ; Invocation: idl> FIRE_ACE_UWCV580_UWA ; ; External Routines: none ; ; Internal Routines: none ; ; Language/Compiler Version: IDL 5.2 ; ; Point of Contact: Comments or questions should be directed to: ; ; EOSDIS Langley DAAC ; Science, Users and Data Services Office ; NASA Langley DAAC Research Center ; Mail Code 157D ; 2 South Wright Street ; Hampton, Virginia 23681-2199 ; U.S.A. ; ; E-mail: larc@eos.nasa.gov ; Phone: (757)864-8656 ; FAX: (757)864-8807 ; ; Updates: None ; ;================================================================================= ; --- DAAC banner print, '*****************************************************************' print, '* *' print, '* *' print, '* FIRE_ACE_UWCV580_UWA Read Software *' print, '* *' print, '* Version: 1.0 *' print, '* *' print, '* Date: October 14, 1999 *' print, '* *' print, '* Contact: EOSDIS Langley DAAC *' print, '* Science, Users and Data Services Office *' print, '* NASA Langley Research Center *' print, '* Mail Stop 157D *' print, '* 2 South Wright Street *' print, '* Hampton, Virginia 23681-2199 *' print, '* U.S.A. *' print, '* *' print, '* E-mail: larc@eos.nasa.gov *' print, '* Phone: (757)864-8656 *' print, '* FAX: (757)864-8807 *' print, '* *' print, '*****************************************************************' ; --- dialog box containing filenames ; --- The path parameter may be added to suit your system filename = dialog_pickfile(/read,filter='*.hdf') ; --- open output file openw,out_lun,filename+'_output',/get_lun ; --- CHECK FOR VALID HDF FILE if (HDF_ISHDF(filename) ne 1) then begin print,"Error, not a HDF file: ",filename stop endif ; --- OPEN HDF FILE fileid = HDF_OPEN(filename,/read) ; --- Have User select parameters to output to file print, " " print, " CHOOSE THE PARAMETERS TO BE SAVED" make_list,var_list selectTool,var_list,selected_vars print_var=var_list[selected_vars] print, " " print,'You chose the following ',n_elements(selected_vars),' parameters:' print,var_list[selected_vars] print, " " print, " **************** Begin reading data *********************" print, " " ; --- OUTPUT MIN/MAX VALUES TO THE SCREEN print,'' print,'Input Filename: ',filename print,'' print,'' print,'Parameters:' print,'------------------------------------------------------------' print,format="(A5,T10,A12,T30,A13,T47,A13)",'field','# of records','minimum value','maximum value' print,'------------------------------------------------------------' ; --- Set values data_fill=32768 vd_id = -1 ; --- Read through selected VDATA repeat begin vd_id = HDF_VD_GETID(fileid,vd_id) if (vd_id ge 0) then begin ; --- Attach VDATA handle = HDF_VD_ATTACH(fileid,vd_id) ; --- Determine number of fields within the VDATA HDF_VD_GET,handle,name=name,nfields=nfields,count=num_rec ; --- Read beginning & ending times num_rec=HDF_VD_READ(handle,data,fields='timeh') ; --- Obtain min/max time for output goodIndices = where( data ne data_fill, count) if count gt 0 then begin temp = data[goodIndices] max_data=max(temp,min=min_data) endif min_time=strtrim(string(min_data),2) max_time=strtrim(string(max_data),2) ; --- print time information to the output file printf,out_lun,'Data Start Time (UTC): ',strmid(min_time,0,2),':',strmid(min_time,2,2),':',strmid(min_time,4,2),$ ' Data End Time (UTC): ',strmid(max_time,0,2),':',strmid(max_time,2,2),':',strmid(max_time,4,2) ; --- Read selected fields within the VDATA for i=0,n_elements(selected_vars)-1 do begin ; HDF_VD_GETINFO,handle,i,name=field_name,order=order,size=size,type=type ; --- Read VDATA num_rec=HDF_VD_READ(handle,data,fields=print_var[i]) ; --- Get min/max without fill value max_data=0 min_data=0 goodIndices = where( data ne data_fill, count) if count gt 0 then begin temp = data[goodIndices] max_data=max(temp,min=min_data) endif ; --- Print data to the output file printf,out_lun,'Number of Records: ',num_rec printf,out_lun,'Parameter: ',print_var[i] printf,out_lun,data ; --- OUTPUT MIN/MAX VALUES TO THE SCREEN print,format="(A6,T11,I8,T28,f12.2,T45,f12.2)",print_var[i],num_rec,min_data,max_data endfor ; --- Detach VDATA hdf_vd_detach,handle endif endrep until (vd_id lt 0) ; --- CLOSE INPUT FILE HDF_CLOSE,fileid ; --- Output to the screen print,'------------------------------------------------------------' print,'' print,'Data Start Time (UTC): ',strmid(min_time,0,2),':',strmid(min_time,2,2),':',strmid(min_time,4,2),$ ' Data End Time (UTC): ',strmid(max_time,0,2),':',strmid(max_time,2,2),':',strmid(max_time,4,2) print,'' print,'Total number of fields output: ',n_elements(selected_vars) print,'' print,'Completed reading ',filename print,'' print,'Output is in ',filename+'_output' ; --- CLOSE OUTPUT FILE close,out_lun free_lun,out_lun END Pro make_list,var_list ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Function: This program will set up a list of variables for the ; FIRE_ACE_UWCV580_UWA data set ; ; Variables: Name Type In/Out Description ; ---- ---- ------ ----------- ; var_list structure out a list of variables available ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; var_list=[$ 'timeh',$ 'latgps',$ 'longps',$ 'tas',$ 'azimth',$ 'pitchc',$ 'rollcr',$ 'rolltn',$ 'galt',$ 'palt',$ 'pstat',$ 'tstat',$ 'dp',$ 'rhhum',$ 'turb',$ 'lwfspa',$ 'lwcp',$ 'lwpvm0',$ 'sapvm0',$ 'reff',$ 'erpvm0',$ 'cnc3',$ 'cpdn',$ 'fsp3dn',$ 'fspdna',$ 'pcasdn',$ 'bkspbl',$ 'bkspgr',$ 'bksprd',$ 'tspbl',$ 'tspgr',$ 'tsprd',$ 'pyrdn',$ 'pyrup',$ 'uv'] return End Pro selectTool,title,selected_vars,help=help ;================================================================================= ; Program: selectTool ; ; Version: 1.0 ; ; Date: August 5, 1999 ; ; Purpose/Function: ; This procedure will make a gui to display for a user to choose variables ; from a list of variable names. ; ; Variables: ; title strarr List of variables ; vars intarr Indices of variables chosen (common) ; selected_vars intarr Indices of variables chosen (returned) ; state structure Holds internal GUI information ; ; ; ; Invocation: idl> selectTool, parameter_list,index_list ; ; ; Language/Compiler Version: ; This program has been tested on the systems listed below. ; Computer Operating System IDL Version ; --------------- ---------------- ----------- ; Sun, Ultra-4 Solaris 5.6 5.2 ; ; ; Updates: ; ;================================================================================= common selectTool, vars,help_string ;Create a GUI base base=widget_base(/column,title='Choose the variables to be read',mbar=menubase) ;Set up the menu bar void=cw_pdmenu(menubase,/mbar,['1\File','2\Abort Read'],/return_name) ;Create a subBase to put buttons at the top subBaseB=widget_base(base,column=3) void=widget_button(subBaseB,value='Done') void=widget_button(subBaseB,value='Help') void=widget_button(subBaseB,value='Select All') ;Create a subBase for the variable list subBase=widget_base(base,/row) listID=widget_list(subBase,value=Title,ysize=7,/multiple) ;listID=widget_list(subBase,value=Title,ysize=7) ;Draw the window widget_control,base,/realize ;Initialize the UValue structure state={listID:listID, all:indgen(n_elements(title))} widget_control,base,set_uvalue=state xmanager,'selectTool',base ;,cleanup='vtClean' selected_vars=vars return End Pro selectTool_event,event ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This procedure manages events generated by the selectTool GUI ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; common selectTool,vars widget_control,event.top,get_uvalue=state thisType=widget_info(event.id,/name) widget_control,event.top,get_uvalue=state ;if (thisType eq 'BUTTON') then widget_control,event.id,get_value=thisValue if (thisType eq'LIST') then thisValue='LIST' else $ if (thisType eq 'BUTTON') then widget_control,event.id,get_value=thisValue $ else thisValue=event.value case thisValue of 'Quit':Begin widget_control,event.top,/destroy retall end 'Help': begin print,'' print,' Select the variables to be saved.' if (!d.name eq 'X') then begin print,' Holding down the Shift key and clicking an item selects the range ' print,' from the previously selected item to the new item. Holding down the' print,' mouse button when selecting items also selects a range. Holding ' print,' down the Control key and clicking an item toggles that item between' print,' the selected and unselected state.' print,'' endif else if (!d.name eq 'WIN') or (!d.name eq 'MAC') then begin print,' Holding down the Shift key and clicking an item selects the range ' print,' from the previously selected item to the new item. Holding down the' print,' Control key and clicking an item toggles that item between the ' print,' selected and unselected state.' print,'' endif end 'LIST': 'Done': Begin widget_control,event.top,get_uvalue=state vars=widget_info(state.listID,/list_select) if (vars[0] eq -1) then begin print,'NOT DONE. No variables were selected.' endif else widget_control,event.top,/destroy END 'Exit': Begin widget_control,event.top,/destroy return end 'Select All':widget_control,state.listID,set_list_select=state.all 'Abort Read': begin widget_control,event.top,/destroy retall end else: print,'Unknown Event' endcase return end