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

Home » Public Forums » archive » Optimizing loops
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Optimizing loops [message #92368] Wed, 02 December 2015 11:04 Go to previous message
sam.tushaus is currently offline  sam.tushaus
Messages: 14
Registered: February 2015
Junior Member
Hello all! I am working with a large number of satellite data files. The files are quite big, but I've never had this much trouble working with them before, even while doing similar processing.

The basic program structure that's the slowest is below; it also just dominates the processing power as it enters this loop. I need to do this for each file I process.

; we want to calculate the percent of each satellite pixel
; covered by land
land_perc = FLTARR(N_ELEMENTS(field1))
FOR j = 0, N_ELEMENTS(field1)-1 DO BEGIN
dist = (((land_lon - sat_lon[j])*COSD(land_lat))^2. $
+ (land_lat - sat_lat[j])^2.)^0.5*111.12

ind14 = WHERE(dist LE 14.)
land14 = land_mask(ind14)
landy = WHERE(land14 EQ 0, landy_cnt)
land_perc[j] = FLOAT(landy_cnt)/FLOAT(N_ELEMENTS(land14))*100
ENDFOR

If anyone has optimization suggestions, please let me know! Thanks :)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Text print in figure with format
Next Topic: Using IDLgrShaderBytscl on Windows to display floating-point image data quickly.

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

Current Time: Wed Oct 08 13:58:42 PDT 2025

Total time taken to generate the page: 0.00449 seconds