[Thread Prev][Thread Next][Index]
Re: [ferret_users] Masking in list command works for floats, not strings
- To: "Ansley C. Manke" <ansley.b.manke@xxxxxxxx>, ferret users <ferret_users@xxxxxxxx>
- Subject: Re: [ferret_users] Masking in list command works for floats, not strings
- From: "Riede, Hella" <hella.riede@xxxxxxx>
- Date: Mon, 3 Jul 2017 21:13:34 +0000
- Accept-language: en-US, de-DE
- Arc-authentication-results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of hella.riede@xxxxxxx designates 192.67.218.51 as permitted sender) smtp.mailfrom=hella.riede@xxxxxxx
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:fcc:user-agent:content-language:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:to:from:arc-authentication-results; bh=S2NfO9ehPFMGGR0JEz/7jGEeMCAeSKoqrC9rhgO5zzI=; b=fS9LpH9s63TD8CPkKeNL2dYlwq8x5oqULtiLD/E2ttkAdG8KpNy4H9aMAAdeNE/7kV op9Pr79wnjZuzXbTTZ2KOeZVHJ7dIsswpXRwBFnMMI+9zrZIUSO49DFEOnx7y89ls+/U 2r1UTV2yYly+ksXUE7QvHSUcmmCMNLa0BXXFp/LfPQgOydTYc9fEDV/N+ra2lNQfFncs TorGKlAWBUmJB2VDLndhssEYzp/QngfPJDFSqaARyT2vxIk1rHEHdYmPXKu4YiRq+3T6 NkMKr0OwtEcwh5Kw+M61aq3Xs8olixNOf/V3Whq83FKZoD97gcXQWSLXEI7TGHzrsOUJ os0A==
- Arc-seal: i=1; a=rsa-sha256; t=1499116416; cv=none; d=google.com; s=arc-20160816; b=ScuPGsNWA1WFZStQFeUc3G2oznqaqWwzU6B0C13c7myN6pWPnHM/QUkKF6+St1GoUV fMoqb5W/f/37IwF4hxSvBPawKyn4XHUdNhQ58TNBe2ESozkKR47Nn3Xkun/VyoWggdRg aShl/9LlpJGybMnDWHSA5PJp+gvA70mUPkayq7kqjYXhzpHasq20UYCoMUlexQajGQTN SezFiDdDep9XRQT1KRmhaPY/KygNEqswONv9eZdCY67k7N8g1Q/hYtwz1Fv9XkhNd+6D /Lv8xyGWBSjh7asW8Y+OD41ROyWA7kd0yqpLUOZ4oqP9whcqFPbYkJ5E9Efh29a/XcuJ SELg==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=noaa-gov.20150623.gappssmtp.com; s=20150623; h=from:to:subject:thread-topic:thread-index:date:message-id :references:in-reply-to:accept-language:content-language:user-agent :fcc:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive; bh=S2NfO9ehPFMGGR0JEz/7jGEeMCAeSKoqrC9rhgO5zzI=; b=KAesDUYEf3Ov9JIxk8/4FohtXGlkQS/GgGAbFDeZmIFN5AV4m05pLdMQt3c+hA8rUf +CIuHnbPGG16pmUUquy4njCXGX68btd5vjxE2KJJM80e2Flr7a8HfwdHz2ksjaKR9Uxt I91ak0fXy+vzDPA1TFTBhYp1mClTM3nkP1TWtDVPdC5HGGT1XOPnbs2Vnq4uMekzzmT1 fTnV5WgyFoAtJcEPVs1mXFV2aUh9EHEmm4uZ7UJVzJcrJrEFpQDLiINU4NWWHqoirP+A yjVmpylcjUk1WJcLC/muaydX+sH0TZf/vmalBKCYGGUg7SpbSeKad4q/L8vLkDnVPWyi QwOg==
- Fcc: imap://hella.riede@xxxxxxxxxxxx/Sent Items
- In-reply-to: <93be072b-992c-e4ec-ed4e-61a900ec45ff@noaa.gov>
- List-archive: <https://groups.google.com/a/noaa.gov/group/ferret_users/>
- List-help: <https://support.google.com/a/noaa.gov/bin/topic.py?topic=25838>, <mailto:ferret_users+help@noaa.gov>
- List-id: <ferret_users.noaa.gov>
- List-post: <https://groups.google.com/a/noaa.gov/group/ferret_users/post>, <mailto:ferret_users@noaa.gov>
- Mailing-list: list ferret_users@xxxxxxxx; contact ferret_users+owners@xxxxxxxx
- References: <99e4f7ced0844554ba730089bf8c4f1c@mpic.de> <93be072b-992c-e4ec-ed4e-61a900ec45ff@noaa.gov>
- Sender: owner-ferret_users@xxxxxxxx
- Thread-index: AQHS72NKl8qVM0gqnEeRSg8WXMjioqI5GkeAgAmIA4A=
- Thread-topic: [ferret_users] Masking in list command works for floats, not strings
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1
Thanks, Ansley.
Usually, I first define a variable, then list it in a simple way, so that's OK as a workaround for me.
However, there doesn't seem to be a workaround for this one as all variables are defined before listing already:
can var/all
let test = {1,1,0}
let strings = {"a","b","c"}
let masked = if (test) then strings
let masked2 = xsequence(masked)
list masked2
VARIABLE : XSEQUENCE(MASKED)
SUBSET : 3 points (X)
1 / 1: 1.859-316
2 / 2: 1.877-316
3 / 3: 1.877-316
(Last example in mask_string.jnl, see attachment. An extra 'faulty' listing is too big / takes too long for my real dataset.)
Thanks in advance for a hint on this one.
Best wishes,
Hella
On 06/27/2017 11:35 PM, Ansley C. Manke wrote:
> Hi Hella,
>
> Thank you for the example. In principle, specifying an expression as
> the argument to a command:
>
> yes? list if (test) then strings
>
> should be equivalent to defining a variable with that same expression
> and sending that to the command:
>
> yes? let masked = if (test) then strings
> yes? list masked
>
> However there winds up being a slight variation in how the computation
> is done with occasionally different and incorrect results. (Here we're
> seeing pointers to the strings which should be returned!) We had a
> similar bug report a year or two back which I think has been fixed; I'll
> check into this.
>
> Ansley
>
> On 6/27/2017 9:38 AM, Riede, Hella wrote:
>> 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
>
--
...............................................................................
Hella Riede hella.riede@xxxxxxx +49-6131-305-4143
Air chemistry department: Modeling & Global Observations
Max Planck Institute for Chemistry, Hahn-Meitner-Weg 1, 55128 Mainz, Germany
www.mpic.de www.caribic.de
...............................................................................
!! H. Riede 06/2017
!! note, without the 'can var/all' before a new test, the behavior changes
!! as listings influence the behavior of subsequent listings
\message "problem with masked strings -> unexpected values instead of strings:"
can var/all
let test = {1,1,0}
let strings = {"a","b","c"}
list if (test) then strings
\message "(repeat the listing, and the values change every time)"
\message "works: define a masked variable instead, then list"
let masked = if (test) then strings
list masked
\message "alternatively, do the same listing for a float first"
let floats = {2,3,4}
list if (test) then floats
\message "now, also for strings listing while masking works"
list if (test) then strings
\message "the next problem comes with xsequence:"
can var/all
let test = {1,1,0}
let strings = {"a","b","c"}
let masked = if (test) then strings
list xsequence(masked)
\message "again unexpected numerical values instead of strings"
\message "but doing a 'faulty' listing first fixes it:"
can var/all
let test = {1,1,0}
let strings = {"a","b","c"}
list if (test) then strings
let masked = if (test) then strings
list xsequence(masked)
\message "NOT fixed by defining a second masked variable before:"
can var/all
let test = {1,1,0}
let strings = {"a","b","c"}
let masked = if (test) then strings
let masked2 = xsequence(masked)
list masked2
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
Ferret
Privacy Policy | Disclaimer | Accessibility Statement