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

Home » Public Forums » archive » Faster way to "shift" array?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Faster way to "shift" array? [message #84785] Tue, 11 June 2013 05:50 Go to previous message
rjp23 is currently offline  rjp23
Messages: 97
Registered: June 2010
Member
I have a longitude array which ranges from 0 to 360 but I want it to range from -180 to 180.

Currently I'm doing this:
lon=shift(lon, n_elements(lon)/2.)
lon[where(lon GT 180)]=lon[where(lon GT 180)]-360.

The lon array is 3600 elements and the shift command is taking around 1 second. When multiplied by the thousands of files I need to handle this becomes quite a considerable time component.

Is there a faster way to do this?

Cheers

Rob
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL Array Question
Next Topic: logarithmic Y axis in cgContour

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

Current Time: Wed Oct 08 18:56:36 PDT 2025

Total time taken to generate the page: 0.00451 seconds