[Thread Prev][Thread Next][Index]
[ferret_users] masking with OR and undefined values doesn't work as expected
- To: ferret users <ferret_users@xxxxxxxx>
- Subject: [ferret_users] masking with OR and undefined values doesn't work as expected
- From: Hella Riede <hella.riede@xxxxxxx>
- Date: Thu, 20 Jul 2017 19:11:04 +0200
- 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=content-transfer-encoding:content-language:mime-version:user-agent :date:message-id:subject:from:to:arc-authentication-results; bh=W5bGtiZBofyGBgn2yO2G2vH1en74C29w4+/L6jFnlVo=; b=q+Zqy2Gw6MN8kBjDls6LrSRuThrCzwounGgmTemANR8AczL/Nf/owJ8I/QocYI8D0Z xHYHla1rpGH8huhkM2OxkWITA1Whw3lG4dfq34VjdNlQlhkqTs54VY73LVTCU/XyrQLM quvt32g5oSWg9bycjMbDMbUI0WMlIWNHJXslzfF7/4xUGbbcdbU+WJAztwPPdoWKkxjA N6YfUGFuApMV5iyR+DrEnZjtR7xHOiGbWrJg/ULXS7whuwYAmQdHsybq17p9H1ZUvf5x nMpxLjwEB6oxcsKI1dnqTLnMCd57dRAyiVfrS7J6SUVJRBlflq1PmtFxfCVnR/h0pCdP LzIg==
- Arc-seal: i=1; a=rsa-sha256; t=1500570673; cv=none; d=google.com; s=arc-20160816; b=eBR7Hps1ZBF5MRtsbHx7VaBOF+yqxjBjY83hsBCf9e57bUjW1YYlLBmPHILs3bkrfX ROsHYDR3K1OIisB71ZrlZ2NN3OzVZY8zZM4A6oMx3VLniV9ZAKJ02mVWIKKXr25KJ8yj vwfYsQk/AvzKlos7CgNjgbQ34o9kwrpXl9YGEIOr9+6bxawuJGleECTnYhFQlHJV32oU QmEaayWy4VyrgcRSX96CX6Nh2d+pVxsyPOhIy/j1theZlUFgaxF5sQg3h42ZDKY2i5R9 j3L8u1P//RJfBfETETLBk19XDsCy2qdkPuqRZS3hn9KFWxpOe47P9QWqgsUTRn2qOfJE ri1g==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=noaa-gov.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive; bh=W5bGtiZBofyGBgn2yO2G2vH1en74C29w4+/L6jFnlVo=; b=Co4Tl+TaH+ISD58qHvbcY4vE1QFVDU7C409XtogVtNsj+yuLTLbnW9JzRJ4r1AzFCi c8YTj1QBPd7NZU74wdHb5T4vIkdm9SJXO6fOwyjmSnkyDGAcCaYlGPxoAX3DEtLOpLtv ro3HfpBc0xMbj0ZwD63JMz0f2Jil5GWn28l/SPYND8p3oH0jghQP1wLhdB7VFvkzFp6n A/4DPCo5iCONiRidPCOOagtDLvdpiSc0jood7m5ZK+/j3Vms+BWbOqQ6BXzcImmpTZXm L/KGdJ2qvJa96jPaBWP1XVmSVAWeLyG4AfDYqXmsaAPYCFlJQHbnlslrGMgOmxMXP8L3 IOhA==
- 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
- Sender: owner-ferret_users@xxxxxxxx
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1
Hi ferreters, hi developers,
masking is a bit counterintuitive in ferret when involving undefined values:
yes? let a = {1,2,-1E34,4}
yes? let b = {1,-1E34,3,4}
yes? let bla = if (a OR b) then 1
yes? list bla
VARIABLE : IF (A OR B) THEN 1
SUBSET : 4 points (X)
1 / 1: 1.000
2 / 2: ....
3 / 3: ....
4 / 4: 1.000
'OR' implies that 'bla' should be equal to 1 for all 4 data points, because at all 4 points either a or b is actually defined. However, it sets all points to undefined that are undefined in either a or b.
Also this not very elegant version won't work:
yes? let bla = if (a NE -1E34 OR b NE -1E34) then 1
yes? list bla
VARIABLE : IF (A NE -1E34 OR B NE -1E34) THEN 1
SUBSET : 4 points (X)
1 / 1: 1.000
2 / 2: ....
3 / 3: ....
4 / 4: 1.000
Of course this is only a problem when undefined values are involved. Otherwise masking with OR works as expected:
yes? let a = {1,1,2,1}
yes? let b = {1,2,1,1}
yes? let bla = if (a EQ 2 OR b EQ 2) then 1
yes? list bla
VARIABLE : IF (A EQ 2 OR B EQ 2) THEN 1
SUBSET : 4 points (X)
1 / 1: ....
2 / 2: 1.000
3 / 3: 1.000
4 / 4: ....
A workaround is to set undefined values to zero and then do the masking. However, this makes 'real' zero values indistinguishable from undefined values, which could otherwise be kept apart by 'if (a or a EQ 0) then ...'.
Sorry if I missed a note on this in the ferret documentation.
Best wishes,
Hella
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
Ferret
Privacy Policy | Disclaimer | Accessibility Statement