[ncl-talk] CSV file script

Grace Choi gracesh27 at gmail.com
Mon Oct 23 16:14:09 MDT 2017


Hi everyone,

So I am having a trouble understanding a part of a script for reading CSV
file.

I have been having a hard time getting this script to work, because I am
not sure how to correctly write the highlighted part of the script.

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"


begin

filename = "example2.csv"


lines = asciiread(filename,-1,"string")


delim = ","


name = str_get_field(lines,1,delim)

group = tointeger(str_get_field(lines,5,delim)

size = tofloat(str_get_field(lines,9,delim)


print("Name is'" + name + "', group is " + group + ", size is " + size)

end

I am not sure what print("Name is'" + name + "', group is " + group + ",
size is " + size) indicates... What is the difference between "Name is"' +
name. With an actual value put in, what should this script actually look
like?

Thanks so much for your help.

Sincerely,
Grace
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171023/a38a947a/attachment.html>


More information about the ncl-talk mailing list