comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Having trouble with code for data to image.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Having trouble with code for data to image. [message #63978 is a reply to message #63977] Wed, 26 November 2008 04:37 Go to previous messageGo to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
mbweller@gmail.com wrote:
> Hello,
>
> I am running the code:
>
> image = fltarr(nx,ny)
> deltax = (xrange[1]-xrange[0])/float(nx)
> deltay = (yrange[1]-yrange[0])/float(ny)
> for i=0l,ndata-1 do $
> image[(left[i]-xrange[0])/deltax:(right[i]-xrange[0])/deltax , $
> (bottom[i]-yrange[0])/deltay:(top[i]-yrange[0])/deltay] =
> magnitude
> [i]
>
> where: nx=ny=180
> xrange= [-180,0]
> yrange = [-90,90]
> ndata = 32400 ( or180^2 or nx*ny)
> eg left -180
> right -179
> top 90
> bottom 89
> magnitude 0.1648
>
> and i get the error when I run the code:
>
> % Subscript range values of the form low:high must be >= 0, < size,
> with low <= high: IMAGE
>
> I assume the problem is in the way that my data is ordered, and I have
> tried switching lows and highs around, but to no avail. I would
> imagine this is pretty simple to solve, but it is not clear to me
> right now.
>
> Any insight?
>
> Thanks,
>
> ~Matt

Hi,
with the data you provide, you are out of bounds...
(bottom[i]-yrange[0])/deltay:(top[i]-yrange[0])/deltay] ==> 179:180
... 180 is out of bound. Remember that indexing is from 0 to n-1. You
might want to throw a -1 in your indexes...
As Chris has suggested it, print your indexes and be sure they are correct!

Jean
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Filled contours + labels of different color
Next Topic: Memory allocation problem

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 00:11:21 PDT 2025

Total time taken to generate the page: 0.56326 seconds