[ncl-talk] Handing of file paths own write_table()

Will Hobbs will.hobbs at utas.edu.au
Mon Feb 19 15:22:39 MST 2018


Hi all

Looking for some input on a slightly annoying feature of the write_table() function (well, it was annoying when I couldn’t figure it out)

The following bit of code runs just fine as written. However, change diro = “~/” and I get a Segmentation fault. I assume (but don’t know) this is because my HLUres has the tilde set for use with function codes in strings, but I’ve not had the same issue with filepaths in any other NCL I/O function (e.g. asciiwrite(), addfile() ). Indeed,  the asciiwrite() statement in the snippet below works fine with the tilde, it only fails with the write_table() statement.

Will

begin

diro = “/Users/whobbs/” <i.e. your home directory>
  filo = "foo.csv"


  model = "random_model"
  expt  = "random_expt_name"
  Dbnd  = (/1025.23,1026.39,1026.99,1027.82/)


if (.not.fileexists(diro+filo)) then
   asciiwrite(diro+filo, "model,expt,SAMW_upper,SAMW_IW, IW_CDW,CDW_BW")
end if

oList = [/model, expt, str_join(sprintf("%6.2f",Dbnd),",") /]
write_table(diro+filo, "a", oList, "%s,%s,%s")


end


University of Tasmania Electronic Communications Policy (December, 2014).
This email is confidential, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone outside the intended recipient organisation is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender. The views expressed in this email are not necessarily the views of the University of Tasmania, unless clearly intended otherwise.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180219/a9be5e3e/attachment.html>


More information about the ncl-talk mailing list