Le vendredi 29 novembre 2013 17:43:21 UTC+1, David Fanning a écrit :
> Robert Seigel writes:
>
>
>
>> Thank you for the replies.
>
>>
>
>> Alx,
>
>>
>
>> As I have tried in the past, I am unable to use two-dimensional arrays for X and Y in the IMAGE function. Using your [Alex] example:
>
>>
>
>> IDL> p = image(rgbData,rebin(xaxis,xcount,zcount),rebin(reform(yaxis, 1,zcount),xcount,zcount),/buffer, $
>
>> IDL> axis_style=2)
>
>> % IMAGE: X must be a vector.
>
>>
>
>> I am not sure why IMAGE does not accept X and Y as 2d arrays. However, your second suggestion worked well with one slight modification to the interpolate call [indgen(xcount) rather than xaxis]:
>
>>
>
>> regYaxis = (zcoords[-1] - zcoords[0])*findgen(zcount)/(zcount -1)
>
>> data = interpolate(data, indgen(xcount), interpol(findgen(zcount), zcoords, regYaxis), /GRID)
>
>>
>
>> But, I cannot interpolate these data because they are flags and interpolation between them results in incorrect classification at many locations. The values in the array are one of [-4,-3,-2,-1,0,1,2,3,4], so e.g. when a 4 is next to a 0 the interpolation often creates a false classification.
>
>>
>
>> David,
>
>>
>
>> This routine is exactly what I was looking for!
>
>
>
> Oh, damn! Another blow struck for direct graphics. We may never be able
>
> to get rid of these things. ;-)
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
The IMAGE function does work with X and Y as 2D arrays. Try:
im = image(dist(200,100), rebin(findgen(200),200,100), rebin((findgen(1,100)),200,100), AXIS_STYLE=2)
It works in this case, because re-gridding is not needed and then not used.
But the automatic re-gridding is far from optimal (due to present limitations in IDL's internal gridding software). It is usually very slow and can even crash your IDL session.
Hope that this will be fixed in IDL 8.3 !
alx.
|