[Thread Prev][Thread Next][Index]

[ferret_users] Masking in list command works for floats, not strings



Dear ferreters,

I discovered listing while masking seems to work. But not in all cases (see also attached script file with more examples and comments):


yes? let test = {1,1,0}

!! problem with masked strings -> unexpected values
yes? let strings = {"a","b","c"}
yes? list if (test) then strings
             VARIABLE : IF (TEST) THEN STRINGS
             SUBSET   : 3 points (X)
 1   / 1:  2.109-316
 2   / 2:  2.109-316
 3   / 3:  2.109-316
!! repeat the listing, and the values change every time

!! define a masked variable instead, then list - works
yes? let masked = if (test) then strings
yes? list masked
             VARIABLE : IF (TEST) THEN STRINGS
             SUBSET   : 3 points (X)
 1   / 1:"a"
 2   / 2:"b"
 3   / 3:"" 

!! OR do the same listing for a float first
yes? let floats = {2,3,4}
yes? list if (test) then floats
             VARIABLE : IF (TEST) THEN FLOATS
             SUBSET   : 3 points (X)
 1   / 1:  2.000
 2   / 2:  3.000
 3   / 3:   ....

!! now, also for strings listing while masking works
yes? list if (test) then strings
             VARIABLE : IF (TEST) THEN STRINGS
             SUBSET   : 3 points (X)
 1   / 1:"a"
 2   / 2:"b"
 3   / 3:"" 


In an interactive ferret session, I first had defined a masked variable for strings (in this example 'masked'), and had also listed it for testing. After that I discovered that listing while masking works too (of course I didn't know it only worked because I had defined and listed the 'masked' variable before, in the same session). So later in my ferret script I omitted defining the 'masked' variable, and used the listing while masking. The script did not crash, but gave me unexpected values like the ones above, instead of proper strings.

Would be good to fix this, or - if the syntax of listing while masking is not supported - to catch these cases and throw an error.

The story goes on, however, see attached script as it seems not possible to mask a string variable and then make an xsequence out of it - unless you do for instance the "faulty listing while masking" from above before the "right" listing.



Best wishes,
Hella

PyFerret v7.11 (beta/optim), Linux 4.4.0-72-generic - 04/19/17

Attachment: mask_string.jnl
Description: mask_string.jnl


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

Privacy Policy | Disclaimer | Accessibility Statement