[Thread Prev][Thread Next][Index]

Re: [ferret_users] undesirable missing_value



Hi everyone,
What Martin says is absolutely correct, but there is a way to specify the region of interest without writing intermediate files. If you want to average over some region, specify that region within the square brackets

temp[x=138:290@ave,y=-23.5:23.5@ave]

This is one number (for each depth and time that the variable may have)

The expression,

temp[x=@ave,y=@ave]

is not evaluated until an "action" command is issued -- a plotting command, a LIST command to list data to the screen or a file, or a LOAD command to load a variable containing the expression into memory. Whatever contxt is in effect for the action will determine the range of X and Y over which the average is applied.

Ansley

Martin Schmidt wrote:

Hi David,

the operation

list/x=140w/y=0 temp, newtemp

limits the region of temp and newtemp. Hence temp[x=@ave,y=@ave]
gets a different meaning. This is often not taken into account.
Please note also, that temp is defined at x=140.5 and x=139.5. So some
interpolation is done here.

What helps.

- save newtemp to a new file.
save/clobber/file=newtemp.nc newtemp

- delete the variable newtemp

cancel var newtemp

- get the complete set newtemp from newtemp.nc

use newtemp.nc
list/x=140w/y=0 temp[d=1], newtemp ! testing

It should be now, what you expect.
My experience with ferret is the following: Doing things with
averaging, filling or shift operation and applying some
regional limits later gives unexpected results. These are not
errors but is a "misunderstanding" between user and ferret. Ferret executes commands, when output is required. When you
define newtemp about nothing happens. In matlab the field would
be generated, ferret says "yessir - understood" and waits what really is to do and is so much faster in many cases. If you list
newtemp at x=140w and y=0 ferret executes the commands defined
previously only for a small region around x=140w. If you
really want the average over all x and y you have to tell ferret
to execute this. Saving to a file does exactly this. Making
a figure with "shade" also. However, issuing the list command later,
ferret gets "oops, the same again, but now only for x=140w and y=0."

One could try to "think like ferret". However, a saver way is to save complete
intermediate variables to intermediate files, remove the variable definition
and to read data from file. This "stores" the ferret results.
This seems to be slower and expensive in compute power but is save and there is no need
for error search. Finally one gets the desired result much faster.

Regards,
Martin Schmidt



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement