I was expecting
in an ncap2 script to produce values (-180.0, -177.5, -175.0, ...). Instead, I got (-180.0, -178.0, -176.0, ...). So it looks like the increment needs to be an integer. Is this correct? I've looked in the documentation and I don't see anything indicating the increment must be an integer. Maybe I looked in the wrong place?
ncap2 is using integers because it cues the variable type based on the
type of the first value in the array() arguments. Change to this:
and ncap2 will produce the desired array.
Yes, the documentation should make this more clear.
Ah! I see. Thanks!
My script was actually:
So I thought that the "lon[lon]=0.0f;" would set the variable type. Are you saying that I was changing the type with the "lon=array(-180,2.5,$lon);" command? When I look in the output file, it looks as though lon is still a float.
close. the RHS type is determined by the RHS arguments.
the LHS type, if not already know, is also determined by RHS arguments.
otherwise the LHS type remains the same. so you were casting integers
to floats which then appear to have integer values.
Oh. You know what. I think I understand.
produces an integer array. This is then cast to a floating point array and assigned to lon. Yes? The type of lon does not factor into how the array is constructed.
Whoops, our posts must have crossed paths...
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.