Re: Strings in NCL ?

From: Dennis Shea (shea AT XXXXXX)
Date: Tue Oct 15 2002 - 06:15:15 MDT

  • Next message: Maurice McHugh: "Three NCL questions."

    Hello

    On Tue, 15 Oct 2002, Adolf Stips wrote:

    > Hi everybody,
    >
    > 1)
    > by doing some data conversions I have to deal several
    > times with strings - but are there any functions available
    > for doing this (finding forinstance the substring "lat" in some longer
    > string,
    > extracting only the first 5 characters from a string ....) ??
    > I couldn't see anything on the reference manuals.

    Well, it can be done but not via direct NCL syntax. Rather,
    a combination of the stringtochar function; subset the resulting
    array (note its' dimensions); then chartostring

    If you do this a number of times it might be best to
    set up some function to do this.
    >
    > 2)
    > The second problem is related to printing date/time strings and seems
    > to me like an error.
    > eg, my string is:
    >
    > 01/02/1999 (12:00)
    >
    > which in my opinion is a valid time format, when printing it is also okay,
    > but NCL things different when I try to put it on a postcript plot
    > (as res@tiMainString = "01/02/1999 (12:00)")
    > for eg: gsn_csm_contour_map
    >
    That is because : is a special test function code for graphics
    characters.

    You can manually reset this via the appropriate resource.
    Or you could put the following file into your home
    directory and call it .hluresfile. This is what
    we suggest. This sets a bunch of resources (eg:
    white background abd black foreground)

    ! comments for ".res" files are preceded by a "!"
    ! remember quotations are not used in .res files

    ! White background/black foreground
    *wkForegroundColor : (/0.,0.,0./)
    *wkBackgroundColor : (/1.,1.,1./)

    ! Font stuff
    *appClass*Font : helvetica

    ! Function Codes [Default is a colon ]
    *TextFuncCode : ~

    ! Set size of x11 window
      *wkWidth : 700
      *wkHeight : 700

    _______________________________________________
    ncl-talk mailing list
    ncl-talk AT ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Tue Oct 15 2002 - 07:37:06 MDT