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

Home » Public Forums » archive » Easy question on for loops and if statements
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Easy question on for loops and if statements [message #91451] Thu, 16 July 2015 10:15 Go to previous message
larosaant94 is currently offline  larosaant94
Messages: 3
Registered: July 2015
Junior Member
I am plotting the magnetic field longitude and using the ATAN function to do so. Though the ATAN function gives a result between the range of -180 to +180. I wish to use a range of
0 to 360.

A look at the code:

Bx = data(10,*)
By = data(11,*)

longitude = 180/!Pi* atan(By, Bx)

FOR j=0,N_Elements(longitude)-1 DO BEGIN
IF longitude[j] lt 0 THEN BEGIN
longitude = 360 + longitude
ELSE
longitude = longitude
ENDFOR

;Does the actual plotting-----------

plot, time, longitude, yrange=[0, 360], yticks=4, yminor=6, $
ytitle='Lambda', position=[0.1, 0.24, 0.95, 0.31], xtickname=blnklb
plots, [min(time), max(time)], 180.0*[1,1], linestyle=2



I want any number less than 0 to get 360 added to it and then once this is completed plot all the data points including the ones above 0!

Thanks!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Distance calculation for lots of stars
Next Topic: Separating land and ocean data in IDL

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

Current Time: Wed Oct 08 11:32:41 PDT 2025

Total time taken to generate the page: 0.00442 seconds