[Thread Prev][Thread Next][Index]

Re: [ferret_users] ,return=lend and constants



Ansley,

Thanks for the detailed explanation!

> What happens when Ferret is getting the grid of an expression is
> that we work through all the different items in the expression, like
> salt, temp, refp, 0, and figure out what their grids are.  The 0 in
> 
>    let den1 = RHO_UN(salt,temp,0)
> 
> is just a constant so its "grid" is normal to all axes in all
> grids. When we reconcile the grid of "0" with the grids of "temp"
> and "salt" the resulting grid for den1 has the XYZT axes of salt and
> temp, and normal axes in the E and F directions.
> 
> The grid of "refp" however, is the abstract grid. That makes it
> possible to reconcile it with any other grid, but it is not the same
> as the normal grid.

I wonder if it's an inconsistency in the LET command?
I assume that the variable defined by a LET command
inherits the grid of the right-hand side.

If so, shouldn't refp has exactly the same grid
as the expression "0" in

  yes? let refp = 0

?  Since the grid of "0" is normal to all axes, so should
the grid of refp be . . . ?

Since 

  yes? let refp1 = 0*temp
  yes? show grid refp1

gives

 XAXLEVITR LONGITUDE   [. . .]
 YAXLEVITR LATITUDE    [. . .]
 ZAXLEVITR DEPTH (m)   [. . .]
 normal    T
 normal    E
 normal    F

(for levitus_climatology), I expect

  yes? let refp = 0
  yes? show grid refp

give

 normal  X
 normal  Y
 normal  Z
 normal  T
 normal  E
 normal  F

. . . . ?

Regards,
Ryo



> 
> When we reconcile the grid of "refp" with the grids of "temp" and
> "salt" the resulting grid for the expression
> 
>    let den2 = RHO_UN(salt,temp,refp)
> 
> is a grid with the XYZT axes of salt and temp, and abstract in E and
> F.  Ferret still doesn't have full info on the grid of den2, so it
> decides it needs to evaluate salt, temp, and refp before it can give
> back the information that the length of the T axis is 12.  We're
> getting the error message because the full XYZT grid of SALT doesn't
> fit into the amount of memory currently allocated.
> 
> 
> The same sequence of events would have happened in 4D Ferret, if the
> original grids of SALT and TEMP were 3d, because then the 4th
> dimension of the grid would be an abstract axis when working with
> den2.
> 
> Do the same example using levitus_climatology, and ask for the length
> of the X axis.  Using 4D Ferret, we'll use "set mode diagnostic" which
> shows the grids Ferret is creating as it goes along.
> 
>     > ferret_v672
>             NOAA/PMEL TMAP
>             FERRET v6.72
>             Linux 2.6.18-274.el5PAE 32-bit - 09/13/11
>             19-Oct-12 13:38
> 
>    yes? use levitus_climatology
>    yes? let refp = 0
>    yes? let den1 = RHO_UN(salt,temp,0)
>    yes? let den2 = RHO_UN(salt,temp,refp)
> 
>    yes? set mem/siz=1        ! set the memory size small to be sure we
>    run into the limit
>    yes? set mode diagnostic  ! lets us see the grids Ferret is using
> 
>    yes? say `den1,return=iend`  ! Get the grid of the first variable.
>    Its T axis is NORMAL
> 
>      getgrid EX#1 C: 5 I: 1 1 J: 1 1 K: 1 1 L: 1 1
>      getgrid DEN1 C: 7 I: 1 1 J: 1 1 K: 1 1 L: 1 1
>      allocate dynamic grid GMS1            XAXLEVITR YAXLEVITR
>    ZAXLEVITR NORMAL
>      allocate dynamic grid GMS1            XAXLEVITR YAXLEVITR
>    ZAXLEVITR NORMAL
>      !-> MESSAGE/CONTINUE 360
>    360
> 
> 
> Now try den2, with variables salt, temp, and refp.  The grid has an
> ABSTRACT time axis, and so we get into the same situation.
> 
>    yes? say `den2,return=iend`
>      dealloc  dynamic grid GMS1 XAXLEVITR YAXLEVITR ZAXLEVITR NORMAL
>      getgrid EX#1 C: 5 I: 1 1 J: 1 1 K: 1 1 L: 1 1
>      getgrid DEN2 C: 7 I: 1 1 J: 1 1 K: 1 1 L: 1 1
>      getgrid REFP C: 9 I: 1 1 J: 1 1 K: 1 1 L: 1 1
>      allocate dynamic grid (G002) XAXLEVITR YAXLEVITR ZAXLEVITR ABSTRACT
>      allocate dynamic grid (G002) XAXLEVITR YAXLEVITR ZAXLEVITR ABSTRACT
>      dealloc  dynamic grid (G002) XAXLEVITR YAXLEVITR ZAXLEVITR ABSTRACT
>      getgrid EX#1 C: 5 I: 1 1 J: 1 1 K: 1 1 L: 1 1
>      allocate dynamic grid (G002) XAXLEVITR YAXLEVITR ZAXLEVITR ABSTRACT
>      eval    EX#1     C:  4 I:    1  360  J:    1 180  K:    1   20  L:
>    -999 -999
>      eval    DEN2     C:  6 I:    1  360  J:    1 180  K:    1   20  L:
>    -999 -999
>      **ERROR: request exceeds memory setting: 2 Mwords were requested.
>      *** NOTE: You can use SET MEMORY/SIZE=xxx to increase memory.
>      *** NOTE: The "Memory use" section of the FERRET Users Guide has
>    further tips.
> 
> 
> 
> 
>>   On Thu, 2012-10-18 at 12:55 +1100, Ryo Furue wrote:
>>> Ferret users,
>>>
>>> Has anybody seen this behavior? Is this a bug?  Basically,
>>> "return=lend" tries to allocate a lot of memory in some cases.
>>>
>>> yes? set data bug.nc
>>> yes? let refp = 0
>>> yes? let den1 = RHO_UN(salt,temp,0)    !! Good
>>> yes? let den2 = RHO_UN(salt,temp,refp) !! Bad
>>> yes? say `den1,return=lend`
>>>   !-> MESSAGE/CONTINUE 2
>>> 2
>>> yes? say `den2,return=lend`
>>>   **ERROR: request exceeds memory setting: 10 Mwords were requested.
>>> [ . . . remaining error messages elided . . .]
>>>
>>> The dataset bug.nc contains salt(i,j,k,l) and temp(i,j,k,l)
>>> with l = 1:2.  I'm attaching the results of "show grid" below.
>>>
>>> If you are interested and you cannot reproduce this error,
>>> I'll send the dataset to you.
>>>
>>> I'm currently using
>>> FERRET v6.81 Linux 2.6.32-279.1.1.el6.x86_64 32-bit - 07/23/12
>>>
>>> The same script didn't cause this error some versions ago.
>>>
>>> Regards,
>>> Ryo
>>> --------------------------------
>>> yes? show grid den1
>>>      GRID GCF1
>>>   name       axis              # pts   start                end
>>>   LONGITUDE_T LONGITUDE 564mr 104.17E(104.17) 68.167W(291.83)
>>>   LATITUDE_T LATITUDE          168 r   25.833S              29.833N
>>>   DEPTH_T   DEPTH (m)           51 i-  2.5                  5745
>>>   TIME1 TIME 2 r 21-JAN-2031 00:00 01-FEB-2031 00:00
>>>   normal    E
>>>   normal    F
>>> yes? show grid den2
>>>      GRID (G002)
>>>   name       axis              # pts   start                end
>>>   LONGITUDE_T LONGITUDE 564mr 104.17E(104.17) 68.167W(291.83)
>>>   LATITUDE_T LATITUDE          168 r   25.833S              29.833N
>>>   DEPTH_T   DEPTH (m)           51 i-  2.5                  5745
>>>   TIME1 TIME 2 r 21-JAN-2031 00:00 01-FEB-2031 00:00
>>>   ABSTRACT  E              9999999 r   1                    9999999
>>>   ABSTRACT  F              9999999 r   1                    9999999
>>
> 


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

Privacy Policy | Disclaimer | Accessibility Statement