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 ]
Pixel extraction - flag info
toggle
Hi,

I am extracting pixel values from MERIS images which are saved in netCDF format (.nc). All works fine except that I do not get the individual flags out. Is this related to the file format?

Best regards,
Silvia
Flag Flag
RE: Pixel extraction - flag info
9/4/14 1:47 PM as a reply to Silvia Huber.
Hi,

more specifically, we are using the netCDF cf format. Maybe this helps to answer the question.

Cheers,
Silvia
Flag Flag
RE: Pixel extraction - flag info
9/10/14 10:15 AM as a reply to Silvia Huber.
Dear Silvia,

can you maybe attach the CDL of the file you are trying to open? You get the CDL with the command

1ncdump -h <yourFile> > out.cdl


Cheers,
Thomas
Flag Flag
RE: Pixel extraction - flag info
9/16/14 10:32 AM as a reply to Thomas Storm.
Hi Thomas,
I attached the ncdump for a file.

Cheers,
Silvia

(NB: we reprocessed some data and saved it as netCDF Beam format and then we could get the flags information in the pixel extraction utility)
Attachments: ncdump_20090505.txt (6.8k)
Flag Flag
RE: Pixel extraction - flag info
9/16/14 3:06 PM as a reply to Silvia Huber.
Hi Silvia,

indeed the issue is related to the file format. BEAM expects the variable to feature an attribute "flag_values", otherwise the flags are not interpreted as masks. Only masks, not flags, are supported by the pixel extraction tool, so since the flag variable in the excerpt you sent me does not feature the "flag_values" attribute, the problem is explained.

Anyhow, it is clearly a bug in BEAM, since it does not write the "flag_values" attribute to the NetCDF-files it exports. I have created an issue for that in our bugtracking system.

As long as we haven't fixed the issue, the following workaround might help you. At least it did the trick for me: add the expected attribute manually to the file. This can be done using the nco-tool "ncatted". You can find the nco-tools here.
The command I used was

1ncatted my_file.nc -a flag_values,l1_flags,a,b,"1,2,3,4,5,6,7,8"

Let me know if this was helpful for you.

Cheers,
Thomas
Flag Flag