Oli,
I'm afraid there's no way to do this. I had proposed at one time that
the single ticks be used to denote characters:
b = '*'
but I guess this causes other problems.
The best thing we can suggest, is to look up '*' in the ascii table
(you can easily google for one) and use "inttochar":
c = inttochar(42) ; 42 is '*' in the ascii table
i=ind(stringtochar(a) .eq.c)
--Mary
On Nov 10, 2008, at 7:46 AM, <Oliver.Fuhrer_at_meteoswiss.ch> wrote:
> Dear all,
>
> I would like to find the occurences of "*" in a string. I thought an
> elegant way of doing this is...
>
> a="TOT_PREC_HYBY_acc*"
> i=ind(stringtochar(a) .eq. "*")
>
> Now, it seems that NCL coerces the stringtochar(a) back to a
> string, as
> it supposes that "*" is a string an not a character. The way it would
> work is...
>
> a="TOT_PREC_*_HYBY_acc*"
> b=stringtochar("*")
> i=ind(stringtochar(a) .eq. b(0))
>
> I was just wondering, if there is a way of telling NCL that a
> explicitly
> specified variable such as "*" should be a character, and not a
> string.
>
> Thanks,
> Oli
>
>
> ________________________________________
>
> Oliver Fuhrer
> Numerical Models
>
> Federal Departement of Home Affairs FDHA
> Federal Office of Meteorology and Climatology MeteoSwiss
>
> Kraehbuehlstrasse 58, P.O. Box 514, CH-8044 Zurich, Switzerland
>
> Tel. +41 44 256 93 59
> Fax +41 44 256 92 78
> oliver.fuhrer_at_meteoswiss.ch
> www.meteoswiss.ch - First-hand information
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Nov 10 2008 - 08:59:03 MST
This archive was generated by hypermail 2.2.0 : Mon Nov 10 2008 - 10:18:09 MST