<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
p.xmsonormal, li.xmsonormal, div.xmsonormal
{mso-style-name:x_msonormal;
margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.xxmsonormal, li.xxmsonormal, div.xxmsonormal
{mso-style-name:x_xmsonormal;
margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle24
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='mso-fareast-language:EN-US'>I think the problem is that there isn’t any real way to handle the IEEE-754 (or raw int/uint bitmask) in GDAL at the moment. <o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Working through the part you’ve posted:<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>S is the unit quantity<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>The part that looks like:<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>B\\0\\0\\0<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>is therefore the SCALE FACTOR, which is really IEEE 754-2008 binary encoded, and the existing TRE XML definition and parsing code doesn’t handle that case AFAICT.<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>This part is the ROW_GSD and COL_GSD + units:<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>0030.00<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>M<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>0030.00<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>M<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>In that case, I think there is a missing value in the TRE (because there has to be four bytes, and there are only three shown in your sample, which I assume is the test data that NGA derived from LANDSAT 8).<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>I’ve also been looking at handling “weird” TREs better (on and off for a while). I have a Java implementation that shares the XML definition, and the plan is to add two new types to the field definition:<o:p></o:p></span></p><p class=MsoNormal style='line-height:14.25pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'><</span><span style='font-size:10.5pt;font-family:"Courier New";color:#569CD6'>xs:attribute</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:#9CDCFE'>name</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'>=</span><span style='font-size:10.5pt;font-family:"Courier New";color:#CE9178'>"type"</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:#9CDCFE'>use</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'>=</span><span style='font-size:10.5pt;font-family:"Courier New";color:#CE9178'>"optional"</span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'>></span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'><o:p></o:p></span></p><p class=MsoNormal style='line-height:14.25pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'><</span><span style='font-size:10.5pt;font-family:"Courier New";color:#569CD6'>xs:simpleType</span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'>></span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'><o:p></o:p></span></p><p class=MsoNormal style='line-height:14.25pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'><</span><span style='font-size:10.5pt;font-family:"Courier New";color:#569CD6'>xs:restriction</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:#9CDCFE'>base</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'>=</span><span style='font-size:10.5pt;font-family:"Courier New";color:#CE9178'>"xs:string"</span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'>></span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'><o:p></o:p></span></p><p class=MsoNormal style='line-height:14.25pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'><</span><span style='font-size:10.5pt;font-family:"Courier New";color:#569CD6'>xs:enumeration</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:#9CDCFE'>value</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'>=</span><span style='font-size:10.5pt;font-family:"Courier New";color:#CE9178'>"string"</span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'>/></span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'><o:p></o:p></span></p><p class=MsoNormal style='line-height:14.25pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'><</span><span style='font-size:10.5pt;font-family:"Courier New";color:#569CD6'>xs:enumeration</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:#9CDCFE'>value</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'>=</span><span style='font-size:10.5pt;font-family:"Courier New";color:#CE9178'>"integer"</span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'>/></span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'><o:p></o:p></span></p><p class=MsoNormal style='line-height:14.25pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'><</span><span style='font-size:10.5pt;font-family:"Courier New";color:#569CD6'>xs:enumeration</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:#9CDCFE'>value</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'>=</span><span style='font-size:10.5pt;font-family:"Courier New";color:#CE9178'>"real"</span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'>/></span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'><o:p></o:p></span></p><p class=MsoNormal style='line-height:14.25pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'><</span><span style='font-size:10.5pt;font-family:"Courier New";color:#569CD6'>xs:enumeration</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:#9CDCFE'>value</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'>=</span><span style='font-size:10.5pt;font-family:"Courier New";color:#CE9178'>"UINT"</span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'>/></span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'><o:p></o:p></span></p><p class=MsoNormal style='line-height:14.25pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'><</span><span style='font-size:10.5pt;font-family:"Courier New";color:#569CD6'>xs:enumeration</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:#9CDCFE'>value</span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'>=</span><span style='font-size:10.5pt;font-family:"Courier New";color:#CE9178'>"IEEE754"</span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'>/></span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'><o:p></o:p></span></p><p class=MsoNormal style='line-height:14.25pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'></</span><span style='font-size:10.5pt;font-family:"Courier New";color:#569CD6'>xs:restriction</span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'>></span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'><o:p></o:p></span></p><p class=MsoNormal style='line-height:14.25pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'></</span><span style='font-size:10.5pt;font-family:"Courier New";color:#569CD6'>xs:simpleType</span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'>></span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'><o:p></o:p></span></p><p class=MsoNormal style='line-height:14.25pt;background:#1E1E1E'><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'> </span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'></</span><span style='font-size:10.5pt;font-family:"Courier New";color:#569CD6'>xs:attribute</span><span style='font-size:10.5pt;font-family:"Courier New";color:gray'>></span><span style='font-size:10.5pt;font-family:"Courier New";color:#D4D4D4'><o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>(where UINT and IEEE754 values are new, and are binary encoded instead of string encoded).<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Happy to collaborate on this if you’re interested.<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Brad<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> Edson, Adam Robert <are131@psu.edu> <br><b>Sent:</b> Monday, 14 October 2019 10:02 PM<br><b>To:</b> Brad Hards <bradh@frogmouth.net>; gdal-dev@lists.osgeo.org<br><b>Subject:</b> Re: [gdal-dev] python GDAL issue<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>I am working on adding BANDSB and the other TREs listed in the SNIP document.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>I am not sure what you are asking for.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>However, here is the output from gdal.getMetadata('TRE') for the relevant portion of the BANDSB TRE<o:p></o:p></span></p></div><div><pre><span style='color:black'>SPECTRAL RADIANCE SB\\0\\0\\0\\0\\0\\00030.00M0030.00M-------M-------M <br> <span style='background:yellow'> <a href="file://0//0DETECTOR">\\0\\0DETECTOR</a></span> \x7fU<o:p></o:p></span></pre><p class=MsoNormal><span style='font-size:12.0pt;color:black'>This is the section from the radiometric_quantity field to wave_length_unit field.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>Thanks!<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>Adam<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div class=MsoNormal align=center style='text-align:center'><hr size=2 width="98%" align=center></div><div id=divRplyFwdMsg><p class=MsoNormal><b><span style='color:black'>From:</span></b><span style='color:black'> Brad Hards <<a href="mailto:bradh@frogmouth.net">bradh@frogmouth.net</a>><br><b>Sent:</b> Saturday, October 12, 2019 1:51 AM<br><b>To:</b> Edson, Adam Robert <<a href="mailto:are131@psu.edu">are131@psu.edu</a>>; <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a> <<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>><br><b>Subject:</b> RE: [gdal-dev] python GDAL issue</span> <o:p></o:p></p><div><p class=MsoNormal> <o:p></o:p></p></div></div><div><div><p class=xmsonormal>GDAL’s NITF encoding doesn’t appear to have BANDSB yet: <a href="https://github.com/OSGeo/gdal/blob/master/gdal/data/nitf_spec.xml">https://github.com/OSGeo/gdal/blob/master/gdal/data/nitf_spec.xml</a><o:p></o:p></p><p class=xmsonormal> <o:p></o:p></p><p class=xmsonormal>It would definitely help to see how that file encodes it. Can you open the NITF file, find the part that starts with BANDSB0nnnn (where 0nnnn is some length value), and copy out the following 0nnnn characters?<o:p></o:p></p><p class=xmsonormal> <o:p></o:p></p><p class=xmsonormal>Brad<o:p></o:p></p><div><div><div><p class=xxmsonormal> <o:p></o:p></p></div></div></div></div></div></div></body></html>