[Thread Prev][Thread Next][Index]

Re: [ferret_users] regridding transformation should reduce dimension . . .



Thanks Andrew for clarifying.  A few more thoughts about SHOW GRID.

SHOW GRID is not a very precise tool for getting the details of the grid of an _expression_. Ferret does this by checking off the the axes of the combined grid that is used in the computation. It does sometimes show axes which have in fact gone away when the _expression_ is computed. Looking at
yes? say `z10,return=shape`
 !-> MESSAGE/CONTINUE XY
XY
returns the expected result, and Ferret writes just the XY coordinates if you SAVE the result to a netCDF file. So as Andrew explained, this is one of those cases where Ferret's delayed-evaluation computations aren't entirely obvious.

-Ansley

On 12/1/2015 9:58 AM, Andrew Wittenberg - NOAA Federal wrote:
Hi Ryo,

Thanks for the clearly-stated question.  [All: this is a good example
of how to ask a question so that it gets answered quickly.  In
particular, Ryo provided a working example using one of Ferret's
built-in datasets, e.g. levitus_climatology, coads_climatology, or
monthly_navy_winds; and also pasted in the Ferret header, which shows
what Ferret version he was using, just in case it turned out to be a
bug.]

Note that Z=@LOC doesn't mean "search from top to bottom for 10 degC."
 Instead it means "search within the future evaluation context for 10
degC."

So when you later specify z10[k=1], @LOC dutifully searches only over
k=1; and since 10degC isn't found in the top level, it evaluates to
"missing."

To insulate @LOC from future contexts, specify explicit z-limits:

  NOAA/PMEL TMAP
  FERRET v6.951 (10/29/2015)
  Linux 2.6.32-573.7.1.el6.x86_64 64-bit - 10/30/15
  1-Dec-15 12:40

yes? use levitus_climatology
yes? let z10 = temp[z=0:6000@LOC:10]
yes? let below_z10 = z[g=temp] LT z10
yes? shade/x=180 below_z10
yes? shade/z=400 below_z10

The relevant documentation is:

http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/variables-xpressions/XPRESSIONS#_VPINDEXENTRY_528

See also the following answer in the Ferret email archives:

http://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2006/msg00098.html

which was found by searching the email archives for "missing context".

Andrew


On Tue, Dec 1, 2015 at 6:06 AM, Ryo Furue <furue@xxxxxxxxxx> wrote:
Hi Ferret users,

I'm sure there has been discussions about this issue and I searched
our email archive and found some threads that touch upon it, but
didn't find whether it's "solved" or not.

The problem is that @LOC (and perhaps other similar transformations)
doesn't properly "eliminate" the axis.  For a (x,y,z) temperature
field, say, you can find the depth of an isopycnal:

   yes? z10 = temp[z=@LOC:10]

but, "SHOW GRID z10", it still has more than one gridpoints.  Nevertheless,

    yes? fill z10[k=1]   !--> undefined field
    yes? fill z10           !--> works!

See a complete example below.  This behavior looks like a bug to me.

This matters.  I wanted to define a mask on the basis of this
variable, something like:

   yes? let below_z10 = if z[g=temp] lt z10 then 1

but this doesn't work because z10[k=1, 2, 3, . . .] are undefined!

My temporary solution is

   yes? let grid = x[gx=temp] + y[gy=temp]
   yes? let z10_squashed = reshape(z10,grid)
   yes? let below_z10 = if z[g=temp] lt z10_squashed then 1

But, I guess Ferret should do this reshaping for me with @LOC.

Regards,

Ryo
----------------------------------------
$ ferret
  NOAA/PMEL TMAP
  FERRET v6.94
  Darwin 14.1.0 - 02/26/15
  1-Dec-15 19:36

yes? set data levitus_climatology
yes? let z10 = temp[z=@LOC:10]
yes? show grid z10
    GRID GMS1
 name       axis              # pts   start                end
 XAXLEVITR LONGITUDE          360mr   20.5E                19.5E(379.5)
 YAXLEVITR LATITUDE           180 r   89.5S                89.5N
 ZAXLEVITR DEPTH (m)           20 i-  0                    5000
 normal    T
 normal    E
 normal    F
yes? list/x=180/y=0 z10[k=1]
             VARIABLE : TEMP[Z=@LOC:10]
             FILENAME : levitus_climatology.cdf
             FILEPATH : /usr/local/ferret/data/
             LONGITUDE: 179.5E
             LATITUDE : 0.5S
             DEPTH (m): 0 to 5
        ....
yes? list/x=180/y=0 z10
             VARIABLE : TEMP[Z=@LOC:10]
             FILENAME : levitus_climatology.cdf
             FILEPATH : /usr/local/ferret/data/
             LONGITUDE: 179.5E
             LATITUDE : 0.5S
             DEPTH (m): 0 to 5000
          371.7
!---- temporary solution ----
yes? let grid = x[gx=temp] + y[gy=temp]
yes? let z10_reshaped = reshape(z10, grid)
yes? show grid z10_reshaped
    GRID (G002)
 name       axis              # pts   start                end
 XAXLEVITR LONGITUDE          360mr   20.5E                19.5E(379.5)
 YAXLEVITR LATITUDE           180 r   89.5S                89.5N
 normal    Z
 normal    T
 normal    E
 normal    F
yes? list/x=180/y=0 z10_reshaped[k=1]
             VARIABLE : RESHAPE(Z10, GRID)
             FILENAME : levitus_climatology.cdf
             FILEPATH : /usr/local/ferret/data/
             LONGITUDE: 179.5E
             LATITUDE : 0.5S
          371.7
yes? list/x=180/y=0 z10_reshaped
             VARIABLE : RESHAPE(Z10, GRID)
             FILENAME : levitus_climatology.cdf
             FILEPATH : /usr/local/ferret/data/
             LONGITUDE: 179.5E
             LATITUDE : 0.5S
          371.7
yes?


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement