pro hrhaftp2sun10 ;+ ; Purpose: Transfer Huairou full-disk H-alpha data automatically to sun10 in real time everyday. ; modified from idl_winftp(by wxf,lgh,wgp), edited by yangx, HSOS, 2010-10-25 ; add latitude/longitude grid and limb-darkening correction (ref.: v1 by wxf), yangx, HSOS, 2011-05-14 ; ; Notice: This routine will not stop until 9:00UT. If you want to terminate this procedure when ; it is running, please click the "Break" and then "Stop" buttons in your IDL's toolbars. ;- on_error,2 device,retain=2,decomposed=0 !p.position=[0,0,1,1] loadct,3 month_str=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'] month=['01','02','03','04','05','06','07','08','09','10','11','12'] mm=month(where(month_str eq strmid(systime(),4,3))) dd=strmid(systime(),8,2) hh=strmid(systime(),11,2)+0 if (hh gt 15) then begin dd=dd+1 dd=strmid(string(dd),6,2) endif mmdd=mm+dd dh='G:\Halpha\'+mmdd+'\' ;---directory where halpha data are located ;dh='' ;dh=dialog_pickfile(/directory,/must_exist,title='Please select the directory where halpha data are located') if (dh eq '') then begin print,'HRHAFTP2SUN10: You have canceled setting data directory. Program hrhaftp2sun10.pro is not ruuning now.' return endif dir=strmid(systime(),20,4)+'/'+mmdd lcd='D:\ftpsdg\ftptmp' ;---ftp local working directory print,mmdd print,systime() spawn,'del '+lcd+'\*.fit',/hide spawn,'del '+lcd+'\*.jpg',/hide deadline='09' lastfcnt=0 while (strmid(systime(),11,2) ne deadline) do begin syst=systime() hhmm=strmid(syst,11,2)+strmid(syst,14,2) ;fl=file_search(dh+'HrHa*.fit',count=nn) fl=file_search(dh+'HrHa*full.fit',count=nn) if (nn gt 0) and (nn gt lastfcnt) then begin spawn,'copy '+fl(nn-1)+' '+lcd,/hide lastfcnt=nn endif tf=file_search(lcd+'\*.fit',count=nn) if (nn eq 1) then begin img=readfits(tf(0),hdr) img=swap_endian(img) time=sxpar(hdr,'TIME_OBS') p_angle=get_rb0p(time,/pangle,/deg) ;+ ========================== add latitude/longitude grid and limb-darkening correction (ref.: v1 by wxf) B0 = get_rb0p(time, /b0angle);====The default is radians wxf_sunrim2a,img,xc,yc,radius img=rotate(rot(shift(img,1234.5-xc,1234.5-yc),-p_angle,1.,1234.5,1234.5,/interp,/pivot),5) p = { NX: 2469, NXX: 2469, NY: 2469, NYY: 2469, N: 10, XC: 0, YC: 0, XD: 0, YD: 0, $ INT: 0, INT_I: 0, INT_L: 0} p.xc=1234.5 & p.yc=1234.5 & p.xd=radius*2 & p.yd=p.xd p.int = MEDIAN( img( p.xc - 50 : p.xc + 50, p.yc -50 : p.yc +50 ) ) p.int_i = MEDIAN( img( p.xc - 50 : p.xc + 50, p.yc - 50 : p.yc + 50 ) ) img = img / FLOAT( p.int_i ) * 10000. limb = RESIDUAL_LIMB( img, p, 50, 200, prof ) p.int_l = MEDIAN( limb( p.xc - 50 : p.xc +50, p.yc - 50 : p.yc + 50 ) ) limb = limb / FLOAT( p.int_l ) * 10000. img = img - limb DIST_CIRCLE,IN,[2469,2469],1234.50,1234.50,/DOUBLE img(where(IN gt radius-5))=min(img) IN=0b&limb=0b window,0,xs=2469,ys=2469 tvscl,bytscl(img>(-1800)<1800) ;spherical grid ;the following line is not correct,but I don't know the radius affected by the atmospheric refraction ;Resolution=get_rb0p(time, /radius)/radius; ;Spatial resolution=0.848"/pixel for this CCD install ;Solar radius measured outside earth's atmosphere in arcseconds Rs=get_rb0p(time, /radius)/0.848 xsize=double((size(img))[1]) & ysize=double((size(img))[2]) ;1 Latitude fai2=[-!dpi/180*90,-!dpi/180*75,-!dpi/180*60,-!dpi/180*45,-!dpi/180*30,-!dpi/180*15,$ 0,!dpi/180*15,!dpi/180*30,!dpi/180*45,!dpi/180*60,!dpi/180*75,!dpi/180*90] ;num---------the points' number along different latitudes for i=0,12 do begin num=Rs*1.5*(1- abs(fai2(i))/(!dpi/180*90))+Rs*0.5 theta2=(findgen(num)/(num-1)*2-1)*!dpi*0.5 x=Rs*cos(fai2(i))*sin(theta2) y=Rs*sin(fai2(i))*cos(B0)-Rs*cos(fai2(i))*cos(theta2)*sin(B0) if i eq 0 then plot,x,y,xrange=[0-(xsize-1)/2.,0+(xsize-1)/2.],xstyle=1,yrange=[0-(ysize-1)/2.,0+(ysize-1)/2.],ystyle=1,linestyle=1,/noerase,xticks=2,yticks=2 oplot,x,y,linestyle=1,thick=2.0 endfor ;2 Longitude theta2=[-!dpi/180*90,-!dpi/180*75,-!dpi/180*60,-!dpi/180*45,-!dpi/180*30,-!dpi/180*15,$ 0,!dpi/180*15,!dpi/180*30,!dpi/180*45,!dpi/180*60,!dpi/180*75,!dpi/180*90] for i=0,12 do begin num=Rs*1.5*abs(theta2(i))/(!dpi/180*90)+Rs*0.5 fai2=(findgen(num)/(num-1)*2-1)*!dpi*0.5 x=Rs*cos(fai2)*sin(theta2(i)) y=Rs*sin(fai2)*cos(B0)-Rs*cos(fai2)*cos(theta2(i))*sin(B0) oplot,x,y,linestyle=1,thick=2.0 endfor ;- ========================== add latitude/longitude grid and limb-darkening correction ;window,0,xs=2469,ys=2469 ;tvscl,ha xyouts,0.05,0.96,'Huairou Solar Observing Station',/normal,charsize=4,font=1 date='20'+strmid(tf(0),strlen(tf(0))-20,2)+'-'+strmid(tf(0),strlen(tf(0))-18,2)+'-'+strmid(tf(0),strlen(tf(0))-16,2) time0=strmid(tf(0),strlen(tf(0))-14,2)+':'+strmid(tf(0),strlen(tf(0))-12,2)+':'+strmid(tf(0),strlen(tf(0))-10,2) xyouts,0.05,0.93,'Ha '+date+' '+time0+' UT',charsize=4,font=1,/normal name=lcd+'\'+strmid(tf(0),strlen(tf(0))-24,20)+'.jpg' write_jpeg,name,tvrd(true=1),true=1,quality=100 wdelete,0 openw,1,lcd+'\ftplog.bat' printf,1,'d:' printf,1,'cd '+lcd printf,1,'echo off' printf,1,'echo open 159.226.168.11>ftplog.txt' printf,1,'echo obs>>ftplog.txt' printf,1,'echo pgwhrdb10>>ftplog.txt' printf,1,'echo mkdir /home/ftp/pub/latest/'+strmid(dir,0,4)+'>>ftplog.txt' printf,1,'echo mkdir /home/ftp/pub/latest/'+dir+'>>ftplog.txt' printf,1,'echo cd /home/ftp/pub/latest/'+dir+'>>ftplog.txt' printf,1,'echo pwd>>ftplog.txt' printf,1,'echo lcd '+lcd+'>>ftplog.txt' printf,1,'echo binary>>ftplog.txt' printf,1,'echo prompt>>ftplog.txt' printf,1,'echo mput *.fit>>ftplog.txt' printf,1,'echo mput *.jpg>>ftplog.txt' printf,1,'echo bye>>ftplog.txt' printf,1,'ftp -s:ftplog.txt' close,1 spawn,lcd+'\ftplog.bat',/hide print,'hrhaftp2sun10: FITS file with its JPG image transfered to sun10 is' print,tf(0) print,'hrhaftp2sun10: --------Transfer has been finished.--------' print,'hrhaftp2sun10: -------- Waiting for next transfer --------' file_delete,lcd+'\ftplog.bat' file_delete,lcd+'\ftplog.txt' spawn,'del '+lcd+'\*.fit',/hide spawn,'del '+lcd+'\*.jpg',/hide endif wait,300 endwhile END