[Thread Prev][Thread Next][Index]

Re: [ferret_users] regridding in a repeat loop



Hi David,
Thanks for the example using datasets we can all try.

This isn't because you're doing this in a repeat loop, but just the sequence of two regridding operations using the ROSE variable. Ferret sees that it has ROSE in memory from the first operation and tries to reuse that. But it should get the variable with a slightly different set of indices for the second operation to the grid of dataset 2.

The commands in your script boil down to these:

   can data/a
use
   "http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NODC/.WOA01/.Grid-1x1/.Annual/.an/.temperature/dods";
   use
   "http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NODC/.WOA01/.Grid-5x5/.Annual/.mn/.temperature/dods";
   use etopo20
DEFINE VARIABLE mask = if rose[d=etopo20,gxy=temperature[d=1]@nrst]
   le 0 then 1
   shade/k=1 temperature[d=1]*mask
   cancel var mask
   DEFINE VARIABLE mask = if rose[d=etopo20,gxy=temperature[d=2]@nrst]
   le 0 then 1
   shade/k=1 temperature[d=2]*mask


If you put a CANCEL MEMORY before the second SHADE command you'll see the problem go away. Looking at the output of SET MODE DIAGNOSTIC there are differences in the operations surrounding regridding of ROSE, and it's using too small a set of indices in the J direction.

It seems to me that the behavior you're seeing may be a bug, but the easy workaround for you is to have a CANCEL MEMORY before the end of your loop.

Ansley

David Wang wrote:
Hello Ferreters,

I encountered a bizarre problem when doing regridding within a repeat command. The following is a reproducible example to illustrate the problem.

can data/a

use "http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NODC/.WOA01/.Grid-1x1/.Annual/.an/.temperature/dods"; use "http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NODC/.WOA01/.Grid-5x5/.Annual/.mn/.temperature/dods";
use etopo20

repeat/range=1:2/name=m \
(let mask = if rose[d=etopo20,gxy=temperature[d=`m`]@nrst] le 0 then 1; \
 shade/k=1 temperature[d=`m`]*mask; \
 pause; \
 can var mask; \
 can view; \
)

What this script essentially does is to mask out all the land grid points in the original data (it of course makes little sense here since the original data are already ocean-only, but my working wind stress data do have valid values over both lands and oceans). But if you execute the above script, you will find the masking in the second plot gets messed up. What's not intelligible to me is that if I mask the second data alone, the resultant plot appears simply all right. This is on Ferret v6.1 32-bit Linux version.

Did I miss anything obvious? Thanks!
David



[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement