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

Home » Public Forums » archive » Lonlat2reg.pro vs. Grid program
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Lonlat2reg.pro vs. Grid program [message #56421] Sat, 20 October 2007 02:25
Nick[1] is currently offline  Nick[1]
Messages: 10
Registered: May 2007
Junior Member
Hello, thankful users.

As you know, lonlat2reg.pro is a very useful grid program.
Yesterday I compared the result from lonlat2reg with code which I
made.
I anticipated that these results would be the same, but weren't.

Why are they different? Could you please let me know?

My code is like this..

;=====lonlat2reg
result = lonlat2reg(value,lon,lat, lon0=-180.,lat0=90.,dlon=1.,
dlat=-1., nlon=360., nlat=180.)
Average_value1 = result.avg(*,*)

;=====My code
glon = findgen(360) - 179.5
glat = -findgen(180) + 89.5
for k=0, 179 do begin
for j=0, 359 do begin
idx = where(lon lt glon(j)+0.5 and lon ge glon(j)-0.5 and lat le
glat(k)+0.5 and lat gt glat(k)-0.5, nn)
if nn ge 1 then begin
S_value(j,k) = S_value(j,k) + total(value(idx),/nan)
N_value(j,k) = N_value(j,k) + nn
endif
endfor ;j
endfor ;k
Average_value2 = S_value / N_value

My code is really slow, but I think it is easier understandable than
lonlat2reg.pro
So I was supposed to use lonlat2reg.pro if Average_value1 and
Average_value2 would be the same.

Thank you for your attention, Nick
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Allocating memory in LINKIMAGE program
Next Topic: How to subset images by irregualar roi with IDL+ENVI?

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

Current Time: Wed Oct 08 15:47:29 PDT 2025

Total time taken to generate the page: 0.00575 seconds