#!/software/perl5/bin/perl # # Name: magview_wrapper.pl # # Description: Perl wrapper to pass year and day of year to magview_sdc.pro # # Inputs: year and doy of year # # Outputs: None. # # Author Date Comment # ---------- -------- ----------- # Bruce Toth 10/02/98 Original code # #------------------------------------------------------------------------- if($#ARGV < 1) { die " Usage: magview_wrapper.pl "; } ($year,$doy) = @ARGV; # # IDL Sequence: # open(IDL,"|/usr/local/bin/idl"); print IDL "\@magview.cmd\n"; $str_doy = sprintf("%03d",$doy); $line="$year\n$str_doy\n"; print IDL "$line"; close(IDL); # # ASCII and ps files created by the IDL routine. # if ( $year lt 2000 ) { $year = $year - 1900; } else { $year = $year - 2000; } $dat_file1 = sprintf("%s%02d%s%s","b",$year,$str_doy,".dat"); $dat_file2 = sprintf("%s%02d%s%s","bhsk",$year,$str_doy,".dat"); $dat_file3 = sprintf("%s%02d%s%s","ctp",$year,$str_doy,".dat"); $dat_file4 = sprintf("%s%02d%s%s","bctp",$year,$str_doy,".dat"); $ps_file1 = sprintf("%s%02d%s%s","bhsk",$year,$str_doy,".ps"); $ps_file2 = sprintf("%s%02d%s%s","combo",$year,$str_doy,".ps"); $ps_file3 = sprintf("%s%02d%s%s","bntbctp",$year,$str_doy,".ps"); # # GZIP the ascii files created by the IDL program. # system "gzip -f $dat_file1"; system "gzip -f $dat_file2"; system "gzip -f $dat_file3"; system "gzip -f $dat_file4"; # # Convert ps files to gifs. # system "pstogif $ps_file1"; system "pstogif $ps_file2"; system "pstogif $ps_file3"; # # Remove ps files and temp command file # system "rm *.ps"; --------------------------------------------------------------------- #magview.cmd .run magview_sdc.pro exit ---------------------------------------------------------------------- ; ; Name: bhsk_plot.pro ; ; Description: PLot b-housekeeping. ; ; Inputs: Components of plot. ; ; Outputs: None. ; ; Author Date Comment ; ---------- -------- ----------- ; Brian Anderson Original code ; ;------------------------------------------------------------------------- ; pro bhsk_plot,t0,t1,bhsk,bhsk_lbl,bchnl,inDate !x.ticks=6 ; number of major tick marks, x-axis !x.minor=5 ; number of minor tick marks !p.charsize=1.5 ; size of characters !x.charsize=0.01 ; size of x-axis characters, set low to suppres !p.background=255 ; white background !p.color=0 ; black forground !p.multi=[0,0,11] !x.margin=[8,1.5] !y.margin=[.1,0.1] pltstr=inDate + " Plotted: "+systime(0) i=0 while (i lt 10) do begin k=bchnl(i) bmax=max(bhsk(k,*)) bmin=min(bhsk(k,*)) bdiff=bmax-bmin if (bdiff lt 1e-3) then begin bmax=bmax+1 bmin=bmin-1 endif else begin bmax=bmax + 0.1*bdiff bmin=bmin - 0.1*bdiff endelse if (i eq 9) then !x.charsize=1.0 plot, bhsk(0,*),bhsk(k,*),xstyle=1,ystyle=1,xrange=[t0,t1],$ yrange=[bmin,bmax],ytitle=bhsk_lbl(k),xtickformat='tm_ticks' if (i eq 9) then xyouts,t0,bmin-(bmax-bmin)*0.8,pltstr i=i+1 endwhile end; ;----------------------------------------------- ; pro bnt_bctp,t0,t1,tb,b,ti,b_ctp,indate !x.ticks=6 ; number of major tick marks, x-axis !x.minor=5 ; number of minor tick marks !p.charsize=1.5 ; size of characters !x.charsize=0.01 ; size of x-axis characters, set low to suppres !p.background=255 ; white background !p.color=0 ; black forground !p.multi=[0,0,7] !x.margin=[8,2] !y.margin=[.1,0.1] bmax=1.1*MAX(ABS(b)) ; print,'Auto scale (0,Default), Uniform scale (1), or Fixed scale (2)?' ; read,ans ans = 0 bmin=0.0 bmax=0.0 if (ans eq 1) then begin bmax=max(b) bmin=min(b) diff=bmax-bmin if (diff lt 0.001) then begin bmax=bmax+0.5 bmin=bmin-0.5 endif else begin bmax=bmax+0.1*diff bmin=bmin-0.1*diff endelse endif getrange,1,ans,bmin,bmax plot, tB,b(0,*),xstyle=1,ystyle=1,xrange=[t0,t1],yrange=[bmin,bmax],$ ytitle='BX',xtickformat='tm_ticks' getrange,2,ans,bmin,bmax plot, tB,b(1,*),xstyle=1,ystyle=1,xrange=[t0,t1],yrange=[bmin,bmax],$ ytitle='BY',xtickformat='tm_ticks' getrange,3,ans,bmin,bmax plot, tB,b(2,*),xstyle=1,ystyle=1,xrange=[t0,t1],yrange=[bmin,bmax],$ ytitle='BZ',xtickformat='tm_ticks' bmin=0.0 bmax=0.0 if (ans eq 1) then begin bmax=max(b_ctp) bmin=min(b_ctp) diff=bmax-bmin if (diff lt 0.001) then begin bmax=bmax+0.5 bmin=bmin-0.5 endif else begin bmax=bmax+0.1*diff bmin=bmin-0.1*diff endelse endif getrange,4,ans,bmin,bmax plot, ti,b_ctp(0,*),xstyle=1,ystyle=1,xrange=[t0,t1],yrange=[bmin,bmax],$ ytitle='BX_CTP',xtickformat='tm_ticks' getrange,5,ans,bmin,bmax plot, ti,b_ctp(1,*),xstyle=1,ystyle=1,xrange=[t0,t1],yrange=[bmin,bmax],$ ytitle='BY_CTP',xtickformat='tm_ticks' !x.charsize=1.0 getrange,6,ans,bmin,bmax plot, ti,b_ctp(2,*),xstyle=1,ystyle=1,xrange=[t0,t1],yrange=[bmin,bmax],$ ytitle='BZ_CTP',xtickformat='tm_ticks' pltstr=inDate + " Plotted: "+systime(0) if (ans eq 0) then begin bmin=min(b_ctp(2,*)) bmax=max(b_ctp(2,*)) end xyouts,t0,bmin-(bmax-bmin)*0.8,pltstr end ;; ; Name: combo_plot.pro ; ; Description: PLot bfield and other values. ; ; Inputs: Components of plot. ; ; Outputs: ; ; Author Date Comment ; ---------- -------- ----------- ; Brian Anderson Original code ; ;------------------------------------------------------------------------- ; pro combo_plot,t0,t1,tb,b,ti,c,it0,it1,clbl,ichnl,screen,inDate !x.ticks=6 ; number of major tick marks, x-axis !x.minor=5 ; number of minor tick marks !p.charsize=1.5 ; size of characters !x.charsize=0.01 ; size of x-axis characters, set low to suppres !p.background=255 ; white background !p.color=0 ; black forground !p.multi=[0,0,10] !x.margin=[8,1.5] !y.margin=[.1,0.1] pltstr=inDate + " Plotted: "+systime(0) ; print,'Auto-scale (0), uniform scale (1), fixed variable scale(2)?' ; read,ans ans = 0 bmax=0. getrange,1,ans,bmin,bmax plot, tB,b(0,*),xstyle=1,ystyle=1,xrange=[t0,t1],yrange=[bmin,bmax],$ ytitle='BX',xtickformat='tm_ticks' getrange,2,ans,bmin,bmax plot, tB,b(1,*),xstyle=1,ystyle=1,xrange=[t0,t1],yrange=[bmin,bmax],$ ytitle='BY',xtickformat='tm_ticks' getrange,3,ans,bmin,bmax plot, tB,b(2,*),xstyle=1,ystyle=1,xrange=[t0,t1],yrange=[bmin,bmax],$ ytitle='BZ',xtickformat='tm_ticks' i=0 while (i lt 6) do begin k=ichnl(i) cmax=max(c(k,*)) cmin=min(c(k,*)) cdiff=cmax-cmin cmax=cmax+0.1*cdiff cmin=cmin-0.1*cdiff if (cdiff lt 1) then begin cmax=cmax+0.5 cmin=cmin-0.5 endif if (i eq 5) then !x.charsize=1.0 plot, ti,c(k,*),xstyle=1,ystyle=1,xrange=[t0,t1],yrange=[cmin,cmax],$ ytitle=clbl(k),xtickformat='tm_ticks' if (i eq 5) then xyouts,t0,cmin-(cmax-cmin)*0.8,pltstr i=i+1 endwhile ;plot, tbdiff,dbTot,xstyle=1,ystyle=1,xrange=[t0,t1],$ ; ytitle='dB',xtickformat='tm_ticks' !x.charsize=1.0 ; plot, tcDiff,dctot,xstyle=1,ystyle=1,xrange=[t0,t1],$ ; ytitle='dI',xtickformat='tm_ticks' ; dcp=abs(transpose(dc)) ; dcp=dcp(it0:it1,*) ; print,'Normalize each row of gray scale? (1=yes,0=no) ; read,ans ; if (ans eq 1) then begin ; i=0 ; while (i lt 31) do begin ; v=max(dcp(*,i)) ; if (v gt 0.0) then dcp(*,i)=dcp(*,i)/max(dcp(*,i)) ; i=i+1 ; endwhile ; endif ; npt=it1-it0+1 ; !x.charsize=0.01 ; if (screen eq 0) then mtv,dcp,60,5,size=[577,300],axes=1 ; if (screen eq 1) then mtv,dcp,30,5,size=[577,300],axes=1 end; Based on XGRS_HDF created : ; ; Wed Jan 3 17:30:05 1996, Chris Chase S1A ; ; ; ; Usage: ; data_struct = ctp_curr('ctp.hdf') ; help,data_struct,/st ;+++++++++++++++++++++++++++++++ ;TOTAL_SOLAR_ARRAY_CURR = get_vdata_field ( fh,'HOUSEKEEPING','Total_Solar_Array_Current') function get_vdata_field, fh, vdata, field, error=error vd_idx = hdf_vd_find(fh, strupcase(vdata)) error = -1 if vd_idx lt 0 then begin return, -1 endif vdh = hdf_vd_attach(fh, vd_idx) if vdh lt 0 then begin print, 'Unable to access '+field+' vdata.' return, -1 endif ;print,' Reading CTP field:',field nrd = hdf_vd_read(vdh, data, fields=field) error = 0 return, data end ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; ; Utility function function CTP_CURR2, file, error=error vdata_names = ['CTP'] ctp_tag_fields = [ $ 'MET', $ ; 'UTC', $ ; 'DQI' $ ; ] ctp_currents = [ $ 'NIS_MAG_DPU_Current', $ ; 0 'MSI_DPU_Current', $ ; 1 'XGRS_DPU_Current', $ ; 2 'Laser_Rangefinder_Current', $ ; 3 'AIU_1_Current', $ ; 4 'AIU_2_Current', $ ; 5 'DSAD_Electric_Current', $ ; 6 'IMU_Current', $ ; 7 'RWA_Elect_1_Current', $ ; 8 'RWA_Elect_2_Current', $ ; 9 'RWA_Elect_3_Current', $ ; 10 'Star_Camera_Current', $ ; 11 'Flight_Computer_1_CU', $ ; 12 'Flight_Computer_2_CU', $ ; 13 'CMD_TLM_Processor_1', $ ; 14 'CMD_TLM_Processor_2', $ ; 15 'Solid_State_Recorder', $ ; 16 'XPNDR_1_Current', $ ; 17 'XPNDR_2_Current', $ ; 18 'TCU_Current', $ ; 19 'SSPA_Power_Converter', $ ; 20 'Instrument_HTR_Bus', $ ; 21 'Spacecraft_HTR_Bus', $ ; 22 'Propulsion_HTR_Bus', $ ; 23 'Pressure_Sensors', $ ; 24 'RWA_Elect_4_Current', $ ; 25 'Battery_Discharge_Current', $ ; 26 'Analog_Shunt_1_Current', $ ; 27 'Analog_Shunt_2_Current', $ ; 28 'Digital_Shunt_Current', $ ; 29 'Total_Solar_Array_Current' $ ; 30 ] lbl = [ $ 'NM_DPU ', $ ;0 'MS_DPU ', $ ;1 'XG_DPU ', $ ;2 'LASER ', $ ;3 'AIU_1 ', $ ;4 'AIU_2 ', $ ;5 'DSAD ', $ ;6 'IMU ', $ ;7 'RWA_E1 ', $ ;8 'RWA_E2 ', $ ;9 'RWA_E3 ', $ ;10 'STR_CAM ', $ ;11 'FLTCOM1 ', $ ;12 'FLTCOM2 ', $ ;13 'C&T_1 ', $ ;14 'C&T_2 ', $ ;15 'SSREC ', $ ;16 'XPNDR1 ', $ ;17 'XPNDR2 ', $ ;18 'TCU ', $ ;19 'PWRCNV ', $ ;20 'HTR_INST', $ ;21 'HTR_SC ', $ ;22 'HTR_PRP ', $ ;23 'PR_SNSE ', $ ;24 'RWA_E4 ', $ ;25 'BTTRY ', $ ;26 'ASHNT1 ', $ ;27 'ASHNT2 ', $ ;28 'DGSHNT ', $ ;29 'SLR_ARRY' $ ;30 ] if not hdf_ishdf(file) then begin print, 'Not an HDF file' return, -1 endif fh = hdf_open(file, /read) ; print,' Openning HDF file - ',file if fh le 0 then begin print,' Unable to open HDF file',file err = 1 goto, error endif MET = get_vdata_field ( fh,'CTP','MET') SZ = SIZE(MET) A_SIZE = SZ(1) ;print, 'MET read (size)',A_SIZE num_current_fields = 31 ; set up arrays ET = dblarr(A_SIZE) DQI = intarr(A_SIZE) currents = intarr(num_current_fields,A_SIZE) ; fill data arrays DQI = get_vdata_field ( fh,'CTP','DQI') ET = get_vdata_field ( fh,'CTP','UTC') for i = 0, num_current_fields-1 do begin ; print,'Reading element:',i,', field name:',ctp_currents(i),', label:',lbl(i) CURRENTS(i,0:A_SIZE-1) = get_vdata_field ( fh,'CTP',ctp_currents(i)) end mag_tube_temp = intarr(A_SIZE) mag_tube_temp(0:A_SIZE-1) = get_vdata_field(fh,'CTP','Magnetometer_G_10_Tube') data = { $ MET : MET , $ DQI : DQI , $ ET : ET , $ CURRENTS : CURRENTS , $ LBL : LBL , $ ctp_currents : ctp_currents, $ mag_tube_temp : mag_tube_temp $ } ; print,'Returning structure of CTP times, data quality, currents and labels' ; help,data,/st return, data error: if fh gt 0 then hdf_close,fh end ; ; Name: dhms2sec.pro ; ; Description: time struct ; ; Inputs: Time in seconds. ; ; Outputs: None. ; ; Author Date Comment ; ---------- -------- ----------- ; Brian Anderson Original code ; ;------------------------------------------------------------------------- ; pro dhms2sec,tstr,tsec tsec=tstr.day*86400.0+tstr.hr*3600.0+tstr.min*60.0+tstr.sec end ; ;----------------------------------------------- ;; ; Name: eval_ctp_field.pro ; ; Description: Evaluate the ctp field. ; ; Inputs: ; ; Outputs: Evaluated ctp field. ; ; Author Date Comment ; ---------- -------- ----------- ; Brian Anderson Original code ; ;------------------------------------------------------------------------- ; pro eval_ctp_field,ti,c,nc,clbl,FScrnt,b_ctp crnt2BX_ret=[ 0.084, -1.208, -0.681, -0.680, -0.499, -0.564, -0.635, -0.081, 0.085,$ 0.010, -0.693, -0.674, -0.724, -0.694, -1.056, -1.108, -1.209,$ -0.828, -0.778, -1.163, -1.194, 0.000, 0.000, 0.000, -0.692,$ 0.605, 0.000, 0.000, 0.000, 0.000, 0.000] crnt2BY_ret=[-1.744, -7.974, -5.223, -5.424, -3.675, -3.858, -4.121, -2.799, -2.000,$ -2.509, -4.580, -4.350, -5.824, -5.625, -6.821, -7.008, -7.740,$ -6.214, -6.053, -7.275, -7.506, 0.000, 0.000, 0.000, -4.811,$ -2.256, 0.000, 0.000, 0.000, 0.000, 0.000] crnt2BZ_ret=[ 2.654, 8.890, 6.653, 6.834, 5.050, 5.243, 5.522, 4.015, 2.986,$ 3.643, 6.015, 5.767, 7.192, 7.014, 8.021, 8.160, 8.713,$ 7.537, 7.396, 8.360, 8.535, 0.000, 0.000, 0.000, 6.263,$ 3.316, 0.000, 0.000, 0.000, 0.000, 0.000] crnt2BX_pwr=fltarr(31) crnt2BY_pwr=fltarr(31) crnt2BZ_pwr=fltarr(31) crnt2BX_pwr(0:30)=0.5*(0.0-0.488-0.417) crnt2BY_pwr(0:30)=0.5*(1.300+1.104) crnt2BZ_pwr(0:30)=0.5*(0.0-1.022-0.853) crnt2BX_pwr(21:23)=0.0 crnt2BY_pwr(21:23)=0.0 crnt2BZ_pwr(21:23)=0.0 crnt2BX_pwr(26:30)=0.0 crnt2BY_pwr(26:30)=0.0 crnt2BZ_pwr(26:30)=0.0 crnt2BX_pwr(14)=-0.605 crnt2BY_pwr(14)=1.699 crnt2BZ_pwr(14)=-1.370 crnt2BX_pwr(15)=-0.551 crnt2BY_pwr(15)=1.497 crnt2BZ_pwr(15)=-1.194 crnt2BX_pwr(17)=-0.488 crnt2BY_pwr(17)=1.300 crnt2BZ_pwr(17)=-1.022 crnt2BX_pwr(18)=-0.417 crnt2BY_pwr(18)=1.104 crnt2BZ_pwr(18)=-0.853 b_ctp=fltarr(3,nc) b_ctp(0:2,*)=0. i=1 while(i lt 31) do begin ;print,i,clbl(i),crnt2BX_ret(i),crnt2BX_pwr(i) ;print,i,clbl(i),crnt2BY_ret(i),crnt2BY_pwr(i) ;print,i,clbl(i),crnt2BZ_ret(i),crnt2BZ_pwr(i) b_ctp(0,*)=b_ctp(0,*)+float(c(i,*))/255.0*FScrnt(i)*(crnt2BX_ret(i)+crnt2BX_pwr(i)) b_ctp(1,*)=b_ctp(1,*)+float(c(i,*))/255.0*FScrnt(i)*(crnt2BY_ret(i)+crnt2BY_pwr(i)) b_ctp(2,*)=b_ctp(2,*)+float(c(i,*))/255.0*FScrnt(i)*(crnt2BZ_ret(i)+crnt2BZ_pwr(i)) i=i+1 endwhile end ;;************************getdata_b.pro******************************************* ;****************************************************************************** ; ; Author Date Comment ; ---------- -------- ----------- ; Brian Anderson 1/20/1998 Excised from magview.pro ; ; Added range offset corrections. All offsets are adjusted to be the ; range 3 offsets. - B. J. Anderson 1/20/1998 ; ; $Id: getdata_b.pro,v 1.1 1998/08/07 18:43:26 tothba1 Exp $ ; ; $Log: getdata_b.pro,v $ ; Revision 1.1 1998/08/07 18:43:26 tothba1 ; Initial revision ; ; ;----------------------------------------------- ; pro getdata_b,inBfile,tstart,tstop,tb0,tb,bnt,rng,nb,bhsk,bhsk_lbl,nhsk ; ; sx=[8.0060e-6, 3.0941e-5, 1.26143e-4, 4.9522e-4, 1.96117e-3,$ 7.7071e-3, 3.1380e-2, 1.23300e-1] sy=[7.8930e-6, 3.0944e-5, 1.25294e-4, 4.9332e-4, 1.96487e-3,$ 7.7316e-3, 3.1378e-2, 1.23442e-1] sz=[7.9550e-6, 3.0678e-5, 1.24758e-4, 4.9048e-4, 1.94886e-3,$ 7.6622e-3, 3.1165e-2, 1.22525e-1] mx = [1.0000182, 0.0049797, 0.0055376] my = [-0.0014784, 0.9999819, -0.0055371] mz = [0.0045922, 0.0019468, 1.0000148] ; ox = [0.0,0.0,0.0,0.0,-2.415,-1.565,-46.515,-34.015] ; oy = [0.0,0.0,0.0,0.0, 1.635, 1.640, 30.105, 15.055] ; oz = [0.0,0.0,0.0,0.0,-3.275,-2.135,-54.990,-35.630] ; ; Flyby result: Step from range 5 to 6 errors: ; ox(5,6) adjusted by +25.0 ; oy -24.8 ; oz +20.3 ; ox = [0.0,0.0,0.0,0.0,-2.415,-1.565,-21.515,-19.015] oy = [0.0,0.0,0.0,0.0, 1.635, 1.640, 9.305, -9.754] oz = [0.0,0.0,0.0,0.0,-3.275,-2.135,-34.690,-15.330] sx=16.0*sx sy=16.0*sy sz=16.0*sz rate=[0.01,0.02,0.05,0.1,0.2,0.5,1.0,2.0,5.0,10.0,20.0] ; rate=[20.0,10.0,5.0,2.0,1.0,0.5,0.2,0.1,0.05,0.02,0.01] jrng=9 jrate=14 jmet=0 joffset=20 jac=10 bhsk_lbl=['MET ','DQI ','MAG_ON','CAL_ON',$ 'CAL_AD','RNG_AM','NSEREJ','FILTER','MAN_RN',$ 'RANGE ','ACAXIS','RNGDWN','RNG_UP','SPIKES','RATE ',$ 'I_DCDC','TPROBE','TELECT','T_DPU ','ABORT ','OFFSET'] ; print,'File selected: ',inBfile ibstart=long(0) ibstop=long(0) ibhsk0=long(0) ibhsk1=long(0) ictp0=long(0) ictp1=long(0) bdat=mag_hdf(inBfile) bhsk=bdat.mag_hsk st=size(bdat.mag_hsk) nhsk=st(2) nb=long(44*st(2)) ;print,'Size(bdat.mag_hsk):',st ;print,'Calculated nb:',nb tb=dblarr(nb) b=fltarr(4,nb) b_temp=fltarr(4) bnt=fltarr(4,nb) rng=intarr(nb) bmet0=bdat.mag_hsk(jmet,0) tb0=double(bmet0) tfirst=tb0 ; print,'tfirst: ',tfirst k=long(0) k9 = long(0) while(k lt nhsk) do begin ; k0=long(k*44) k0 = k9 k1=long(k0+43) irate=bdat.mag_hsk(jrate,k) ; print,'irate = ',irate dt=double(1.00/rate(irate)) offset=(bdat.mag_hsk(joffset,k) mod 32) tpckt=double(bdat.mag_hsk(jmet,k)-bmet0)+double(0.05*offset) if ((tpckt) lt tstart) then begin ibhsk0=k endif if ((tpckt) le tstop) then begin ibhsk1=k endif ; if (irate eq 10) then begin ; print,'offset = ',offset ; print,'mag_hsk(jofset) ',bdat.mag_hsk(joffset,k) ; print,'0.05*dbl(offset) ',0.05*double(offset) ; print,'rate(irate): ',rate(irate) ; print,'dt: ',dt ; print,'tpckt: ',tpckt ; endif i=long(0) igood = i while (i lt 44) do begin ; k9=k0+i k9 = k0 + igood if (k9 ge nb) then begin ; print,'K9 too large: k9,nb',k9,nb endif if (k9 lt 0) then begin ; print,'k9 too small: k9,nb',k9,nb endif rng(k9)=bdat.mag_sds(4,i,k) mod 8 ; if (rng(k9) eq 0) then begin ; if ( k9 > 0 ) then begin ; tb(k9)=tb(k9-1) ; b(*,k9)=b(*,k9-1) ; bnt(*,k9)=bnt(*,k9-1) ; endif ; b_temp = float(bdat.mag_sds(0:3,i,k)) ; if( (abs(b_temp(0)) gt 0.01) or (abs(b_temp(1)) gt 0.01) or $ (abs(b_temp(2)) gt 0.01) )then begin tb(k9)=tpckt+double(i*dt) if ((tb(k9)) lt tstart) then begin ibstart=k9 endif if ((tb(k9)) le tstop) then begin ibstop=k9 endif b(*,k9)=float(bdat.mag_sds(0:3,i,k)) rng(k9)=bdat.mag_sds(4,i,k) mod 8 bx=b(0,k9)*sx(rng(k9)) by=b(1,k9)*sy(rng(k9)) bz=b(2,k9)*sz(rng(k9)) bnt(0,k9)=bx*mx(0) + by*mx(1) + bz*mx(2) bnt(1,k9)=bx*my(0) + by*my(1) + bz*my(2) bnt(2,k9)=bx*mz(0) + by*mz(1) + bz*mz(2) ac0=fix(bdat.mag_sds(3,i,k)) ac1=(ac0 mod 16) ac2=(ac0-ac1)/16 b(3,k9)=(float(ac1)*(2.0^float(ac2))) case bdat.mag_hsk(jac,k) of 0: bnt(3,k9)=b(3,k9)*sx(rng(k9)) 1: bnt(3,k9)=b(3,k9)*sy(rng(k9)) 2: bnt(3,k9)=b(3,k9)*sz(rng(k9)) else: bnt(3,k9)=b(3,k9)*sz(rng(k9)) endcase if (b(3,k9) gt 1.0) then b(3,k9)=alog10(b(3,k9)) if (bnt(3,k9) gt 1.0) then bnt(3,k9)=alog10(bnt(3,k9)) igood = igood + 1 nb = k9 endif i=i+1 endwhile k9 = k0 + igood k=k+1 endwhile ; print,'B-field start time:',tb0 tb=tb-0.66 ; magnetometer internal time latency correction ; 0.50 seconds due to noise rejection algorithm ; 0.16 seconds due to analog electronics bhsk(0,*)=bhsk(0,*)-tb0 bsc=bnt ; BZSC = BZMAG Added 6/5/96 bsc(0,*)=bnt(1,*) ; BXSC = BYMAG bsc(1,*)=-1.0*bnt(0,*) ; BYSC = -BXMAG bnt=bsc ; replace bnt with B in S/C coordinates. bnt(0,*) = bnt(0,*) + ox(rng(*)) bnt(1,*) = bnt(1,*) + oy(rng(*)) bnt(2,*) = bnt(2,*) + oz(rng(*)) b=0 bsc=0 bdat=0 ; ; Cut arrays down to time range requested: ; if (ibstop+1 lt nb) then begin ibstop=ibstop+1 endif if (ibhsk1+1 lt nhsk) then begin ibhsk1=ibhsk1+1 endif nb=ibstop-ibstart+1 nhsk=ibhsk1-ibhsk0+1 tb=tb(ibstart:ibstop) ;b=b(*,ibstart:ibstop) bnt=bnt(*,ibstart:ibstop) rng=rng(ibstart:ibstop) bhsk=bhsk(*,ibhsk0:ibhsk1) ; ; Converting temperatures and currents to engineering units. ; The "FOTRAN" statements are included as comments as the IDL ; though efficient is cryptic. ; ;TPROBE: ;cnt(i)=bhsk(16,i) ;if (cnt(i).lt.128.0) bhsk(16,i)=17.7 - 0.55*cnt(i) ;if (cnt(i).gr.128.0) bhsk(16,i)=158.5 - 0.55*cnt(i) ; ; ;TELECT & T_DPU: ;cnt(i)=bhsk(17,i) ;if (cnt(i).lt.128.0) bhsk(17,i)=18.5 +0.6134*cnt(i) ;if (cnt(i).gr.128.0) bhsk(17,i)=-138.5+0.6134*cnt(i) ; ;cnt(i)=bhsk(18,i) ;if (cnt(i).lt.128.0) bhsk(18,i)=18.5 +0.6134*cnt(i) ;if (cnt(i).gr.128.0) bhsk(18,i)=-138.5+0.6134*cnt(i) ; ;I_DCDC: ;bhsk(15,*)=496.68-3.95*bhsk(15,*) bhsk= float(bhsk) bhsk(15,*) = (bhsk(15,*) * (-3.953)) + 496.68 temp_16 = bhsk(16,*) counter = 0 dummay_array = where((temp_16 le 128.0),counter) if (counter gt 0) then begin temp_16(where(temp_16 le 128.0)) = 17.7 -$ (0.55*temp_16(where(temp_16 le 128.0))) endif counter = 0 dummay_array = where((temp_16 gt 128.0),counter) if (counter gt 0) then begin temp_16(where(temp_16 gt 128.0)) = 158.5 -$ (0.55*temp_16(where(temp_16 gt 128.0))) endif bhsk(16,*) = temp_16 temp_17 = bhsk(17,*) counter = 0 dummy_array = where((temp_17 le 128),counter) if (counter gt 0 ) then begin temp_17(where(temp_17 le 128.0)) = 18.5 +$ (0.6134*temp_17(where(temp_17 le 128.0))) endif counter = 0 dummay_array = where((temp_17 gt 128.0),counter) if (counter gt 0 ) then begin temp_17(where(temp_17 gt 128.0)) = -138.5 +$ (0.6134*temp_17(where(temp_17 gt 128.0))) endif bhsk(17,*) = temp_17 temp_18 = bhsk(18,*) counter = 0 dummy_array = where((temp_18 le 128.0),counter) if (counter gt 0) then begin temp_18(where(temp_18 le 128.0)) = 18.5 +$ (0.6134*temp_18(where(temp_18 le 128.0))) endif counter = 0 dummy_array = where((temp_18 gt 128.0),counter) if (counter gt 0) then begin temp_18(where(temp_18 gt 128.0)) = -138.5 +$ (0.6134*temp_18(where(temp_18 gt 128.0))) endif bhsk(18,*) = temp_18 ; print,'B-field index range: ',ibstart,ibstop ; print,'B-field time range: ',tb(0),tb(ibstop-ibstart) ;stop ; print,'B-hsk index range: ',ibhsk0,ibhsk1 ; print,'B-hsk time range: ',bhsk(0,0),bhsk(0,ibhsk1-ibhsk0) end ; ;****************************************************************************** ;****************************************************************************** ;************************getdata_ctp.pro******************************************* ;****************************************************************************** ; ; Author Date Comment ; ---------- -------- ----------- ; Brian Anderson 1/20/1998 Excised from magview.pro ; ; Added range offset corrections. All offsets are adjusted to be the ; range 3 offsets. - B. J. Anderson 1/20/1998 ; ; $Id: getdata_ctp.pro,v 1.1 1998/08/07 18:43:47 tothba1 Exp $ ; ; $Log: getdata_ctp.pro,v $ ; Revision 1.1 1998/08/07 18:43:47 tothba1 ; Initial revision ; ; ;----------------------------------------------- ; pro getdata_ctp,inIfile,tstart,tstop,tb0,tc0,ti,c,nc,clbl,m_tube_temp ictp0=long(0) ictp1=long(0) ti=0. c=0. ctp = ctp_curr2(inIfile) st=size(ctp.met) nc=long(st(1));-10 ;print,nc tc0=float(ctp.met(0)) ; print,'CTP start time: ',tc0 ti=temporary(double(ctp.met(0:nc-1)-tb0)) ;c=fix(ctp.currents(*,0:nc-1)) clbl=ctp.lbl ;ctp=0 i=long(1) di=long(1) while (i lt nc-1) do begin if ((ti(i)) lt tstart) then begin ictp0=i endif if ((ti(i)) le tstop) then begin ictp1=i endif if ((ti(i) lt -7200.0) or (ti(i) gt 1.5*86400.0)) then begin i0=i print,'Bad point found:',i0,ti(i0-1),ti(i0) ;ti(i0:nc-2)=ti(i0+1:nc-1) ;c(*,i0:nc-2)=c(*,i0+1:nc-1) ;nc=nc-1 ;i=i-1 endif i=i+1 endwhile ; ; Cut arrays down to time range requested: ; if (ictp1+1 lt nc) then begin ictp1=ictp1+1 endif ctp.currents=temporary(ctp.currents(*,ictp0:ictp1)) ti=ti(ictp0:ictp1) c=temporary(ctp.currents) m_tube_temp = ctp.mag_tube_temp(ictp0:ictp1) nc=ictp1-ictp0+1 ; print,'CTP index range: ',ictp0,ictp1 ; print,'CTP time range: ',ti(0),ti(ictp1-ictp0) end ; ;****************************************************************************** ;****************************************************************************** ; ; Name: magview_wrapper.pl ; ; Description: Set range max and min. ; ; Inputs: Falg for default value. ; ; Outputs: None. ; ; Author Date Comment ; ---------- -------- ----------- ; Brian Anderson Original code ; ;------------------------------------------------------------------------- pro getrange,axs,flag,bmin,bmax case flag of 0: begin bmin=0.0 bmax=0.0 end 1: return 2: begin print,'Enter limits for panel #',axs,' min,max:' read,bmin,bmax end else: return endcase return end;+ ;; $Id: mag_hdf.pro,v 1.1 1997/07/17 17:18:42 tothba1 Exp $ ; ; NAME: ; ; MAG_HDF ; ; PURPOSE: ; ; Extract an array from an NEAR MAG HDF file or other HDF file. ; ; CATEGORY: ; ; NEAR SDC. ; ; CALLING SEQUENCE: ; ; Result = MAG_HDF(File, Ds, [Start, Last, Stride]) ; ; INPUTS: ; ; File - (string) Path of the HDF file. ; ; Ds - (string) Dataset name. Can be abbreviated as long as it is ; unambiguous. Currently valid datasets are: ; ; Science Data Sets: ; "X_DATA", ; "Y_DATA", ; "Z_DATA", ; "AC_DATA", ; "NOISE_DATA", ; ; ; mag_vdata_id = Create_Vdata( vdata_file_id, ; mag_vars, ; FULL_INTERLACE, ; "MAG_HEADER_VARS", ; "HOUSEKEEPING", ; 0 ); ; ; struct vdata_struct mag_vars[] = ; { ; "MET", DFNT_UINT32, 1, ; "UTC", DFNT_UINT32, 2, ; "DQI", DFNT_UINT32, 1, ; "MAG_ON_OFF", DFNT_UINT8, 1, ; "CAL_ON_OFF", DFNT_UINT8, 1, ; "CAL_A_D", DFNT_UINT8, 1, ; "RANGE_MAN_AUTO", DFNT_UINT8, 1, ; "NOISE_REJ_ON_OFF", DFNT_UINT8, 1, ; "SW_ANTI_ALIAS_FILT", DFNT_UINT8, 1, ; "MANUAL_RANGE", DFNT_UINT8, 1, ; "ACTUAL_RANGE", DFNT_UINT8, 1, ; "AC_AXIS_SELECT", DFNT_UINT8, 1, ; "RNG_CHNG_MORE_SENS", DFNT_UINT8, 1, ; "RNG_CHNG_LESS_SENS", DFNT_UINT8, 1, ; "NOISE_SPIKE_COUNT", DFNT_UINT8, 1, ; "SAMPLE_RATE", DFNT_UINT8, 1, ; "MAG_DC_DC_CURR", DFNT_UINT8, 1, ; "PROBE_TEMP", DFNT_UINT8, 1, ; "MAG_ELECT_TEMP", DFNT_UINT8, 1, ; "DPU_DC_DC_TEMP", DFNT_UINT8, 1, ; "RECORD_ABORTED", DFNT_UINT8, 1, ; "TIME_TAG" , DFNT_UINT8, 1, ; "", 0, 0 ;}; function get_vdata_field, fh, vdata, field, error=error vd_idx = hdf_vd_find(fh, strupcase(vdata)) error = -1 if vd_idx lt 0 then begin return, -1 endif vdh = hdf_vd_attach(fh, vd_idx) if vdh lt 0 then begin print, 'Unable to access '+field+' vdata.' return, -1 endif ;print,' Reading ',field nrd = hdf_vd_read(vdh, data, fields=strupcase(field)) error = 0 return, data end ;------------------------------------------------------------------------------- function mag_hdf, file mag_sds_names = [ $ 'X_DATA', $ 'Y_DATA', $ 'Z_DATA', $ 'AC_DATA', $ 'NOISE_DATA' $ ] mag_hsk_names = [ $ 'MET', $ ; 'UTC', $ 'DQI', $ 'MAG_ON_OFF', $ 'CAL_ON_OFF', $ 'CAL_A_D', $ 'RANGE_MAN_AUTO', $ 'NOISE_REJ_ON_OFF', $ 'SW_ANTI_ALIAS_FILT', $ 'MANUAL_RANGE', $ 'ACTUAL_RANGE', $ 'AC_AXIS_SELECT', $ 'RNG_CHNG_MORE_SENS', $ 'RNG_CHNG_LESS_SENS', $ 'NOISE_SPIKE_COUNT', $ 'SAMPLE_RATE', $ 'MAG_DC_DC_CURR', $ 'PROBE_TEMP', $ 'MAG_ELECT_TEMP', $ 'DPU_DC_DC_TEMP', $ 'RECORD_ABORTED', $ 'TIME_TAG' $ ] nvdata = 21 ; Open the HDF file fh = hdf_open(file, /read) ; print,' Openning HDF file - ',file if fh le 0 then begin print,' Unable to open HDF file',file err = 1 goto, error endif ; Get the number of MET values to find the number of 44 sample science records ; Create vdata and sds arrays to hold this number of science records met = get_vdata_field(fh,'MAG_HEADER_VARS', 'MET', error=err) sz = size(MET) nsds = sz(1) ;print,'Number of data records= ',nsds mag_hsk = lonarr(nvdata,nsds) mag_sds = lonarr(5,44,nsds) ; get all of the data from each of the 44 sample science record science data sets for ids = 0,4 do begin sd_id = hdf_sd_start(file, /read) data = 0 sd_idx = hdf_sd_nametoindex(sd_id, mag_sds_names(ids)) ; print,'Reading element ',ids,' ',mag_sds_names(ids) if sd_idx lt 0 then begin ;; The data set name no longer exits? print, 'Unable to access requested data set:',mag_sds_names(ids) print, 'Please report this error (the data set name may have changed).' goto, error endif sdh = hdf_sd_select(sd_id, sd_idx) if sdh lt 0 then begin print, 'Unable to access data set.' goto, error endif hdf_sd_getinfo, sdh, dims=d sz = d(0) hdf_sd_getdata, sdh, msds ; help,msds mag_sds(ids,0:43,0:nsds-1) = msds hdf_sd_end,sd_id end ; get all of the data for each of the science housekeeping vdatas for iv = 0, nvdata-1 do begin ; print,'Reading element ',iv,' ',mag_hsk_names(iv) mag_hsk(iv,0:nsds-1) = get_vdata_field ( fh,'MAG_HEADER_VARS',mag_hsk_names(iv)) end data = { $ mag_hsk_names:mag_hsk_names, $ mag_sds_names:mag_sds_names, $ mag_hsk:mag_hsk, $ mag_sds:mag_sds $ } return, data error: if fh gt 0 then hdf_close,fh end ; ; Name: magview_sdc.pro ; ; Description: Modified magview.pro to produce daily ascii dump files ; and daily plots. ; ; Inputs: year and doy ; ; Outputs: Daily ascii dump files and daily plots. ; ; Author Date Comment ; ---------- -------- ----------- ; Brian Anderson Original code ; Bruce Toth 10/98 Modified for SDC use. ; ;-------------------------------------------------------------------------- ; ichnl=[21,22,23,27,29,30,11,0,2,4] ; default display channels bchnl=[14,13,3,20,9,8,15,16,17,18] ; default MAG HSK channels Kdiff=[-1.0,1.0] Kavg=[0.5,0.5] ptypstr=['B only','MAG Housekeeping','S/C Currents','B & S/C Currents',$ 'B w. B_ctp'] outstr=['To screen','Post-script File'] inDate = ' ' in2YR = ' ' inYR = ' ' inDOY = ' ' ; print,'Enter date of data to read: YYYY,DDD' read,inYR,inDOY intYR=FIX(inYR) if (intYR lt 2000) then begin intYR=intYR-1900 inDate = STRING(format='(i2,a3)',intYR,inDOY) ;inDate=in2YR+inDOY endif else begin ; date later than 2000 intYR=intYR-2000 inDate = STRING(format='(i2.2,a3)',intYR,inDOY) endelse inIfile='/project/near/SDC_archive/SDC_HDF/CTP/'+inYR+'/sac'+inDate+'.hdf' inBfile='/project/near/SDC_archive/SDC_HDF/MAG/'+inYR+'/sam'+inDate+'.hdf' hr0 = -2 hr1 = 26 tstart=double(3600.0*hr0) tstop=double(3600.0*hr1) getdata_b,inBfile,tstart,tstop,tb0,tb,bnt,rng,nb,bhsk,bhsk_lbl,nhsk getdata_ctp,inIfile,tstart,tstop,tb0,tc0,ti,c,nc,clbl,m_tube_temp FScrnt=[0.660, 0.670, 1.400, 0.800, 0.650, 0.650, 0.040, 1.680, 1.500, 1.500,$ 1.500, 0.614, 0.422, 0.422, 0.400, 0.400, 0.571, 0.421, 0.421, 0.138,$ 1.500, 5.560, 5.000, 4.850, 0.200, 1.500,15.000,10.000,10.000,75.000,75.0] eval_ctp_field,ti,c,nc,clbl,FScrnt,b_ctp sec2dhms,tb(nb-1),tb1str sec2dhms,tb0,tb0str sec2dhms,ti(nc-1),ti1str sec2dhms,ti(0),ti0str t0str=ti0str t1str=ti0str t0str.day = 0; t0str.hr = -1; t0str.min = 0; t0str.sec = 0; t1str.day = 1; t1str.hr = 1; t1str.min = 0; t1str.sec = 0; dhms2sec,t0str,t0 dhms2sec,t1str,t1 ans = 0 i=long(1) it0=long(0) it1=long(nc-1) while (i lt nc) do begin if ((ti(i-1) le t0) and (ti(i) gt t0) ) then begin it0=i-1 if (ans eq 1) then t0=ti(i-1) endif if ((ti(i-1) lt t1) and (ti(i) ge t1) ) then begin it1=i if (ans eq 1) then t1=ti(i) endif i=i+1 endwhile ; interpolate to fill in data tprobe_bhsk = bhsk(16,*) bhsk_t = bhsk(0,*) + tb0; ctp_t = ti + tb0 bhsk_result = interpol(tprobe_bhsk,bhsk_t,ctp_t) ; Remove bad temperatures points at the beginning and the end of the file. ;where(ctp_t < bhsk_t(first)) bhsk_result=tprobe_bhsk(first) ;where(ctp_t > bhsk_t(last)) bhsk_result=tprobe_bhsk(last) npt1 = 0 npt2 = 0 temp_bhsk = where(ctp_t lt bhsk_t(0,0),npt1) if (npt1 gt 0) then begin bhsk_result(temp_bhsk) = tprobe_bhsk(0) endif temp_bhsk2 = where(ctp_t gt bhsk_t(0,(n_elements(bhsk_t)-1)),npt2) if (npt2 gt 0 ) then begin bhsk_result(temp_bhsk2) = tprobe_bhsk((n_elements(tprobe_bhsk)-1)) endif ; ; Write the ascii files. ; ASCII_file='b'+inDate+'.dat' openw, 1, ASCII_file printf,1,format='("Day Hr Mn Sec t-t0 (sec) BX, BY, BZ, Range")' i=long(0) while (i lt nb) do begin if ((tb(i) gt t0) and (tb(i) lt t1)) then begin tout=tb(i)+tb0 sec2dhms,tout,toutstr tout=tb(i)-t0 printf,1,format='(1x,i4,2(1x,i3),1x,f6.2,f15.2,3(f15.5),i2)',$ toutstr.day,toutstr.hr,toutstr.min,toutstr.sec,$ tout,bnt(0,i),bnt(1,i),bnT(2,i),rng(i) endif i=i+long(1) endwhile close,1 ASCII_file='bhsk'+inDate+'.dat' openw, 1, ASCII_file i=long(0) printf,1,format='("Day Hr Mn Sec t-t0 (sec)",10(",",a6))',$ bhsk_lbl(bchnl(0)),bhsk_lbl(bchnl(1)),bhsk_lbl(bchnl(2)),$ bhsk_lbl(bchnl(3)),$ bhsk_lbl(bchnl(4)),bhsk_lbl(bchnl(5)),bhsk_lbl(bchnl(6)),$ bhsk_lbl(bchnl(7)),bhsk_lbl(bchnl(8)),bhsk_lbl(bchnl(9)) while (i lt nhsk) do begin if ((bhsk(0,i) gt t0) and (bhsk(0,i) lt t1)) then begin tout=bhsk(0,i)+tb0 sec2dhms,tout,toutstr tout=bhsk(0,i)-t0 printf,1,format='(1x,i4,2(1x,i3),1x,f6.2,f15.2,$)',$ toutstr.day,toutstr.hr,toutstr.min,toutstr.sec,tout j=0 while (j lt 10) do begin k=bchnl(j) ; if (j lt 9) then printf,1,format='($,1x,i6)',bhsk(k,i) ; if (j eq 9) then printf,1,format='(1x,i6)',bhsk(k,i) if (j lt 9) then printf,1,format='($,1x,f9.4)',bhsk(k,i) if (j eq 9) then printf,1,format='(1x,f9.4)',bhsk(k,i) j=j+1 endwhile endif i=i+long(1) endwhile close,1 ASCII_file='ctp'+inDate+'.dat' openw, 1, ASCII_file printf,1,format='("Day Hr Mn Sec t-t0 (sec)",12(",",a8))',$ clbl(ichnl(0)),clbl(ichnl(1)),clbl(ichnl(2)),clbl(ichnl(3)),$ clbl(ichnl(4)),clbl(ichnl(5)),clbl(ichnl(6)),clbl(ichnl(7)),$ clbl(ichnl(8)),clbl(ichnl(9)),'TubeTemp','ProbTemp' i=long(0) first_point = 1 tout_last = tout while (i le it1) do begin if (i ge it0) then begin tout=ti(i)+tb0 sec2dhms,tout,toutstr tout=ti(i)-t0 if ( (abs(tout - tout_last) gt 0.5) or $ (first_point eq 1)) then begin printf,1,format='(1x,i4,2(1x,i3),1x,f6.2,f15.2,$)',$ toutstr.day,toutstr.hr,toutstr.min,toutstr.sec,tout j=0 while (j lt 10) do begin k=ichnl(j) if (j le 9) then printf,1,format='($,1x,i6)',c(k,i) ;; if (j lt 9) then printf,1,format='($,1x,i6)',c(k,i) ;;; if (j eq 9) then printf,1,format='(1x,i6)',c(k,i) j=j+1 endwhile ; printf,1,format='(1x,f6.2)',$ printf,1,format='($,1x,f7.2)',$ 0.803921568627451*m_tube_temp(i)-100 if ( (bhsk_result(i) gt 99.99) or $ (bhsk_result(i) lt -99.99) ) then begin bhsk_result(i) = -99.99 endif printf,1,format='(1x,f7.2)',bhsk_result(i) tout_last = tout first_point = 0 endif endif i=i+long(1) endwhile close,1 ASCII_file='bctp'+inDate+'.dat' openw, 1, ASCII_file printf,1,format='("Day Hr Mn Sec t-t0 (sec),BX_ctp,BY_ctp,BZ_ctp")' i=long(0) first_point = 1 tout_last = tout while (i le it1) do begin if (i ge it0) then begin tout=ti(i)+tb0 sec2dhms,tout,toutstr tout=ti(i)-t0 if ( (abs(tout - tout_last) gt 0.5) or $ (first_point eq 1)) then begin printf,1,format='(1x,i4,2(1x,i3),1x,f6.2,f15.2,3(f15.5))',$ toutstr.day,toutstr.hr,toutstr.min,toutstr.sec,$ tout,b_ctp(0,i),b_ctp(1,i),b_ctp(2,i) tout_last = tout first_point = 0 endif endif i=i+long(1) endwhile close,1 ; ; Create the plots ; set_plot,'ps' user_filename = 'combo'+inDate+'.ps' device,filename=user_filename device,/inches,xoffset=0.5,yoffset=1.0,xsize=6.5,ysize=8.0 device,bits=8 combo_plot,t0,t1,tb,bnT,ti,c,it0,it1,clbl,ichnl,screen,inDate device,/close set_plot,'ps' user_filename = 'bhsk'+inDate+'.ps' device,filename=user_filename device,/inches,xoffset=0.5,yoffset=1.0,xsize=6.5,ysize=8.0 device,bits=8 bhsk_plot,t0,t1,bhsk,bhsk_lbl,bchnl,inDate device,/close set_plot,'ps' user_filename = 'bntbctp'+inDate+'.ps' device,filename=user_filename device,/inches,xoffset=0.5,yoffset=1.0,xsize=6.5,ysize=8.0 device,bits=8 bnt_bctp,t0,t1,tb,bnT,ti,b_ctp,inDate device,/close end; ;----------------------------------------------- ; pro sec2dhms,tsec,tstr st=size(tsec) if (st(0) eq 1) then begin idim=st(1) tstr={day:intarr(idim), hr:intarr(idim), min:intarr(idim), sec:fltarr(idim)} endif if (st(0) eq 0) then begin idim=1 tstr={day:0, hr:0, min:0, sec:0.} endif ; print,idim tstr.day=fix(tsec/86400.0) tstr.hr=fix((tsec-tstr.day*86400.0)/3600.0) tstr.min=fix((tsec-tstr.day*86400.0-tstr.hr*3600.0)/60.0) tstr.sec=tsec-tstr.day*86400.0-tstr.hr*3600.0-tstr.min*60.0 end ; ;-----------------------------------------------; ; Name: tm_ticks.pro ; ; Description: Time tick specification ; ; Inputs: time ; ; Outputs: Time tick label ; ; Author Date Comment ; ---------- -------- ----------- ; Brian Anderson Original code ; ;-------------------------------------------------------------------------; ; function tm_ticks,axis,index,value hour=long(value)/3600 minute=long(value-3600*hour)/60 sec=value mod 60 return,string(hour,minute,sec,format="(i2.2, ':',i2.2,':',i2.2)") end 1