IridiumMaccs3.pro

InfoInfo
Search:    

PRO IridiumMACCS3,filename

;This program is run by ftpsri.sh at :00, :15, :30, and :45 past every hour of every day.

;It creates IAGA2000 format ASCII files from the raw MACCS Iridium data.

;Overhaul Modifications by Michael Murphy Augsut 1, 2007 to begin working for 2 Maccs station

;Modifications by Erik Johnson August 15, 2007 to run on yspace from a script (maccsprocessing.sh)

;Modifications by Erik Johnson August 16, 2007 to comply with the IAGA2000 Data Exchange Format

numsamples=(test_array(10)-9)/3/3

xvalue=fltarr(numsamples,file_size)

yvalue=fltarr(numsamples,file_size)

zvalue=fltarr(numsamples,file_size)

timevalue=data_array(4,*)*3600.0+data_array(5,*)*60.0+data_array(6,*)

FOR i=0,numsamples-1 DO BEGIN

xvalue(i,*)=(data_array(18+(i*9),*)*65536l+data_array(19+(i*9),*)*256l+data_array(20+(i*9),*))*0.025

yvalue(i,*)=(data_array(21+(i*9),*)*65536l+data_array(22+(i*9),*)*256l+data_array(23+(i*9),*))*0.025

zvalue(i,*)=(data_array(24+(i*9),*)*65536l+data_array(25+(i*9),*)*256l+data_array(26+(i*9),*))*0.025

ENDFOR

n=findgen(file_size)

nstep=n

n=n*2

bx=fltarr(file_size*2l)

by=bx

bz=bx

bx[n]=xvalue[0,nstep]

bx[n+1]= xvalue[1,nstep]

by[n]=yvalue[0,nstep]

by[n+1]= yvalue[1,nstep]

bz[n]=zvalue[0,nstep]

bz[n+1]= zvalue[1,nstep]

Dtime=dblarr(file_size*2l)

Dtime[n]=timevalue[0,nstep]+ 0.25

Dtime[n+1]= timevalue[0,nstep]+ 0.75

;Section for writing data

lab =

label=strmid(filename,0,2)

labelx=strmid(filename,2,5)

yrday=fix(labelx)

MMDD, YRDAY, MON, DAY

year=strmid(labelx,0,2)

year1=fix(year)

if year1 ge 92 then begin

endif else begin

endelse

;Create The 11 mandatory file header records

line1=' Format | IAGA2000 |'

if label eq 'NA' then begin

if label eq 'CD' then begin

line7=' Observed | XYZ |'

line8=' Digital Sampling | 0.5 seconds |'

line9=' Data Interval | 0.5 seconds |'

line10=' Data type | Variation |'

line11=' Variables | 9 |'

line12=' # For more information visit [WWW]http://space.augsburg.edu |'

line13=' Year| MT| DY| HR| MN| SC| CDRX| CDRY| CDRZ|'

length=size(bx,/n_elements)

newarray = fltarr(4,length)

stringarr = strarr(1,length)

;newarray[0,*]= ' '

newarray[0,*]= Dtime

newarray[1,*] = bx

newarray[2,*] = by

newarray[3,*] = bz

for i=1l, length, 1 do begin

totals = newarray[0,i-1]

hour = fix(totals/3600)

totals = totals - (hour*3600l)

min = fix(totals/60)

sec = fix(totals - (min*60))

data = string(year, mon, day, hour, min, sec, newarray[1,i-1],newarray[2,i-1],newarray[3,i-1], $

stringarr[0,i-1] = data

endfor

openw, 2,'/Volumes/physics_data/Ftp/MACCS_DATA/IAGA2000/'+label+'/'+year+'ir/'+label+labelx+'.dat',width=107

printf,2,line1

printf,2,line2

printf,2,line3

printf,2,line4

printf,2,line5

printf,2,line6

printf,2,line7

printf,2,line8

printf,2,line9

printf,2,line10

printf,2,line11

printf,2,line12

printf,2,line13

printf,2,stringarr

;printf,2,newarray,format='(f8.2,3f15.3)'

close, 2

print, 'program finished'

END

PRO MMDD,YRDAY,MONTH,MNTHDA,IYR

; 11 NOV 85 S FAVIN

; GIVEN YRDAY LIKE 85199

; RETURNS WITH CHARACTER MONTH AND DAY NUMBER IN MONTH

LEAPYR = [0,0,31,60,91,121,152,182,213,244,274,305,335,366]

NOLEAP = [0,0,31,59,90,120,151,181,212,243,273,304,334,365]

CHARM = [,'1','2','3','4','5','6', $

MONTH =

A365: MONTH = CHARM(MON)

A366: IF((IDAY-LEAPYR(MON)) LE 0) THEN MON = MON - 1

function xticks, axis, index, value

on_error,1

if keyword_set(help) then begin

endif

;hour = fix(value+.5)

hour = fix(value)

if hour gt 23 then hour = hour -24

min = fix(value*60. mod 60.)

sec = fix(value*3600. mod 60. + .5)

if sec eq 60 then begin

endif

if sec eq 0 then begin ;Seconds are not shown on time scale if they are zero.

endif

;min = fix(value*60. mod 60. + .5)

;if min eq 60 then begin

; min = 0

; hour = hour+1

;endif

;sec = fix(value*3600. mod 60. + .5)

;if sec eq 60 then sec = 0

return, string(format = '(i2.2,":",i2.2,":",i2.2)', hour, min, sec)

end

This is a Wiki Spot wiki. Wiki Spot is a non-profit organization that helps communities collaborate via wikis.