[Thread Prev][Thread Next][Index]

Re: [ferret_users] i index from X



Hi Takaya,
This is because of issues of precision on the command line and in the LIST command.

After defining the axis and variables, if you ask for more precision on the LIST command, and list the coordinates for the whole axis, you will see this:
yes? list/prec=7 xx
             VARIABLE : X[GX=XGRID]
             SUBSET   : 571 points (LONGITUDE)
70W     /   1:  290.0000
69.957W /   2:  290.0439

...
...

45.044W / 570:  314.9563
45W     / 571:  315.0002

A better way to define the axis is to use the /NPOINTS qualifier so that the interval is divided into 570 points using all of the precision that is available. For coordinate axes, this means the coordinate points are computed and stored in double precision.  Replace your definition with this:
define axis/x=290:315/npoints=570/unit=degree xaxis

If you use this definition, then xx and ii behave as you expected them
to.

When you used   /x=290:315:`25/570`   the expression 25/570 is evaluated when the command is parsed and the precision is only four decimal places, so the definition of the axis is not as precise as it could be.

yes? def axis/x=290:315:`25/570`/unit=degree xaxis
 !-> def axis/x=290:315:0.04386/unit=degree xaxis


Ansley


Namba Takaya wrote:
Dear user

I like to know the i index from x value.

This is a simple exmaple I did.

define axis/x=290:315:`25/570`/unit=degree xaxis
define grid/x=xaxis xgrid
let xx=x[g=xgrid]
list xx[i=570]
let ii=i[g=xgrid]
list ii[x=315]


I expected 570 by "list ii[x=315]", but the return is 571 
even though I got 315 by "list xx[i=570]".

Is this wrong way to get i index from X. Any other simpler
ways?

Best Regards,

Takaya Namba













--------------------------------------
STOP HIV/AIDS.
Yahoo! JAPAN Redribbon Campaign 2005
http://pr.mail.yahoo.co.jp/redribbon/
  

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement