On Mon, Aug 30, 2010 at 8:03 PM, Chris Marshall <[email protected]> wrote:
> On 8/30/2010 8:49 PM, P Kishor wrote:
>>
>> On Mon, Aug 30, 2010 at 7:02 PM, Chris Marshall<[email protected]>  wrote:
>>>
>>> On 8/30/2010 7:00 PM, P Kishor wrote:
>>>>
>>>> On Mon, Aug 30, 2010 at 2:39 PM, P Kishor<[email protected]>    wrote:
>>>>>
>>>>> This is driving me nuts...
>>>>>
>>>>> print "Info for lut : " . $lu->info . "\n";
>>>>> print "Info for year: " . $yr->info . "\n";
>>>>> $ypdl->wpic("model_output/$file", {LUT =>    $lut});
>>>>>
>>>>> prints...
>>>>>
>>>>>
>>>>> Info for lut : PDL: Byte D [3,256]
>>>>> Info for year: PDL: Byte D [252,189]
>>>>> PDL::index: invalid index -2147483648 (valid range 0..255) at
>>>>> /usr/local/lib/perl5/site_perl/5.12.1/darwin-2level/PDL/ImageRGB.pm
>>>>> line 147.
>>>
>>> First, the piddle you are writing as an image is
>>> not the piddle you are listing information about.
>>> It is not possible for a byte value to be -2147483648.
>>> I suggest writing a small test script and trace it
>>> under the debugger to see what is going on.  Maybe
>>> something is not what you think it is.
>>>
>>
>>
>> Unfortunately, I don't know how to use the debugger, but I did write a
>> test script. With the help of Craig's bigstring() sub, I get the
>> following --
>
>  perldoc perldebug
>
> Basically you start the program:
>
>  perl -d myproblem.pl
>
..


I tried the debugger, and after running it several times, it is
apparent to me that it is $res below that is causing the problem. More
below --


>
>> ------------
>> print "In my program\n" . "=" x 50 . "\n";
>> print "Info for piddle pdl: " . $pdl->info . "\n";
>> print bigstring($pdl,"%3g") . "\n";
>>
>>
>>
>> my $foo = $lut->xchg(0,1);
>>
>> print "Info for piddle foo: " . $foo->info . "\n";
>> print $foo . "\n";
>>
>>
>>
>> my $bar = $pdl->dummy(0);
>>
>> print "Info for piddle bar: " . $bar->info . "\n";
>> print bigstring($bar,"%3g") . "\n";
>>
>>
>>
>> my $res = index($foo, $bar);
>>
>> print "Info for piddle res0: " . $res->info . "\n";
>> print bigstring($res,"%3g") . "\n";
>> ------------
>>


So, as soon as bigstring tries to unravel $res, the bad index error
pops up. I even poked into Core.pm trying to see if I could make the
program write more error messages... tried $res->at()... soon as
anything "peeks" inside $res, it dies.

I have written a smallest possible test script, created the data set
that is causing this issue, in combo with my steps, tar gzipped the
entire thing and put it on my Dropbox. The link is below. The whole
tgz is only ~300 KB, but unpacks into about ~20 MB.

http://dl.dropbox.com/u/3526821/testindex.tgz


There is definitely something strange going on with $res, a result of
the index command.

I do hope someone else can look at it with fresh eyes and give more
guidance. After a few days of great momentum, this has been an
absolute waste of a day.

Many thanks,



>>
>> In my program
>> ==================================================
>> Info for piddle pdl: PDL: Byte D [252,189]
>> [
>>  [   0   0   0   ..   0 ]
>>  [   0   0   0   ..   0 ]
>>  [   0   0   0   ..   0 ]
>>   ..
>> ]
>> Info for piddle foo: PDL: Byte D [256,3]
>>
>> [
>>  [  0   1   2   3 .. 255]
>>  [255 255 255 255 .. 255]
>>  [  0   0   0   0 ..   0]
>> ]
>>
>> Info for piddle bar: PDL: Byte D [1,252,189]
>> [
>>  [
>>   [   0 ]
>>  ..
>>  ]
>> ]
>> Info for piddle res: PDL: Byte D [3,252,189]
>> PDL::index: invalid index -2147483648 (valid range 0..255) at
>> /usr/local/lib/perl5/site_perl/5.12.1/darwin-2level/PDL/Core.pm line
>> 2408.
>>
>>
>>
>> There is something wrong with $res created with index($lut, $bar), and
>> I don't quite know what to do. This has become a show-stopper for me
>> as I have to use lookup tables to create color images. The program
>> works just fine, and images are created just fine if I don't use a
>> LUT. Is there something wrong with my LUT? After a day of struggling
>> with this, I am at a loss.
>>
>>
>>> --Chris
>>>
>>>>> As far as I can see, $yr has nothing funky in it. I used Craig's
>>>>> bigstring method to print out the bighonkingpdl, and it is mostly a
>>>>> bunch of zeroes.
>>>
>>
>>
>>
>>
>>
>>
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com
>> Version: 9.0.851 / Virus Database: 271.1.1/3102 - Release Date: 08/30/10
>> 02:35:00
>>
>
>



-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to