Why not tell him to write out all the data in a .sav file, and read it  
in using PDL::IO::IDL?

On Aug 26, 2010, at 11:41 PM, P Kishor wrote:

> I am running into a strange problem converting from data coming from
> IDL. A colleague is generating the IDL output as 100 values each for
> 271117 cells. This is what I would think of as a 271117 x 100 array of
> arrays. That is, an array with 271K elements, each element being a 100
> element array.
>
> Except, when I read into PDL via FlexRaw, using a header of "Float
> 271117 100", I get the error "PDL: Couldn't read enough data from
> <file name>..." Strangely, when I change the header to 271116, 99, it
> works, but the output is all wrong... lots of gaps. I can't figure out
> why.
>
> Ok. To get to the bottom of this mystery, I asked him to write out all
> the values as a text file so I could see the darned data. Well, he
> didn't know how to format text output from IDL so he wrote out one
> value per line and gave me a text file with 27111700 (27 million
> lines... please control your snickering and laughter).
>
> I coaxed that file into a PDL which looks like so
>
>    PDL: Double D [100,271117]
>
> The header generated by FlexRaw looks like so
>
>    Double
>    2
>    100
>    271117
>
> So, I read this piddle back into PDL. This is what it looks like
>
>    print $pdl->info . "\n";
>> PDL: Float D [100,271117]
>
> Now I want to average the numbers along the 0th dimension (those are
> 100 years), that is, I want yearly averages for all the cells. So I do
> the following
>
>    my $xpdl = $pdl->xchg(0, 1);
>    my $yavgs = $xpdl->average;
>    print $yavgs->info . "\n";
>> PDL: Float D [100]
>
> Now I print the entire avg piddle, and I get garbage.
>
> [nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan
> nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan
> nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan
> nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan
> nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan
> nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan]
>
> Any idea what I could be doing wrong?
>
> -- 
> 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
>


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

Reply via email to