Re: char/string

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon, 10 Nov 2008 08:45:23 -0700

Hello

ncl 0> chr = stringtochar("*") ; charaacter array of length 2
ncl 1> print(chr)
ncl 2> ast = chr(0) ; asterisk ... type char
ncl 3> print(ast)
ncl 4> s = chartostring(chr) ; make string
ncl 5> print(s)

ncl 6> x="TOT_PREC_*_HYBY_acc*"
ncl 7> x_chr = stringtochar(x)
ncl 8> i_ast = ind(x_chr.eq.ast) ; index values
ncl 9> print(i_ast)

To my knowledge, at the current time, the answer is "no" .

Good luck

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:45:23 MST

This archive was generated by hypermail 2.2.0 : Mon Nov 10 2008 - 10:18:09 MST