pro read_h1_cdf ;+ ; wkp 3/28/08 read in the name of a cdf file and see if I can read ; the data ; ; THE PATHS WILL HAVE TO BE CHANGED TO RUN ON YOUR COMPUTER!!!!!!! ; ;- cmnd='ls -l /timas/flowdb/1996/*.cdf >! cdf_filelist' spawn, cmnd openr,lun,'cdf_filelist',/get_lun file_name='' while not eof(lun) do begin readf,lun,file_name ;-rw-rw-r-- 1 plasmas 2606101 Apr 2 13:46 /timas/flowdb/1996/po_h1_tim_19960317_v01.cdf ;1234567890123456789012345678901234567890123456789012345678901234 infile=strmid(file_name,54,41) print, infile cdfid=cdf_open(infile) print,'CDFID ',cdfid info=cdf_inquire(cdfid) help,/structure, info print, 'Dimensions: ',info.dim print, '' print,'Z Variable names and Types' for i=0, info.nzvars-1 do begin vinfo= cdf_varinq(cdfid,i,/zvariable) print, vinfo.name, ' Type:', vinfo.datatype, ' DIMS:', vinfo.DIM endfor cdf_control,cdfid,variable=0,/zvariable,get_var_info=einfo max_records=einfo.maxrec print, 'NOTE: The NO_PADVALUE_SPECIFIED: error is a feature of idl. no problem/wkp.' ;% CDF_CONTROL: Function completed but: NO_PADVALUE_SPECIFIED: A pad value has ; not been specified. print,'MAXRECORDS= ',max_records if max_records eq 0 then begin print, 'No valid Summary Data for this UT day' print_null,cdfid,einfo ; call to print_null.pro ???? print,cdfname stop endif if max_records lt 0 then begin print, 'ERRORR NO FILL RECORD IN THIS CDF' print, 'KEY PARAMETER CDF NOT CLOSED when generated' print, ' ..... or .......' print, 'you forgot to specify bin when you used ftp ' print, 'to transfer the file here! ' print, cdfname stop endif i=0 ; make the record star===0 (insruance statement status='' ; epoch ; ; cdf_varget,cdfid,'Start_Epoch',Start_EPOCH, rec_start=i,/zvariable cdf_varget,cdfid,'Start_Epoch',Start_EPOCH, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Start_epoch call/',Result,'/', status ; you don't really need epoch!!! use pb5 time.... cdf_varget,cdfid,'Stop_Epoch',Stop_EPOCH, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Stop_epoch call/',Result,'/', status cdf_varget,cdfid,'P_Peak',P_Peak, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for P_Peak call/',Result,'/', status cdf_varget,cdfid,'Flux_ppk',Flux_ppk, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Flux_ppk call/',Result,'/', status cdf_varget,cdfid,'Sigma_ppk',Sigma_ppk, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Sigma_ppk call/',Result,'/', status cdf_varget,cdfid,'E_peak',E_peak, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for E_peak call/',Result,'/', status cdf_varget,cdfid,'Flux_epk',Flux_epk, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Flux_epk call/',Result,'/', status cdf_varget,cdfid,'Sigma_epk',Sigma_epk, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Sigma_epk call/',Result,'/', status cdf_varget,cdfid,'Flux_eav',Flux_eav, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Flux_eav call/',Result,'/', status cdf_varget,cdfid,'Sigma_eav',Sigma_eav, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Sigma_eav call/',Result,'/', status cdf_varget,cdfid,'Fluence',Fluence, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Fluence call/',Result,'/', status cdf_varget,cdfid,'Sigma_flu',Sigma_flu, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Sigma_flu call/',Result,'/', status cdf_varget,cdfid,'E_flux',E_flux, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for E_flux call/',Result,'/', status cdf_varget,cdfid,'Sigma_ef',Sigma_ef, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Sigma_ef call/',Result,'/', status cdf_varget,cdfid,'Density',Density, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Density call/',Result,'/', status cdf_varget,cdfid,'Sigma_den',Sigma_den, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Sigma_den call/',Result,'/', status cdf_varget,cdfid,'Vperp',Vperp, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Vperp call/',Result,'/', status cdf_varget,cdfid,'Sigma_vprp',Sigma_vprp, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Sigma_vprp call/',Result,'/', status cdf_varget,cdfid,'Vparallel',Vparallel, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Vparallel call/',Result,'/', status cdf_varget,cdfid,'Sigma_vpll',Sigma_vpll, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Sigma_vpll call/',Result,'/', status cdf_varget,cdfid,'Tperp',Tperp, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Tperp call/',Result,'/', status cdf_varget,cdfid,'Sigma_tprp',Sigma_tprp, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Sigma_tprp call/',Result,'/', status cdf_varget,cdfid,'Tparallel',Tparallel, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Tparallel call/',Result,'/', status cdf_varget,cdfid,'Sigma_tpll',Sigma_tpll, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Sigma_tpll call/',Result,'/', status cdf_varget,cdfid,'LENA_flux',LENA_flux, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for LENA_flux call/',Result,'/', status cdf_varget,cdfid,'Sigma_lena',Sigma_lena, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Sigma_lena call/',Result,'/', status cdf_varget,cdfid,'R',R, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for R call/',Result,'/', status cdf_varget,cdfid,'L',L, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for L call/',Result,'/', status cdf_varget,cdfid,'MLT',MLT, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for MLT call/',Result,'/', status cdf_varget,cdfid,'LocT',LocT, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for LocT call/',Result,'/', status cdf_varget,cdfid,'Mlat',Mlat, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Mlat call/',Result,'/', status cdf_varget,cdfid,'ILA',ILA, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for ILA call/',Result,'/', status cdf_varget,cdfid,'MagField',MagField, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for MagField call/',Result,'/', status cdf_varget,cdfid,'SC_Potential',SC_Potential, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for SC_Potential call/',Result,'/', status cdf_varget,cdfid,'SZA',SZA, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for SZA call/',Result,'/', status cdf_varget,cdfid,'Imf_Gsm',Imf_Gsm, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Imf_Gsm call/',Result,'/', status cdf_varget,cdfid,'SW_pressure',SW_pressure, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for SW_pressure call/',Result,'/', status cdf_varget,cdfid,'SW_density',SW_density, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for SW_density call/',Result,'/', status cdf_varget,cdfid,'SW_velocity',SW_velocity, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for SW_velocity call/',Result,'/', status cdf_varget,cdfid,'Quality',Quality, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Quality call/',Result,'/', status cdf_varget,cdfid,'Fec',Fec, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Fec call/',Result,'/', status cdf_varget,cdfid,'Bcr',Bcr, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Bcr call/',Result,'/', status cdf_varget,cdfid,'Energy_range',Energy_range, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Energy_range call/',Result,'/', status cdf_varget,cdfid,'Spins',Spins, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Spins call/',Result,'/', status cdf_varget,cdfid,'Intervals',Intervals, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Intervals call/',Result,'/', status cdf_varget,cdfid,'SCPot_status',SCPot_status, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for SCPot_status call/',Result,'/', status cdf_varget,cdfid,'SZA_status',SZA_status, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for SZA_status call/',Result,'/', status cdf_varget,cdfid,'IMF_status',IMF_status, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for IMF_status call/',Result,'/', status cdf_varget,cdfid,'SW_status',SW_status, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for SW_status call/',Result,'/', status cdf_varget,cdfid,'Mag_status',Mag_status, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Mag_status call/',Result,'/', status cdf_varget,cdfid,'Orbit_status',Orbit_status, rec_count=max_records,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Orbit_status call/',Result,'/', status ;;;;;;;;;;;;;;;;;;;end of data variables the rest are ; ; here just for completeness ; set to get just one record... ; I don't understand what is in these variables ; wkp 3/30/00 cdf_varget,cdfid,'Mass',Mass, rec_count=1,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Mass call/',Result,'/', status cdf_varget,cdfid,'energy',energy, rec_count=1,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for energy call/',Result,'/', status cdf_varget,cdfid,'angle',angle, rec_count=1,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for angle call/',Result,'/', status cdf_varget,cdfid,'spin_label',spin_label, rec_count=1,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for spin_label call/',Result,'/', status cdf_varget,cdfid,'quality_label',quality_label, rec_count=1,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for quality_label call/',Result,'/', status cdf_varget,cdfid,'Direction',Direction, rec_count=1,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Direction call/',Result,'/', status cdf_varget,cdfid,'LENA_Pitch_Angle_range',LENA_Pitch_Angle_range, rec_count=1,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for LENA_Pitch_Angle_range call/',Result,'/', status cdf_varget,cdfid,'Mag_axis',Mag_axis, rec_count=1,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Mag_axis call/',Result,'/', status cdf_varget,cdfid,'Foot_or_con_foot',Foot_or_con_foot, rec_count=1,/zvariable Result=CDF_ERROR(status) if result ne 'CDF_OK: Function completed successfully.' then $ print, 'Status after cdf_varget for Foot_or_con_foot call/',Result,'/', status CDF_CLOSE,cdfid print,'CDF FILE CLOSED' start_year=0 start_month=0 start_day=0 stop_year=0 stop_month=0 stop_day=0 cdf_epoch, start_epoch(0,0), start_year, start_month, start_day,/breakdown cdf_epoch, stop_epoch(0,N_elements(R)-1),stop_year,stop_month, stop_day,hour,min,sec,/breakdown cdf_epoch, begin_of_day,start_year,start_month,start_day,/compute print, 'FILE: ' ,infile print, 'START: ',start_year, start_month, start_day print, 'STOP: ',stop_year, stop_month, stop_day, hour, min, sec ; put some plots here to !p.multi=[0,2,2] plot,(start_epoch(0,*)-begin_of_day)/3600000.,fluence(0,*),/ylog, $ title='Upward H+ Fluence', xrange=[0,24], xstyle=1, yrange=[1e2, 1e10],ystyle=1, $ Xtitle='Year/Month/Day ='+string(start_year)+string(start_month)+string(Start_day) plot,(start_epoch(0,*)-begin_of_day)/3600000.,fluence(0,*), $ title='H+ Fluence', xrange=[0,24], xstyle=1, $ ; yrange=[-1e8, 1e10], $ live with bad plots such as 3/27/96 Xtitle='LAST H/M/S ='+string(hour)+string(min)+string(sec) plot,(start_epoch(0,*)-begin_of_day)/3600000.,R,title='Earth Radii', $ xrange=[0,24], xstyle=1 plot,(start_epoch(0,*)-begin_of_day)/3600000.,l,Title='L',/ylog, $ xrange=[0,24], xstyle=1 !p.multi=[0,1,1] dum='' print,' Hit return to continue read,dum endwhile ; end of the big loop stop end