pro shift_div, imone, imtwo, xshift, yshift, imnew, DZV=DIV_ZERO_VAL ; imone gets shifted by xshift and yshift, then divided by imtwo ; any pixels that get divided by zero are given the value DIV_ZERO zmask = imtwo eq 0 ; where the zeros are nzmask = imtwo ne 0 ; where the non-zeros are imtwo_b = imtwo + zmask ; make all the zeros ones imnew = shift_im_cbc(imone, xshift, yshift) / imtwo_b ; do the shifting and ; division if KEYWORD_SET(DIV_ZERO_VAL) then $ imnew = imnew * nzmask + (zmask * DIV_ZERO_VAL) $ else imnew = imnew * nzmask imstat, imnew[335:1005, 325:975] end