⇐ ⇒

[CF-metadata] Multiple zeros in flag_values allowed?

From: Martin Juckes - UKRI STFC <martin.juckes>
Date: Wed, 21 Nov 2018 21:40:23 +0000

Dear Jim,


sorry, I stand corrected. Thank you for the detailed explanation.


The conformance statements looks to be in error.


Is there a clear rule for what makes a valid set of flag_values when used in conjunction with flag_masks?


regards,

Martin


________________________________
From: Jim Biard <jbiard at cicsnc.org>
Sent: 21 November 2018 20:50
To: Juckes, Martin (STFC,RAL,RALSP); cf-metadata at cgd.ucar.edu
Subject: Re: [CF-metadata] Multiple zeros in flag_values allowed?


Martin,

The two subfields are independent. You can have very bad quality data and very bad weather at the same time. And that's how the flag masks and flag values are supposed to work. The mask splits off bit regions that are independent of one another. There is no ambiguity.

The possible options and the values masked by the flag masks of 3 (binary 0011) and 12 (binary 1100) are:

Weather Quality
        Binary Value
        Binary value & 3
        Binary value & 12

very bad
        very bad
        0000
        0
        0

very bad
        bad
        0001
        1
        0

very bad
        good
        0010
        2
        0

very bad
        very good
        0011
        3
        0

bad very bad 0100
        0
        4

bad bad 0101
        1
        4

bad good 0110
        2
        4

bad very good 0111
        3
        4

good very bad 1000
        0
        8

good bad 1001
        1
        8

good good 1010
        2
        8

good
        very good 1011
        3
        8

very good very bad 1100
        0
        12

very good bad 1101
        1
        12

very good good 1110
        2
        12

very good very good 1111
        3
        12


Grace and peace,

Jim

On 11/21/18 12:03 PM, Martin Juckes - UKRI STFC wrote:

Hello Jim, Julien,


I'm not sure .. I think the conformance might be right here and your flag_values should be 0,1,2,3, 4, 8,12,16, and flag_masks 3,3,3,3,28,28,28,28


If, for instance, you very_bad_quality and very_bad_weather, then "var" should have value 4 = '00100000` in binary. Masked with 3 (11000000) gives zero, and masked with 28 (00111000) gives 4. Re-using the zero value would make zero ambiguous, so you need to start the 2nd sequence at 4.


regards,

Martin

________________________________
From: CF-metadata <cf-metadata-bounces at cgd.ucar.edu><mailto:cf-metadata-bounces at cgd.ucar.edu> on behalf of Jim Biard <jbiard at cicsnc.org><mailto:jbiard at cicsnc.org>
Sent: 20 November 2018 16:51:24
To: cf-metadata at cgd.ucar.edu<mailto:cf-metadata at cgd.ucar.edu>
Subject: Re: [CF-metadata] Multiple zeros in flag_values allowed?


Julien,

That's fine. The conformance document probably needs a better statement of the requirement when flag masks are used.

Grace and peace,

Jim

On 11/20/18 11:40 AM, Julien Demaria wrote:
Hi,

We want to define a flags variable defining like that:
var:flag_masks = 3, 3, 3, 3, 12, 12, 12, 12 ;
var:flag_values = 0, 1, 2, 3, 0, 4, 8, 12 ;
var:flag_meanings = ?very_bad_quality bad_quality good_quality very_good_quality
                                            very_bad_weather bad_weather good_weather very_good_weather? ;

I understand from http://cfconventions.org/Conformance/conformance.html that it is not allowed to use several time the same value (here zero) in flag_values:

Requirements:

? The flag_values attribute values must be mutually exclusive among the set of flag_values attribute values defined for that variable.
So it means that for each new ?bits combination? in the flags definition we lost one of the combination because we cannot use zero more than one time?
Do you confirm this? What is the reason?

Thanks in advance,
Julien




_______________________________________________
CF-metadata mailing list
CF-metadata at cgd.ucar.edu<mailto:CF-metadata at cgd.ucar.edu><mailto:CF-metadata at cgd.ucar.edu><mailto:CF-metadata at cgd.ucar.edu>
http://mailman.cgd.ucar.edu/mailman/listinfo/cf-metadata


--
[CICS-NC] <http://www.cicsnc.org/><http://www.cicsnc.org/> Visit us on
Facebook <http://www.facebook.com/cicsnc><http://www.facebook.com/cicsnc>       Jim Biard
Research Scholar
Cooperative Institute for Climate and Satellites NC <http://cicsnc.org/><http://cicsnc.org/>
North Carolina State University <http://ncsu.edu/><http://ncsu.edu/>
NOAA National Centers for Environmental Information <http://ncdc.noaa.gov/><http://ncdc.noaa.gov/>
formerly NOAA?s National Climatic Data Center
151 Patton Ave, Asheville, NC 28801
e: jbiard at cicsnc.org<mailto:jbiard at cicsnc.org><mailto:jbiard at cicsnc.org><mailto:jbiard at cicsnc.org>
o: +1 828 271 4900
Connect with us on Facebook for climate<https://www.facebook.com/NOAANCEIclimate><https://www.facebook.com/NOAANCEIclimate> and ocean and geophysics<https://www.facebook.com/NOAANCEIoceangeo><https://www.facebook.com/NOAANCEIoceangeo> information, and follow us on Twitter at _at_NOAANCEIclimate<https://twitter.com/NOAANCEIclimate><https://twitter.com/NOAANCEIclimate> and @NOAANCEIocngeo<https://twitter.com/NOAANCEIocngeo><https://twitter.com/NOAANCEIocngeo>.
--
[CICS-NC] <http://www.cicsnc.org/> Visit us on
Facebook <http://www.facebook.com/cicsnc>       Jim Biard
Research Scholar
Cooperative Institute for Climate and Satellites NC <http://cicsnc.org/>
North Carolina State University <http://ncsu.edu/>
NOAA National Centers for Environmental Information <http://ncdc.noaa.gov/>
formerly NOAA?s National Climatic Data Center
151 Patton Ave, Asheville, NC 28801
e: jbiard at cicsnc.org<mailto:jbiard at cicsnc.org>
o: +1 828 271 4900
Connect with us on Facebook for climate<https://www.facebook.com/NOAANCEIclimate> and ocean and geophysics<https://www.facebook.com/NOAANCEIoceangeo> information, and follow us on Twitter at _at_NOAANCEIclimate<https://twitter.com/NOAANCEIclimate> and @NOAANCEIocngeo<https://twitter.com/NOAANCEIocngeo>.
Received on Wed Nov 21 2018 - 14:40:23 GMT

This archive was generated by hypermail 2.3.0 : Tue Sep 13 2022 - 23:02:43 BST

⇐ ⇒