Re: question about function "write_matrix"

From: Mary Haley (haley AT ucar.edu)
Date: Tue Sep 13 2005 - 10:53:42 MDT

  • Next message: David Ian Brown: "Re: C and NCL"

    Hi Jerry,

    One of the NCL developers told me about another possible solution to
    this problem. The newline character you were trying to add using "~C"
    only works when you are doing text strings on plots in NCL.

    However, there are ways to imbed newlines into normal text strings by
    using character "10". So, you use the "inttochar" conversion routine
    to convert character 10 to an integer, and then you can include this
    in your string. For example:

       newline = inttochar(10)
       opt@title = "variable : sea surface temperature " + newline + \
                    " filename : coads_climatology " + newline + \
                    " subset : 180 x 90 (Longitude x latitude)"

    The only non-graceful thing about this is if you want all the titles
    centered, you will need to do this by hand by using a combination of
    "opt@tsapce" and adding spaces to the remaining lines.

    Adam's solution will also work. It's just up to you which you prefer.

    --Mary

    On Tue, 13 Sep 2005, Adam Phillips wrote:

    > Hi Jerry,
    >
    > I do not believe you can write the write_matrix title on multiple lines.
    > However, using what Mary pointed out yesterday:
    >
    >> variable : sea surface temperature
    >> filename : coads_climatology
    >> subset : 180 x 90 (Longitude x latitude)
    >
    > atxt = "variable : sea surface temperature"
    > asciiwrite("file1",atxt)
    > btxt = "filename : coads_climatology"
    > asciiwrite("file2",btxt)
    > ctxt = "subset : 180 x 90 (Longitude x latitude)"
    > asciiwrite("file3",ctxt)
    > opt = True
    > opt@fout = "file4"
    > write_matrix(x,"7f7.2",opt)
    > system("cat file2 >> file1")
    > system("cat file3 >> file1")
    > system("can file4 >> file1")
    > system("/bin/rm file2 file3 file4")
    >
    > The alternative is openening the ascii file in a text editor afterwards and
    > adding the title that way...
    >
    > Hope that helps.
    > Adam
    >
    > jerry wrote:
    >> hi
    >> I want to output a ascii file with some information on title like :
    >> variable : sea surface temperature
    >> filename : coads_climatology
    >> subset : 180 x 90 (Longitude x latitude)
    >> I use the write_matrix function argument option "title"
    >> opt = ture
    >> opt@title <mailto:opt@title> = "variable : sea surface temperature
    >> ~C~ filename : coads_climatology ~C~ subset : 180 x 90 (Longitude x
    >> latitude)
    >> I use "~C~" to broken the line but it didn't work.
    >> Does any suggestion to do this ?
    >> Thank you
    >>
    >>
    >> ------------------------------------------------------------------------
    >>
    >> _______________________________________________
    >> ncl-talk mailing list
    >> ncl-talk@ucar.edu
    >> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
    >
    > --
    > --------------------------------------------------------------
    > Adam Phillips asphilli@ucar.edu
    > National Center for Atmospheric Research tel: (303) 497-1726
    > ESSL/CGD/CAS fax: (303) 497-1333
    > P.O. Box 3000 Boulder, CO 80307-3000
    > http://www.cgd.ucar.edu/cas/asphilli
    > _______________________________________________
    > ncl-talk mailing list
    > ncl-talk@ucar.edu
    > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
    >
    _______________________________________________
    ncl-talk mailing list
    ncl-talk@ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Tue Sep 13 2005 - 11:15:19 MDT