type conversion from string to logical

From: Jonathan Vigh <vigh_at_nyahnyahspammersnyahnyah>
Date: Sun Dec 06 2009 - 21:53:27 MST

Greetings NCL'ers,
    Maybe this is a completely silly question, but is there an NCL
built-in to convert a variable of type string to a variable of type
logical? I suppose it would be trivial to write such a function, but I
couldn't seem to find one. Simply assigning a logical to the value of a
string ("True" or "False") doesn't work (see below). According to the
documentation
(http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclDataTypes.shtml#Coercion),
it doesn't seem that string types are coercible to anything else.

Jonathan

 Copyright (C) 1995-2009 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 5.1.1
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
ncl 0> stringvar = "False"
ncl 1> logvar = new(1,logical)
ncl 2> logvar = stringvar
fatal:Assignment type mismatch, right hand side can't be coerced to type
of left hand side
fatal:Execute: Error occurred at or near line 2

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Dec 6 21:53:34 2009

This archive was generated by hypermail 2.1.8 : Mon Dec 07 2009 - 16:12:30 MST