[Thread Prev][Thread Next][Index]

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



Hi Ryo,

When a so-called "compressing" transformation is applied to an axis Ferret retains always the relevant axis as part of the grid definition.  This sample session shows the @AVE transformation and the @LOC transformation both sharing the same grid as the original variable, temp
yes? use levitus_climatology
yes? let zave = temp[z=0:30@ave]
yes? shade zave
yes? show grid
 ...
 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
 ...
yes? let z10 = temp[z=@loc:10]
yes? shade z10
yes? show grid
 ...
 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
...
OK.  Your situation.  You are seeing a problem in the definition
yes? let below_z10 = if z[g=temp] lt z10 then 1
because the Z axis range in the definition of the variable z10 is unconstrained in the same way that the _expression_ "temp[Z=@ave]" would have unconstrained Z limits.   f you explicitly state the range over which Ferret should search for the result of @loc:10, your problem will be solved:
yes? let z10_constrained = temp[z=0:5000@loc:10]
yes? let below_z10 = if z[g=temp] lt z10_constrained then 1
yes? shade/y=0/z=0:1000 below_z10
Does this address your dilemma?

    - Steve

============================

On 12/1/2015 3:06 AM, Ryo Furue 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