I am not exactly sure waht you want.
See the "cc" variable that follows.
There may be a bug in the implicit conversion of string to integer.
Anyway, I think you will have to clarify.
D
ncl 0> aa = new(3,"integer")
ncl 1> print(aa)
Variable: aa
Type: integer
Total Size: 12 bytes
3 values
Number of Dimensions: 1
Dimensions and sizes: [3]
Coordinates:
Number Of Attributes: 1
_FillValue : -999
(0) -999
(1) -999
(2) -999
ncl 2> bb = "aa"
ncl 3> print(bb)
Variable: bb
Type: string
Total Size: 8 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) aa
maybe a bug ????
I think it should be
_FillValue : missing
(0) missing
(1) missing
(2) missing
....
ncl 4> cc = new( 3, "string")
ncl 5> print(cc)
Variable: cc
Type: string
Total Size: 24 bytes
3 values
Number of Dimensions: 1
Dimensions and sizes: [3]
Coordinates:
Number Of Attributes: 1
_FillValue : missing
(0) missing
(1) missing
(2) missing
ncl > print( all(ismissing(cc)) )
(0) True
==========================================
ncl > ss = new (3, "string")
ncl > ss = ispan(1,3,1) ; implicit conversion to string
; convert string and print as integer
ncl > print( sprinti("%6.0i", stringtointeger(ss)) )
(0) 1
(1) 2
(2) 3
guillaume mauger wrote:
>
> Hi All,
>
> An example:
>
> aa = new(3,"integer")
> bb = "aa"
>
> now, I would like to be able to do something akin to the following:
>
> print(all(ismissing($bb$)))
>
> and have it return the result evaluated for the variable 'aa'.
>
>
> Alternatively, if there is a way to evaluate a string as an ncl command,
> e.g.:
>
> eval( "print(all(ismissing(" + bb + ")))" )
>
>
> Is there a way I can do this?
>
> thanks,
> guillaume
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 19 2007 - 14:42:17 MDT
This archive was generated by hypermail 2.2.0 : Mon Sep 24 2007 - 11:44:39 MDT