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

Home » Public Forums » archive » bug in var_to_dt
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
bug in var_to_dt [message #13165] Thu, 15 October 1998 00:00
Vap User is currently offline  Vap User
Messages: 31
Registered: April 1998
Member
A 'noyance in var_to_dt

Try this:

IDL> print,var_to_dt(1998)
{ 1998 1 1 0 0 0.00000 2450814.5 0}

Works fine, but...


IDL> print,var_to_dt([1998])
% Conflicting data structures: YYYY,IDLDT.
% Execution halted at: VAR_TO_DT 95 /disk3/rsi/idl/lib/var_to_dt.pro
% $MAIN$
IDL>


The reason is ....

< begin code fro RSI's routine>

if nElements eq 0 then begin

retVal = !dt_base
endif else if nElements eq 1 then begin
^^^^^^^^^^^^^^ -- a confusion here with ill effect below

retVal = {IDLDT}
; Defaults
if n_elements( mm ) eq 0 then mm = 1B
if n_elements( dd ) eq 0 then dd = 1B
if n_elements( hh ) eq 0 then hh = 0B
if n_elements( min ) eq 0 then min = 0B
if n_elements( ss ) eq 0 then ss = 0.

; |||| || || || |||
retVal = {IDLDT, yyyy, mm<12>1, dd<31>1, hh<23>0, min<59>0, $
ss<60>0, 0.d, 0b}
; ^^

; And secondarily... || || |||| || |||
retVal.Julian = julday( mm<12>1, dd<31>1, yyyy, hh<23>0, min<59>0, $
ss<60>0 )
; ^^


; These last two lines assume 1 element = scalar! Not so!
; At least as far as this type of structure assignment is concerned.


endif else begin

<end code>

Should read something like ...

retVal = {IDLDT, yyyy[0], mm[0]<12>1, dd[0]<31>1, hh[0]<23>0, min[0]<59>0, $
ss[0]<60>0, 0.d, 0b}
retVal.Julian = julday( mm[0]<12>1, dd[0]<31>1, yyyy[0], hh[0]<23>0, $

WHD



--
I don't speak for JPL, it doesn't speak for me.
Well, not all the time, at least.
William Daffer <vapuser@haifung.jpl.nasa.gov>
[Message index]
 
Read Message
Previous Topic: SFIT: Surface fitting
Next Topic: Categories

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

Current Time: Fri Oct 10 09:43:42 PDT 2025

Total time taken to generate the page: 0.63820 seconds