how to pack geolocation file, a question to ADL_packer

Data formats, HDF5, XML profiles, etc.
kbisanz
Posts: 280
Joined: Wed Jan 05, 2011 7:02 pm
Location: Omaha NE

Re: how to pack geolocation file, a question to ADL_packer

Post by kbisanz »

The degrees to radian conversion is in the depths of the common (CMN) code shared by all the algorithms. It's not specific to LST.

The LST algorithm's *_CFG.xml file contains this:

Code: Select all

      <group name="Geolocation_Mod_TC">
        <config>
          <name>OfficialShortName_1</name>
          <configValue>VIIRS-MOD-RGEO-TC</configValue>
        </config>
        <config>
          <name>OfficialShortNameConversionProduct_1</name>
          <configValue>VIIRS-MOD-GEO-TC</configValue>
        </config>
        <config>
Only in the case of OfficialShortNameConversionProduct_1 will any sort of degree to radian conversion take place. Putting the degrees version (VIIRS-MOD-GEO-TC) under OfficialShortName_1 will NOT cause any conversions to take place. The code checks OfficialShortName_1, OfficialShortNameConversionProduct_1, etc in a specific order and by name and only applies conversions in certain cases.

When the code runs, it first looks for the entry under OfficialShortName_1. If it's found, the code is happy and uses the data as retrieved. However, if OfficialShortName_1 is not found, then OfficialShortNameConversionProduct_1 is searched for. If that's found, the code retrieves the data and performs the conversions as listed for the fields in the product's XML description. For example, $ADL_HOME/cfg/VIIRS_MOD_GEO.xml contains

Code: Select all

        <Field>
            <Name>solar zenith angle</Name>
            <Symbol>sunzen</Symbol>
            ...
            <DictionaryMask>PROCMN_DICT_DEGTORAD_MASK</DictionaryMask>
            <DictionaryMask>PROCMN_DICT_SCAN_FILL_MASK</DictionaryMask>
            <DictionaryMask>PROCMN_DICT_FATSCANFIELD_MASK</DictionaryMask>
            <InitialFill>-999.3</InitialFill>
            <DataType>Float32</DataType>
The <DictionaryMask> tags specify which conversion(s) to apply. In this case, PROCMN_DICT_DEGTORAD_MASK, which tells the code to convert this field from degrees to radians, is specified.

So, if you want the code to perform a degree to radian conversion for you, you need to get it to use the OfficialShortNameConversionProduct_1 entry. You can do this by either removing the OfficialShortName_1 block, or by changing the OfficialShortName_1 entry to be something it won't find, like VIIRS-MOD-RGEO-TC-MISSING. So, you probably want something like this (Note the missing OfficialShortName_1):

Code: Select all

      <group name="Geolocation_Mod_TC">
        <config>
          <name>OfficialShortNameConversionProduct_1</name>
          <configValue>VIIRS-MOD-GEO-TC</configValue>
        </config>
        <config>
          <name>DataEndianType</name>
          <configValue>Big</configValue>
        </config>
      </group>
Kevin Bisanz
Raytheon Company
lucy liu
Posts: 54
Joined: Tue Oct 18, 2011 11:02 am

Re: how to pack geolocation file, a question to ADL_packer

Post by lucy liu »

Thanks a lot.
Only a little confusion comes to the point that the group name of each input item seems not necessarily same as described in the xml file.
I checked the VIIRS_MOD_GEO.xml and found the group name for this product is Geolocation_Mod_DEG not Geolocation_Mod_TC.
<ProductName>VIIRS-MOD-GEO: VIIRS SDR GEO (Deg) Moderate Resolution</ProductName>
<MemoryAlignment>Natural</MemoryAlignment>
<CollectionShortName>VIIRS-MOD-GEO</CollectionShortName>
<NumberOfProductData>21</NumberOfProductData>
<ProductStructName>Auto_ViirsSdrModGeoType</ProductStructName>
<ShellStatus>0</ShellStatus>
<ProductType>GEO</ProductType>
<GenerateCppStructures>true</GenerateCppStructures>
<GenerateFortranStructures>true</GenerateFortranStructures>
<ScaledProduct>false</ScaledProduct>
<UnscaledProduct>false</UnscaledProduct>
<ProductGroupName>Geolocation_Mod_DEG</ProductGroupName>

Thanks again.
kbisanz
Posts: 280
Joined: Wed Jan 05, 2011 7:02 pm
Location: Omaha NE

Re: how to pack geolocation file, a question to ADL_packer

Post by kbisanz »

I mentioned the wrong. I apologize for that. I should have said $ADL_HOME/xml/VIIRS/VIIRS_MOD_GEO_TC.xml

You are correct that the group names have to match up.

Does that clear up the confusion?
Kevin Bisanz
Raytheon Company
lucy liu
Posts: 54
Joined: Tue Oct 18, 2011 11:02 am

Re: how to pack geolocation file, a question to ADL_packer

Post by lucy liu »

Sorry, probably I did not make the question very clear.
Frankly, I followed your suggestion to remove the OfficialShortName_1 block, set the OfficialShortNameConversionProduct_1 as "VIIRS-MOD-GEO" while keeping the group name for geolocation file as "Geolocation_Mod_TC" in LST algorithm's *_CFG.xml . ADL can generate LST without complain.

But if the input has to match with the group name, which means that the group name of geolocation file should be "Geolocation_Mod_DEG" not "Geolocation_Mod_TC" . The rebuilt will give an error.

That is the reason why I am confused if the group name has to match up with the input type.

I used GMODO type NCT4 data which is not terrain corrected. After pack, the binary file name is "4eb7f755-227a2-007f0100-a4bd4a37.VIIRS-MOD-GEO"
That is why I checked the VIIRS_MOD_GEO.xml and found the group name for this product is Geolocation_Mod_DEG not Geolocation_Mod_TC.
The LST algorithm's *_CFG.xml file contains this:

<group name="Geolocation_Mod_TC">
<config>
<name>OfficialShortName_1</name>
<configValue>VIIRS-MOD-RGEO-TC</configValue>
</config>
<config>
<name>OfficialShortNameConversionProduct_1</name>
<configValue>VIIRS-MOD-GEO-TC</configValue>
</config>
<config>
2

I tried to change the <group name="Geolocation_Mod_DEG"> and rebuilt code.
Following error is given for this run.
ProEdrViirsLST.cpp:225: error: ‘inputGeolocation_Mod_TC_’ was not declared in this scope.

I checked the ProEdrViirsLST.cpp and found no inputGeolocation_Mod_TC_ but inputGeolocation_Mod_DEG_
,which is automatically generated during rebuilt. So I change the code on this line through modifying inputGeolocation_Mod_TC_ to inputGeolocation_Mod_DEG_.

* virtual */ Int32 ProEdrViirsLST::doProcessing()

// Get geolocation data
// geo_ptr = inputGeolocation_Mod_TC_.start_Ptr; // this is original
geo_ptr = inputGeolocation_Mod_DEG_.start_Ptr; // this is my modification

but it gave a new error
ProEdrViirsLST.cpp:226: error: cannot convert ‘Auto_ViirsSdrModGeoType*’ to ‘Auto_ViirsSdrModRGeoTcType*’ in assignment.

I donot know what is wrong here. I donot expect the code change like this for different format of input.

Thanks.
kbisanz
Posts: 280
Joined: Wed Jan 05, 2011 7:02 pm
Location: Omaha NE

Re: how to pack geolocation file, a question to ADL_packer

Post by kbisanz »

I will admit that the group name stuff is confusing. :) Also, perhaps some of my previous comments haven't been as clear as they could have been.

Ignore what I said about "You are correct that the group names have to match up." That statement is too simple.

The group name in the *_CFG.xml file (<group name="Geolocation_Mod_TC">) should be the group name of the input that the algorithm is expecting. So in this case, LST expects a terrain corrected radian geolocation input, which normally has the group name of Geolocation_Mod_TC.

Items listed in OfficialShortNameConversionProduct_1 have different group names (if you go and look at their XML file) because they're different items. However, they can be used in place of the OfficialShortName_1 with some sort of conversion. Note that conversions only take place when an input is retrieved from OfficialShortNameConversionProduct_N (where N is 1, 2, 3, etc). So, the item listed under OfficialShortNameConversionProduct_1 would be converted to be equivalent to what the algorithm is expecting, which is radian geolocation. There is no way to convert between terrain corrected and non terrain corrected products.

So, when you change <group name="Geolocation_Mod_TC"> to be <group name="Geolocation_Mod_DEG"> you are changing the input the algorithm expects. You found the auto generated members that would need to change. Additionally, VIIRS_MOD_RGEO.xml and the other XMLs contain <ProductStructName>, which is the name of the structure which is auto generated into $ADL_HOME/include/AutoGeneratedViirsProductsGbl.h, which is also the type of inputGeolocation_Mod_TC_.

At the top of ProEdrViirsLST::doProcessing() in ProEdrViirsLST.cpp, the problem is that geo_ptr was declared as Auto_ViirsSdrModRGeoTcType, but after your change, the type of inputGeolocation_Mod_TC_.start_Ptr is Auto_ViirsSdrModGeoType (because you changed the group name). The compiler doesn't know that those two structs actually have the same format, so it won't let you do the pointer assignment. If you wanted to do that, you'd need to change the types, or do some casting. However, I don't think that's the best solution in this case.

I believe what you want to do is what you had working first: where you had <group name="Geolocation_Mod_TC"> and removed OfficialShortName_1.
Kevin Bisanz
Raytheon Company
lucy liu
Posts: 54
Joined: Tue Oct 18, 2011 11:02 am

Re: how to pack geolocation file, a question to ADL_packer

Post by lucy liu »

Now the logic is clear to me. Thanks a lot.
Post Reply