Day of Year... Too lazy for a two-line solution...

This is a discussion on Day of Year... Too lazy for a two-line solution... within the Idl-pvwave forums in Programming Languages category; Hi IDL Wizards, I handle all date manipulation in my routines using JULDAY(), CALDAT, and the C() format code. Going from Day-of-Year to Julian Date is easy: Julian_Date = JULDAY(1,Day_Of_Year,Year,0,0,0) Getting Day-of-Year back out requires this, *unless you can do better*: CALDAT,Julian_Date,Null,Null,Year Day_Of_Year = Julian_Date - JULDAY(12,31,Year-1,0,0,0) I would really like a one-line solution with no stray variables. Anyone have one? --Edward H....

Go Back   Application Development Forum > Programming Languages > Idl-pvwave

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-22-2008, 02:49 PM
Ed Hyer
Guest
 
Default Day of Year... Too lazy for a two-line solution...

Hi IDL Wizards,

I handle all date manipulation in my routines using JULDAY(), CALDAT,
and the C() format code. Going from Day-of-Year to Julian Date is
easy:

Julian_Date = JULDAY(1,Day_Of_Year,Year,0,0,0)

Getting Day-of-Year back out requires this, *unless you can do
better*:

CALDAT,Julian_Date,Null,Null,Year
Day_Of_Year = Julian_Date - JULDAY(12,31,Year-1,0,0,0)

I would really like a one-line solution with no stray variables.
Anyone have one?

--Edward H.
Reply With Quote
  #2  
Old 08-22-2008, 03:43 PM
David Fanning
Guest
 
Default Re: Day of Year... Too lazy for a two-line solution...

Ed Hyer writes:

> I handle all date manipulation in my routines using JULDAY(), CALDAT,
> and the C() format code. Going from Day-of-Year to Julian Date is
> easy:
>
> Julian_Date = JULDAY(1,Day_Of_Year,Year,0,0,0)
>
> Getting Day-of-Year back out requires this, *unless you can do
> better*:
>
> CALDAT,Julian_Date,Null,Null,Year
> Day_Of_Year = Julian_Date - JULDAY(12,31,Year-1,0,0,0)
>
> I would really like a one-line solution with no stray variables.
> Anyone have one?


Would a call to a three-line function qualify as an answer?

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 11:45 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.