Change Granule Metadata in the VI EDR Product

Issues related to VIIRS EDR algorithms and data
Post Reply
JeffVI
Posts: 18
Joined: Mon Jul 21, 2014 8:42 am

Change Granule Metadata in the VI EDR Product

Post by JeffVI »

Sorry to bother you all again on a new challenge:
I was able to add new data field TOC NDVI in the VI EDR product, and now up to the task to change the Granule Level Meta Data, such as Overall TOC NDVI Exclusion Summary, Quality Summary etc. I made the following changes, but couldn't get through the Rebuilding Process successfully.
1. Change $ADL_HOME/xml/VIIRS/VIIRS_VI_EDR.xml to add new data field
2. Change $ADL_HOME/xml/VIIRS/VIIRS_VI_FEDR.xml to add new data field
3. Update $ADL_HOME/cfg/ProCmnProductDictionary_CFG.xml
4. Update $ADL_HOME/include/ProCmnMetadata.h
5. Update $ADL_HOME/include/ProEdrViirsVIGbl.h
6. Change $ADL_HOME/include/ProCmnDqttTestId.h
7. Change $ADL_HOME/EDR/VIIRS/land/VegIndex/include/ProEdrViirsVIDelegate.h
8. Change $ADL_HOME/EDR/VIIRS/land/VegIndex/src/ProEdrViirsVI.cpp
9. Change $ADL_HOME/EDR/VIIRS/land/VegIndex/src/ProEdrViirsVIDelegate.cpp
10. Change $ADL_HOME/EDR/VIIRS/land/VegIndex/src/Calculate_VegIndex.cpp
11. Change $ADL_HOME/cfg/dqmtables/NPP/VIIRS/EDR/VI/VIIRS-VI-EDR-DQTT_npp_20020101010000Z_20020101010000Z_ee00000000000000Z_BASELINE-MON-1_devl_dev_noaa_ops.xml

12. Rebuild ADL by:
1). Execute “make src” in $ADL_HOME/xml/VIIRS
2). Execute “make clean library” in $ADL_HOME/CMN/Utilities/Dictionary/Entries/VIIRS/src/
3). Execute “make clean library program” in $ADL_HOME/EDR/VIIRS/land/VegIndex/src/

I am attaching some log information. The only thing I figured the errors are:
/data/data132/ADL4.2/ADL/lib/libProEdrViirsVI.so: undefined reference to `VI_TOCNDVI_EXCL_SUM'
/data/data132/ADL4.2/ADL/lib/libProEdrViirsVI.so: undefined reference to `VI_TOCNDVI_QUAL'

I am also attaching all the files that I made changes so that maybe someone can help me to test it out. Thank you very very much! Any timely help is sincerely and deeply appreciated!!!
Attachments
CODES_J1_TOC_NDVI.zip
(272.24 KiB) Downloaded 747 times

[The extension txt has been deactivated and can no longer be displayed.]

JeffVI
Posts: 18
Joined: Mon Jul 21, 2014 8:42 am

Re: Change Granule Metadata in the VI EDR Product

Post by JeffVI »

For anyone who are interested, the following is the answer Todd kindly provided:
It looks to me like the strings VI_TOCNDVI_QUAL and VI_TOCNDVI_EXCL_SUM have not been defined. You declared these as extern const std::string in ProCmnMetadata.h, but they have to be defined in a .cpp file. I don't know what the definitions should be, but I think the file in which you would define them is $ADL_HOME/CMN/PROStrings/src/ProCmnMetadata.cpp. After defining them in this file, you would run 'make clean library' in the same directory, then run 'make program' in $ADL_HOME/EDR/VIIRS/land/VegIndex/src.

Please let me know if you have more questions or comments.

Thanks,
Todd
JeffVI
Posts: 18
Joined: Mon Jul 21, 2014 8:42 am

Re: Change Granule Metadata in the VI EDR Product

Post by JeffVI »

Dear All,

Now I have another strange question on the Granule Level Meta Information.

For IDPS operational product VIVIO, we have:

Code: Select all

N_Quality_Summary_Names = EVI Exclusion Summary,EVI Summary Quality,NDVI Exclusion Summary,NDVI Summary Quality,No Land in Granule
But after our code changes, we have:

Code: Select all

 N_Quality_Summary_Names = No Land in Granule,TOA NDVI Exclusion Summary,TOA NDVI Summary Quality,TOC EVI Exclusion Summary,TOC EVI Summary Quality,TOC NDVI Exclusion Summary,TOC NDVI Summary Quality
In particular, the 'No Land in Granule' has switched its position from the last to the first! I couldn't figure out where the code changes I made that caused this 'place changing' issue. Any hints or suggestions please? I looked everywhere in the ADL, but couldn't find the file that controls the order of these meta information.

Thanks!
tsimpson
Posts: 23
Joined: Wed Apr 02, 2014 9:23 am
Location: Riverdale, MD, USA

Re: Change Granule Metadata in the VI EDR Product

Post by tsimpson »

I think the N_Quality_Summary_Names list is being ordered alphabetically. Before your code changes, 'No Land in Granule' was last in alphabetical order, but after your changes, it is first. As long as each name has the correct value in the N_Quality_Summary_Values list, I don't think this is a problem with ADL.

Hope this helps ... please let me know if there are more questions or comments.

Thanks,
Todd
Todd Simpson
Raytheon Company
JeffVI
Posts: 18
Joined: Mon Jul 21, 2014 8:42 am

Re: Change Granule Metadata in the VI EDR Product

Post by JeffVI »

Thank you very much, Todd,
Yes indeed that the values are corresponding to those names correctly.
Your explanation makes lot of sense to me. Appreciate your quick help very much!
JeffVI
Posts: 18
Joined: Mon Jul 21, 2014 8:42 am

Re: Change Granule Metadata in the VI EDR Product

Post by JeffVI »

I have another quick question as well if you don't mind:
We are creating a new QF byte for the VI EDR products. And it will contain 1 bit for TOC NDVI Quality, 2 bits (1-2) for Aerosol Quality, and 2 bits (3-4) for VCM quality. And we need to have the FILL VALUE for BOWTIE DELETED PIXELS for the Aerosol Quality bits (1-2) as 3, and all the rest QF's fill values are 0. So I changed the following two xml files in the $ADL_HOME/xml/VIIRS folder:

Code: Select all

VIIRS_VI_EDR.xml
VIIRS_VI_FEDR.xml
We added the new QF4 datafield, with an initial value of 6 (2^1+2^2). However, the Aerosol Quality QF was not outputted properly as all the granule will be 3 throughout (all FILL VALUES, not only just BOW TIE pixels). However, if we set the initial value of QF4 as 0, the aerosol Quality QF were then outputted properly with 0 as high quality and 3 as not produced, but the Bowtie deleted pixel will also be set as 0 (high aerosol quality) which is not we want.
I am struggling with this. Any chance I can get some hints? I checked the VI EDR Calculate_VegIndex.cpp algorithm as well, but did not really see any BowTie Deleted pixel value assignment in the VI algorithm itself. Any help or hints are sincerely appreciated!
JeffVI
Posts: 18
Joined: Mon Jul 21, 2014 8:42 am

Re: Change Granule Metadata in the VI EDR Product

Post by JeffVI »

I am sharing the VI Algorithm (replace *.txt with *.cpp to make it work in ADL), and the two XML files, that I made changes to set the FILL VALUES of the Bowtie Deleted pixels for the bit 1-2 of the new QF4 in the VI EDR product as 3 instead of 0. Any kind and helpful review on my code changes are sincerely appreciated!
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

[The extension xml has been deactivated and can no longer be displayed.]

[The extension xml has been deactivated and can no longer be displayed.]

JeffVI
Posts: 18
Joined: Mon Jul 21, 2014 8:42 am

Re: Change Granule Metadata in the VI EDR Product

Post by JeffVI »

Thanks a lot to Todd's timely help. The problem was due to:
From Todd:
I started looking into this issue earlier today and I think you forgot to clear the initial fill for the non bowtie deleted pixels. When you had the initial fill of 6 in the XML files, that would set the QF4 byte to 6 for all pixels, then your code makes changes to QF4 for non bowtie deleted pixels by ORing it with other quality flags. But the OR operations cannot clear any bits in QF4 that were already set.
I downloaded the Calculate_VegIndex.txt you posted at the forum and added a line to clear the QF4 byte. I think this change would fix the problem.
The following changes in the algorithm fixed the problem:

Code: Select all

// Initialize the QF4 byte
			(viData->viirsVegIndexIP->qfbyte3[imgRow][imgCol]) = 0;

		    // Aerosol AOT Quality - copied from Aerosol IP
		    (viData->viirsVegIndexIP->qfbyte3[imgRow][imgCol]) |=
                      (aeroQuality << VI_AOT_QUAL_SHIFT); 
Post Reply