[Thread Prev][Thread Next][Index]

Re: [ferret_users] string array concatenated variable assignment problem

Use XCAT_STR(), not XCAT().


On Fri, Feb 12, 2016 at 11:35 AM, Marco van Hulten <marco.van-hulten@xxxxxxxxxxxx> wrote:
Hello all,

When I define a variable as a variable that is a concatenation of
string arrays, I get strange data that suggest an initialisation bug.

As an example, initialise two arrays and concatenate those into the
variable pre_list.  When we print pre_list, we'll get the expected
value, namely {"a", "b", "c", "d"}.  However, it goes wrong when we
define a new variable final_list as pre_list.  The can be shown with
the following code:

    can var/all
    let list1 = {"a", "b"}
    let list2 = {"c", "d"}
    let mylists = {"list1", "list2"}
    let pre_list = XCat( list1, list2 )
    let final_list = pre_list
    list final_list

The result is {6.699-316, 6.699-316, 6.699-316, 6.699-316} or a similar
number (different answers on different machines, or between pyferret and

With numbers instead of strings, there is no problem.  Also, without the
concatenation -- let a = {"a", "b"}; let b = a -- I get the expected
result.  The problem appears to be a combination of concatenating
string arrays with an extra assignment of the end result.

I am using Ferret 6.96.


Laboratoire des Sciences du Climat et l'Environnement (LSCE)
Tel: +33 1 6908 3876
Www: http://www.lsce.ipsl.fr/Pisp/marco.van-hulten/

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement