;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Program: read_fire_ace_ssfr.pro ; ; Version: 1.0 ; ; Purpose/Function: ; This program will open a NetCDF file from the FIRE ACE ; SHEBA ship Solar Spectral Flux Radiometer (SSFR) and print out ; to an ASCII file the day's measurements. ; ; structure (idl structure definition) ; ; Algorithm: none ; ; Invocation: idl> read_fire_ace_ssfr ; ; External Routines: none ; ; Internal Routines: none ; ; Language/Compiler Version: IDL 5.3 ; ; Point of Contact: Comments or questions should be directed to: ; ; NASA Langley Atmospheric Sciences Data Center ; Science, Users and Data Services Office ; NASA Langley Research Center ; Mail Stop 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: ; 05/03/2002 - 1.0 ; Initial version of the software. ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Main Routine - read_fire_ace_ssfr ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; pro read_fire_ace_ssfr ; --- DAAC banner print, '*****************************************************************' print, '* *' print, '* *' print, '* FIRE_ACE_SHIP_SSFR Read Software *' print, '* *' print, '* Version: 1.0 *' print, '* *' print, '* Date: May 21,2002 *' print, '* *' print, '* Contact: *' print, '* NASA Langley Atmospheric Sciences Data Center *' 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, '*****************************************************************' ; ; Various format statements ; F1='(" ",A,I4)' F2='("-----",A,A,"-----")' F3='("-----",A,"-----")' FI='(A24," ",A8," ",I6," ",I)' FS='(A24," ",A8," ",I6," ",A)' FF='(A24," ",A8," ",I6," ",F)' FD='(A24," ",A8," ",I6," ",D)' F4='(A24," ",A8," ",I6)' F5='(A24," ",A8," ",A6)' ; ; GET INPUT FILE NAME ; file=pickfile(filter="*.cdf",/read) print,"The file is: ",file print ; ; Open an ASCII output file for holding the data. ; You must have write permission in the directory where the data is. ; openw,outfile,file+'.info',/get_lun print,'Information sent to ',file + '.info' ; ; OPEN THE NetCDF FILE READ ONLY ; fileid=ncdf_open(file) printf,outfile," *****BEGINNING OF CDF_INFORMATION***** " printf,outfile printf,outfile," FILENAME : ",file ; ; GET BASIC FILE INFORMATION ; inq=ncdf_inquire(fileid) printf,outfile,'=====================================' printf,outfile,'ndims = ',inq.ndims printf,outfile,'nvars = ',inq.nvars printf,outfile,'nglobal_atts = ',inq.ngatts nvar=inq.nvars nglobatts=inq.ngatts ; ; GET GLOBAL ATTRIBUTES ; printf,outfile,'=====================================' printf,outfile," # of Global Attributes ",nglobatts if nglobatts gt 0 then begin printf,outfile printf,outfile,"------------------------------------------------" printf,outfile,'Name','Type','Number',FORMAT=F5 printf,outfile for i=0,nglobatts-1 do begin attName=ncdf_attName(fileid,i,/global) attInq=ncdf_attInq(fileid,attName,/global) ncdf_attget,fileid,attName,d,/global printf,outfile,strtrim(attName),attInq.dataType,attInq.length,FORMAT=FI ; Convert Attributes data into nicer Format att=strtrim(string(d)) attData=str_sep(att,' ') print, attData printf,outfile,' ',attname,'= ',attData endfor endif ; ; GET DIMENSIONS ; printf,outfile,'=====================================' printf,outfile," # of Dimensions ",inq.ndims if inq.ndims gt 0 then begin printf,outfile printf,outfile,"------------------------------------------------" printf,outfile,'Name','Size',FORMAT=F5 printf,outfile for i=0,inq.ndims-1 do begin ncdf_diminq,fileid,i,dimName,dimSize printf,outfile,strtrim(dimName),dimSize,FORMAT='(A24,5X,I5)' endfor endif ; ; GET THE NUMBER OF VARIABLES IN THE FILE ; printf,outfile,'=====================================' printf,outfile," # of VAR = ",nvar,FORMAT=F1 printf,outfile," if nvar gt 0 then begin printf,outfile," " printf,outfile," Name Rank Type DIMS Nattrs Attribute Value" printf,outfile,"---------------------------------------------------------------" FSD='(A14," ",I4," ",A8," ",I4)' for i=0,nvar-1 do begin dsInq=ncdf_varinq(fileid,i) ; Convert Variable name into nicer Format varName=str_sep(strtrim(dsInq.name,2),' ') printf,outfile,varName,dsInq.ndims,dsInq.datatype,dsInq.natts,FORMAT=FSD printf,outfile,' DIMS = ',dsinq.dim for j=0,dsinq.natts-1 do begin d='' attName=ncdf_attName(fileid,i,j) ncdf_attget,fileid,i,attname,d attData=strtrim(string(d)) printf,outfile,' ',attname,'= ',attData endfor dataid=NCDF_VARID(fileid,dsInq.name) NCDF_VARGET, fileid, dataid, thedata printf,outfile,thedata ; NCDF_VARGET, fileid, i, thedata endfor endif ; ; CLOSE ALL FILES ; close,outfile ncdf_close,fileid end