; ; PURPOSE: read a WSO SC data file obtained from WSO Web ; NOTE: Latitudal grid is not regular (SIN(lat)) ; WRITTEN: 02May2000 Xuepu Zhao ; FUNCTION readwsosc,scfile,CALI=cali,BR=br,DISP=disp, cvar=cvar, header=header, badfile=badfile if n_params() LT 1 then $ message, 'SYNTAX - result = readwsosc(scfile,/cali,/br,/disp)' ;xsz = 72 ;ysz = 30 ;str=' ' ;wsc=fltarr(xsz,ysz) ;sct=strarr(xsz) ;bl=fltarr(ysz) ;get_lun,unit ;openr,unit,scfile ;for k=0,2 do readf,unit,str ;fmt='(a18,6f9.3,3(/,8f9.3))' ;for xi=0,xsz-1 do begin ; readf,unit,format=fmt,str,bl ; wsc(xi,*)=bl ; sct(xi)=str ;endfor ;free_lun,unit ;wsc0=wsc ;for i=0,xsz-1 do for j=0,ysz-1 do wsc(i,j)=wsc0(xsz-1-i,ysz-1-j) ; match zgrid.pro ;============ ; Replacement code to read photospheric files ;wsc1 = wsc ;sct1 = sct badfile = 1-wso_read(scfile, wsc, rot=rot, long=long, /dropfirst, cvar=cvar, header=header) if badfile then return, badfile ; PPH: make sure the arrays are filled with valid magnetic field data. badfile = total(1-finite(wsc)) ne 0 if badfile then return, badfile sct = reverse('CT'+string(rot,format='(I4.4)')+':'+string(long,format='(I3.3)')+' ') ;whatis, wsc1,wsc,sct1,sct ;print, where(wsc1 ne wsc, nn1), where(sct1 ne sct, nn) ;if nn1 ne 0 or nn ne 0 then message, 'stop' ;=========== sz = size(wsc,/dim) xsz = sz[0] ysz = sz[1] zgrid,xsz,ysz,phd,thd,lad,cth,sth,csc,scs if keyword_set(cali) then begin ;wsc = wsc*SuperArray(4.5-cth*cth*2.5,xsz,/lead) for j=0,ysz-1 do wsc(*,j)=wsc(*,j)*(4.5-2.5*cth(j)*cth(j)) endif if keyword_set(br) then begin ;wsc = wsc/SuperArray(sth,xsz,/lead) for j=0,ysz-1 do wsc(*,j)=wsc(*,j)/sth(j) endif if keyword_set(disp) then begin srt=strmid(sct(0),2,4) ttw='WSO Synoptic Chart CR'+srt wsccon=CONGRID(wsc,432,180,/interp) wscsmt=SMOOTH(wsccon,6,/edge_truncate) bwscsmt=BYTSCL(wscsmt,max=250,min=-250) pimg0,bwscsmt,ttw,px,py sc_annot,1,/norm CONTOUR,wscsmt,POS=[px(0),py(0),px(1),py(1)],$ level=[0],c_colors=[250],c_thick=[2],$ xstyle=5,ystyle=5,/dev,/noerase endif return, wsc & end