PRO curve2polygon,x,y,thr,px,py,Npoly=Npoly mask=1L*y & mask[*]=0L ind=where(y NE thr) mask(ind)=1 df=find_ind(mask,1,count=count) IF count NE 0 THEN BEGIN Npoly=(size(df))(1) px=ptrarr(Npoly) py=ptrarr(Npoly) FOR i=0L,Npoly-1 DO BEGIN polyx=[x[df[i,0]:df[i,1]],x[df[i,1]],x[df[i,0]],x[df[i,0]]] polyy=[y[df[i,0]:df[i,1]],thr ,thr ,y[df[i,0]]] px[i]=ptr_new(polyx) py[i]=ptr_new(polyy) ENDFOR ENDIF END