<div dir="ltr"><p dir="ltr">I completely agree with keeping the discussion on list--I was in a rush this morning and forgot to hit reply all. My out-of-context replies are below, followed by the discussion that occurred off-list.<br>
</p>
<p dir="ltr">Using an 'r' before a string in python just denotes that it is a raw string, so special characters such as backslashes will be ignored. This is just a habit because until recently I had to use Windows at work.</p>
<p dir="ltr"></p><p dir="ltr">I followed your other posting about your NITF woes..that sounds rough. I'm happy my data came as geotiffs!  </p><p dir="ltr">My reasoning behind making it more generic is so that it could eventually become a WV2 variant of the i.landsat.toar/i.aster.toar modules. Once the generic tool is done it could still be scripted to process a large number of individual scenes.</p>
<p dir="ltr">Could you send me a copy of your metadata file? It looks like our imagery differs in the amount of processing applied, but I haven't been able to find any references for the WV-2 processing levels so far. It's definitely more difficult to find the necessary information for privately operated satellites. It would be great to see the other potential metadata forms for the generic toar tool.</p>
<p dir="ltr"><br></p><p dir="ltr">Thanks again,</p><p dir="ltr">Eric<br></p><p dir="ltr"><br></p><p dir="ltr"><br>On Thu, Jul 18, 2013 at 6:56 AM, Nikos Alexandris <<a href="mailto:nik@nikosalexandris.net">nik@nikosalexandris.net</a>> wrote:<br>
> It seems it's complicated. In the XML file for the image I am working with,<br>><br>>  <br>><br>> 13APR10075059-M1BS-500060446050_05_P003.XML<br>><br>>  <br>><br>> there is no "EARLIESTACQTIME" string (referring to line 119 in your script).<br>
><br>>  <br>><br>> I will have to postpone it a bit with testing. It's a common secret all<br>> these constanctly changing metadata strings... A bit frustrating some times.<br>><br>>  <br>><br>
> Best, Nikos<br></p><div style="font-family:'Droid Sans Mono';font-size:9pt;font-weight:400;font-style:normal">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Hi!</p><div class="im">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">On Thursday 18 of July 2013 06:04:40 Eric Goddard wrote:</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> On line 211 in the main() function you have to specify the path to the</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> WorldView-2 source directory that contains all of the imagery, IMD</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> files, XML files, etc.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
</div><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">In the "version" I downloaded from gist, there is probably a typo/leftover:</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">imageryPath = r"/path/to/imagery/folder"</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">If I am wrnog, I can't see how "r" could be useful now -- I am just about to try.</p><div class="im">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> In my GRASS setup I used r.external to link all</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> of the files in that path. If the original TIF file in the imagery</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> path was 12OCT19171330-M3DS_R1C1-052823926030_01_P001.TIF, for</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> example, the raster name in grass would be</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> x2OCT19171330-M3DS_R1C1-052823926030_01_P001.<band number>; the</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> metadata file that is associated with that tif is</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> 12OCT19171330-M3DS-052823926030_01_P001.XML.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
</div><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">I
 guess I will need to adjust various stuff.  I have only .ntf files.  Of
 course, I converted 'em in GeoTiffs but I'd like to see how it plays 
with NITF containers and SUBDATASETs.</p><div class="im">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> The AssociateMetaDataWithRaster() function takes the list of grass</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> rasters (acquired in line 213), and creates a dictionary that has the</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> grass raster name as the key and the XML file as the value.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
</div><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Ok.</p><div class="im">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> The loop starting at line 219 goes over each raster, calls the</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> ExtractVariablesFromMetadata() function (in which the first argument</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> is the path to the xml file for the raster, and the second is the band</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> number) and uses the lxml library to search for and extract the</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> variables from the XML metadata document.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
</div><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Sound nice.</p><div class="im">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> Thanks for going over it, Nikos. A coworker and I spent hours combing</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> through it and we couldn't find any mistakes in the math (not to say</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> there aren't any of course!); I'm all out of ideas for what could be</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> going wrong.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
</div><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Myself, I am just a DIY scripter.  If I bomb into anything obvious, of course I'll point it out.</p><div class="im">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> I'm currently working on a more generic version in which</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> you specify the image and the path to the xml file to make it easier</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> to test.</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
</div><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Yes,
 it'll be much better.  I too have a lot of hardcoded stuff in my 
scripts.  But, it doens't make too much sense in the end/long run.</p><div class="im">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> Sorry for the strange python spacing too...Vim configuration</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">> gone wrong :).</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
</div><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">:D</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Hey, thanks a lot.</p><span class="HOEnZb"><font color="#888888">
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">N</p>
</font></span><p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"> </p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">ps-  just my humble opinion, better to keep discussion on-list.</p></div>
</div>