Welcome to the BEAM Forum!

We encourage you to sign in our forum and participate in the BEAM community. The forum is maintained by the BEAM project team who will most likely answer your questions within 24 hours (except during common holidays) - if not done by other community members. Collaborate, share your knowledge and learn from other users!

If you don't find what you are looking for, please also consider the following external forums:

Combination View Flat View Tree View
Threads [ Previous | Next ]
Data type of meris L2_flags
toggle
Data type of meris L2_flags
3/17/11 10:31 AM
In the BEAM help I found the following information on flag data-sets:

Flag-Dataset
A special band type which contains quality flag information. Flag datasets always have an unsigned integer data type (8 to 32 bit). Each bit in a sample corresponds to a special flag value. Each flag's metadata is stored in a corresponding flag coding object.

Using BEAM, I opened a Level 2 MERIS RR scene, which I had downloaded from the merci website. The Information on the L2_flags states: Raw data type: float64.

Please clarify this contradicting information, i.e. float64 versus unsigned integer.
Flag Flag
RE: Data type of meris L2_flags
4/12/11 9:07 AM as a reply to Gerard Hesselmans.
The raw data type of the flag data set is uint32 (4 byte unsigned integer). For displaying and interpreting the flag image, the internal image data buffer has to be of a geophysical data type, which is capable of representing the full range of uint32 values.

However, there is no uint32 type in Java; int64 (8 byte signed integer, i.e. long) would be an appropriate geophysical data type, but this type is not supported by the Java imagery. The type float64 (8 byte floating point, i.e. double) is capable of representing the full range of uint32 values without loss of precision and is supported by the Java imagery. Hence float64 is the geophysical data type of the flag data set.
Flag Flag
RE: Data type of meris L2_flags
3/17/11 10:31 AM as a reply to Ralf Quast.
Ralf Quast:
The raw data type of the flag data set is uint32 (4 byte unsigned integer). For displaying and interpreting the flag image, the internal image data buffer has to be of a geophysical data type, which is capable of representing the full range of uint32 values.

However, there is no uint32 type in Java; int64 (8 byte signed integer, i.e. long) would be an appropriate geophysical data type, but this type is not supported by the Java imagery. The type float64 (8 byte floating point, i.e. double) is capable of representing the full range of uint32 values without loss of precision and supported by the Java imagery. Hence float64 is the geophysical data type of the flag data set.
Flag Flag
RE: Data type of meris L2_flags
4/11/11 4:40 PM as a reply to Gerard Hesselmans.
Dear Ralf

I tried your suggestion to set the data type of flags to double precision floating point,
which implies that the data type of flag_masks should be double precision floating point as well
according to the CF_1.4 manual.
However, I cannot read the resulting file.
BEAM complains about being unable to read a non-integer band.
Should the data type of flag_masks be integer and therefore the data type of flags be integer as well?

Using BEAM I exported a MERIS L2 RR scene to netcdf.
Ncdump tells me that the data type of flags is int, which contradicts your suggestion to use double floating point.

Please clarify.

Regards, Gerard
Flag Flag
RE: Data type of meris L2_flags
4/12/11 12:01 PM as a reply to Gerard Hesselmans.
I explained how BEAM handles several data types and I explained why the geophysical data type for the flag band is float64 whereas the raw data type is uint32. This is the clarification you have requested, but not a suggestion. There is no contradiction.

Be sure that the raw data type of the flag band is uint32. NetCDF only cares about the raw data type. The geophysical data type is used for displaying the image data in BEAM; you do not have to care or worry about it, because it is derived from the raw data type, which is the same as the netCDF data type. When you carefully inspect the information on the flag band, you will see that the raw data type of the flag band is uint32, but not float64 as stated in your original post.

The geophysical data type is used for interpreting the raw number data as geophysical numbers. The relation between raw numbers and geophysical numbers is often defined by a scaling factor or an offset, but in principle can be defined by any type of reinterpretation. The geophysical data type might as well have been called reinterpretation type, but the actual term is geophysical data type.
Flag Flag
RE: Data type of meris L2_flags
4/12/11 2:29 PM as a reply to Ralf Quast.
Hello Ralf

It appears I did not understand you correctly.
Please correct me if I am wrong.

1. The data type of l2_flags in a netcdf file should be integer.
This is what you refer to as raw data.
In the meris L2 data files the data type is uint32.
In netcdf files created by BEAM the data type is int32.

2. The data type of the l2_flags as used inside BEAM is float64, because uint32 is not supported by java.
These BEAM internal data is what you refer to as geophyical data.

3. The data type of l2_flags and flag_masks in a netcdf file has to be integer and the same for both.
The integer can be signed or unsigned and the number of bits is not fixed
as long as all flag values can be represented.
The meris l2_flags variable requires 24 bits, therefore both int32 and uint32 are suitable data types
to store l2_flags in a netcdf file used as input for BEAM.

Regards, Gerard
Flag Flag
RE: Data type of meris L2_flags
4/12/11 4:45 PM as a reply to Gerard Hesselmans.
1. The data type of l2_flags in netCDF should be the same as the raw data type in BEAM, i.e. uint32. However BEAM has to write l2_flags as int32 instead of uint32 because netCDF 3 does not support uint32.

2. BEAM uses two different data types: the raw data type and the geophysical data type. The former is used for storing, wheres as the latter is used for image display. This is a distinct feature. Usually these data types are the same, except when the raw numbers are subject to scaling or offset, or the raw data type is not supported by the Java imaging framework. The geophysical data type always ensures that numbers are interpreted correctly.

3. Correct. But netCDF 3 does not support uint32, hence you have to use int32 instead.
Flag Flag