[ncl-talk] unexpected results from very simple code
danghy at gmail.com
danghy at gmail.com
Mon Jul 20 03:10:44 MDT 2015
Dear all,
I met a problem when reading "station ID" - I've simplified the code as follows:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
begin
degrees = (/210200051, 121, 36, 43,38,58,26/)
print(sprintf("%9.0f",degrees(0)))
print(tostring(degrees(0)))
a=210200051.
print(tostring(a))
print(sprintf("%9.0f",a))
end
The NCL output on screen is:
ncl test.ncl
Copyright (C) 1995-2015 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.3.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
(0) 210200048
(0) 210200051
(0) 210200048.000000
(0) 210200048
Only the second method "tostring" gives the correct station ID. Could you please give me a clue why is this happening?
Appreciate!
danghy at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150720/ec737d58/attachment.html
More information about the ncl-talk
mailing list