Hi ncl-ers,
I am using fspan to generate evenly spaced grid positions in a vector, however I am receiving an irregular output spacing. There appears to be some kind of truncation to integer even though the output variable is marked as 'float'. The code snippet is below, where the 'seq' variable should be regularly spaced but instead has spacings of 1,2,2,1,1,2. I am expecting a spacing of 1.5.
I use this command all the time and I'm sure this is something simple, does anyone have any ideas?
y1 = 4229667.
y2 = 4179327.
printVarSummary(y1)
Variable: y1
Type: float
Total Size: 4 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
ncl 25> printVarSummary(y2)
Variable: y2
Type: float
Total Size: 4 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
n = 33560
seq = fspan( y1, y2, n)
print(seq(0:6)) ;print test of sequence from fspan
Variable: seq (subsection)
Type: float
Total Size: 28 bytes
7 values
Number of Dimensions: 1
Dimensions and sizes: [7]
Coordinates:
(0) 4229667
(1) 4229666
(2) 4229664
(3) 4229662
(4) 4229661
(5) 4229660
(6) 4229658
ncl 29> spacing = (y2 - y1)/n
ncl 30> print(spacing)
;---expected spacing
Variable: spacing
Type: float
Total Size: 4 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) -1.5
Cheers,
Kat
-- Kat Bormann NASA Postdoctoral Fellow Jet Propulsion Laboratory California Institute of Technology Pasadena, CA 91109
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Nov 26 12:25:21 2013
This archive was generated by hypermail 2.1.8 : Wed Dec 04 2013 - 20:42:38 MST