Re: Fwd: dimension size parameter error

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 6 Feb 2008 16:10:54 -0700 (MST)

Erik,

You don't need to use a function here, if "ntimes" is already an
integer. Just use:

   nvtimes = (ntimes-1)/8

When you do integer arithmetic on the right side of the equation, NCL
will return an integer. And, it will effectively do what "floor"
does for floats/doubles.

Hence, "n = 5/3" will give you 1, "n = 2/3" will give you 0, etc.
"487/8 " will give you 60.

--Mary

On Wed, 6 Feb 2008, Erik Noble wrote:

> Hi.
> I realize that this is a problem with the "floor' command. Any suggestions?
>
>
> ---------- Forwarded message ----------
> From: Erik Noble <enoble_at_giss.nasa.gov>
> Date: Feb 6, 2008 3:38 PM
> Subject: dimension size parameter error
> To: "ncl-talk_at_ucar.edu" <ncl-talk_at_ucar.edu>
>
>
> Hi.
> I am getting an error that says:
> "fatal:New: the dimension size parameter is the wrong type an integer
> value was expected"
>
> when i have this syntax in my code
> nvtimes = floor((ntimes-1)/8) ntimes = 487, nvtimes should equal "60"
> print(nvtimes)
> V925 = new((/nvtimes, 109, 139/),"float")
>
> But when I just state an integer, I do not get an error.
> nvtimes = 60
> print(nvtimes)
> V925 = new((/nvtimes, 109, 139/),"float")
>
> Variable: nvtimes
> Type: integer
> Total Size: 4 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) 60
>
> How can I correct calling in the named dimension size parameter?
> -Erik
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Feb 06 2008 - 16:10:54 MST

This archive was generated by hypermail 2.2.0 : Thu Feb 07 2008 - 08:58:57 MST