;+ ;- PRO testinterp method = 'bilinear' ; method = 'imoms3' ; jpia = 300L jpja = 200L torg = findgen(jpia, jpja) xorg = 20.d + 360.d/jpia*dindgen(jpia) yorg = -89.d + 178.d/(jpja-1)*dindgen(jpja) jpio = 400L jpjo = 150L xnew = 0.d + 360.d/jpio*dindgen(jpio) ynew = -89.5d + 179.d/(jpjo-1)*dindgen(jpjo) outnorth = where(ynew GT yorg[jpja-2], noutn) outsouth = where(ynew LT yorg[1], nouts) t2 = fromreg(method, torg, xorg, yorg, xnew, ynew) t3 = fromreg(method, reverse(torg, 2), xorg, reverse(yorg), xnew, ynew) IF array_equal(t2, t3) EQ 0 THEN stop ELSE print, 'ok1' xshift = 20 torg2 = shift(torg, xshift, 0) xorg2 = shift(xorg, xshift) xorg2[0: xshift-1] = xorg2[0: xshift-1]-360 IF array_equal(sort(xorg2), lindgen(n_elements(xorg2))) EQ 0 THEN stop t3 = fromreg(method, torg2, xorg2, yorg, xnew, ynew) IF array_equal(t2, t3) EQ 0 THEN stop ELSE print, 'ok2' xshift = 20 torg2 = shift(torg, xshift, 0) xorg2 = shift(xorg, xshift) xorg2[0: xshift-1] = xorg2[0: xshift-1]-360 IF array_equal(sort(xorg2), lindgen(n_elements(xorg2))) EQ 0 THEN stop t3 = fromreg(method, reverse(torg2, 2), xorg2, reverse(yorg), xnew, ynew) IF array_equal(t2, t3) EQ 0 THEN stop ELSE print, 'ok3' xshift = 20 torg2 = shift(torg, xshift, 0) xorg2 = shift(xorg, xshift) t3 = fromreg(method, torg2, xorg2, yorg, xnew, ynew) IF array_equal(t2, t3) EQ 0 THEN stop ELSE print, 'ok4' xshift = 20 torg2 = shift(torg, xshift, 0) xorg2 = shift(xorg, xshift) t3 = fromreg(method, reverse(torg2, 2), xorg2, reverse(yorg), xnew, ynew) IF array_equal(t2, t3) EQ 0 THEN stop ELSE print, 'ok5' t3 = fromreg(method, torg, xorg, yorg, xnew, ynew, /nonorthernline) IF array_equal(t2[*, 0:jpjo-1-noutn], t3[*, 0:jpjo-1-noutn]) EQ 0 THEN stop ELSE print, 'ok6' FOR i = 1, noutn-1 DO if array_equal(t3[*, jpjo-1], t3[*, jpjo-1-i]) EQ 0 THEN stop ELSE print, 'ok7', i t3 = fromreg(method, torg, xorg, yorg, xnew, ynew, /nosouthernline) IF array_equal(t2[*, nouts:*], t3[*, nouts:*]) EQ 0 THEN stop ELSE print, 'ok8' FOR i = 1, nouts-1 DO if array_equal(t3[*, 0], t3[*, i]) EQ 0 THEN stop ELSE print, 'ok9', i t3 = fromreg(method, reverse(torg, 2), xorg, reverse(yorg), xnew, ynew, /nonorthernline) IF array_equal(t2[*, 0:jpjo-1-noutn], t3[*, 0:jpjo-1-noutn]) EQ 0 THEN stop ELSE print, 'ok10' FOR i = 1, noutn-1 DO if array_equal(t3[*, jpjo-1], t3[*, jpjo-1-i]) EQ 0 THEN stop ELSE print, 'ok11', i t3 = fromreg(method, reverse(torg, 2), xorg, reverse(yorg), xnew, ynew, /nosouthernline) IF array_equal(t2[*, nouts:*], t3[*, nouts:*]) EQ 0 THEN stop ELSE print, 'ok12' FOR i = 1, nouts-1 DO if array_equal(t3[*, 0], t3[*, i]) EQ 0 THEN stop ELSE print, 'ok13', i xshift = 20 torg2 = shift(torg, xshift, 0) xorg2 = shift(xorg, xshift) xorg2[0: xshift-1] = xorg2[0: xshift-1]-360 IF array_equal(sort(xorg2), lindgen(n_elements(xorg2))) EQ 0 THEN stop t3 = fromreg(method, torg2, xorg2, yorg, xnew, ynew, /nonorthernline) IF array_equal(t2[*, 0:jpjo-1-noutn], t3[*, 0:jpjo-1-noutn]) EQ 0 THEN stop ELSE print, 'ok14' FOR i = 1, noutn-1 DO if array_equal(t3[*, jpjo-1], t3[*, jpjo-1-i]) EQ 0 THEN stop ELSE print, 'ok15', i xshift = 20 torg2 = shift(torg, xshift, 0) xorg2 = shift(xorg, xshift) xorg2[0: xshift-1] = xorg2[0: xshift-1]-360 IF array_equal(sort(xorg2), lindgen(n_elements(xorg2))) EQ 0 THEN stop t3 = fromreg(method, torg2, xorg2, yorg, xnew, ynew, /nosouthernline) IF array_equal(t2[*, nouts:*], t3[*, nouts:*]) EQ 0 THEN stop ELSE print, 'ok16' FOR i = 1, nouts-1 DO if array_equal(t3[*, 0], t3[*, i]) EQ 0 THEN stop ELSE print, 'ok17', i xshift = 20 torg2 = shift(torg, xshift, 0) xorg2 = shift(xorg, xshift) xorg2[0: xshift-1] = xorg2[0: xshift-1]-360 IF array_equal(sort(xorg2), lindgen(n_elements(xorg2))) EQ 0 THEN stop t3 = fromreg(method, reverse(torg2, 2), xorg2, reverse(yorg), xnew, ynew, /nonorthernline) IF array_equal(t2[*, 0:jpjo-1-noutn], t3[*, 0:jpjo-1-noutn]) EQ 0 THEN stop ELSE print, 'ok18' FOR i = 1, noutn-1 DO if array_equal(t3[*, jpjo-1], t3[*, jpjo-1-i]) EQ 0 THEN stop ELSE print, 'ok19', i xshift = 20 torg2 = shift(torg, xshift, 0) xorg2 = shift(xorg, xshift) xorg2[0: xshift-1] = xorg2[0: xshift-1]-360 IF array_equal(sort(xorg2), lindgen(n_elements(xorg2))) EQ 0 THEN stop t3 = fromreg(method, reverse(torg2, 2), xorg2, reverse(yorg), xnew, ynew, /nosouthernline) IF array_equal(t2[*, nouts:*], t3[*, nouts:*]) EQ 0 THEN stop ELSE print, 'ok20' FOR i = 1, nouts-1 DO if array_equal(t3[*, 0], t3[*, i]) EQ 0 THEN stop ELSE print, 'ok21', i return end