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

Home » Public Forums » archive » Re: two issues with julian dates
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: two issues with julian dates [message #54804] Thu, 12 July 2007 13:25 Go to next message
Josh is currently offline  Josh
Messages: 21
Registered: June 2007
Junior Member
On Jul 12, 1:51 pm, David Fanning <n...@dfanning.com> wrote:
> Josh writes:
>> First of all, thank you educating me about this. I read a number of
>> your articles on the precision of numbers, and I've finally got the
>> double precision values I was seeking. However, when I try to put
>> them on an x-axis, they appear to revert back to single precision
>> values. The array of values are definitely double precision, and I
>> set xtickformat='(F20.5)', but sadly the labels appear to be (single)
>> floats disguised in the F20.5 format, and the data being plotted is
>> clumped into groups instead of nice and continuous (perhaps because it
>> sees big gaps in the x values due to their single precision?). I am
>> hoping this is a minor step I've missed in the keywords to PLOT.
>
> The more I think about this, the more likely it seems to me
> that the problem comes from converting doubles to strings.
> Have you read this article?
>
> http://www.dfanning.com/misc_tips/dbl_to_str.html
>
> You might well have to write your own tick formatting function
> to make this work the way you want it to work. It's just hard
> to tell without seeing what you are doing.
>
> 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.")


As far as I know, the only conversion I've done is actually to convert
strings to doubles. The input file is read as a big long string, then
the pieces are broken out and some (these) are converted to doubles.
I've sent you an email with some of my code. Perhaps it will help.
Re: two issues with julian dates [message #54806 is a reply to message #54804] Thu, 12 July 2007 12:51 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Josh writes:

> First of all, thank you educating me about this. I read a number of
> your articles on the precision of numbers, and I've finally got the
> double precision values I was seeking. However, when I try to put
> them on an x-axis, they appear to revert back to single precision
> values. The array of values are definitely double precision, and I
> set xtickformat='(F20.5)', but sadly the labels appear to be (single)
> floats disguised in the F20.5 format, and the data being plotted is
> clumped into groups instead of nice and continuous (perhaps because it
> sees big gaps in the x values due to their single precision?). I am
> hoping this is a minor step I've missed in the keywords to PLOT.

The more I think about this, the more likely it seems to me
that the problem comes from converting doubles to strings.
Have you read this article?

http://www.dfanning.com/misc_tips/dbl_to_str.html

You might well have to write your own tick formatting function
to make this work the way you want it to work. It's just hard
to tell without seeing what you are doing.

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.")
Re: two issues with julian dates [message #54807 is a reply to message #54806] Thu, 12 July 2007 12:32 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Josh writes:

> First of all, thank you educating me about this. I read a number of
> your articles on the precision of numbers, and I've finally got the
> double precision values I was seeking. However, when I try to put
> them on an x-axis, they appear to revert back to single precision
> values. The array of values are definitely double precision, and I
> set xtickformat='(F20.5)', but sadly the labels appear to be (single)
> floats disguised in the F20.5 format, and the data being plotted is
> clumped into groups instead of nice and continuous (perhaps because it
> sees big gaps in the x values due to their single precision?). I am
> hoping this is a minor step I've missed in the keywords to PLOT.

Are your sure your X values are double precision? (And not
double precision, which were converted from floats, as the
article you read warned you about.)

Can I see how you create these values?

As far as I know, IDL stores axes values in double precision
always since about IDL 5.4.

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.")
Re: two issues with julian dates [message #54809 is a reply to message #54807] Thu, 12 July 2007 11:02 Go to previous messageGo to next message
Josh is currently offline  Josh
Messages: 21
Registered: June 2007
Junior Member
On Jul 11, 4:37 pm, David Fanning <n...@dfanning.com> wrote:
> This article will be of value to you:
>
> http://www.dfanning.com/math_tips/sky_is_falling.html
>

First of all, thank you educating me about this. I read a number of
your articles on the precision of numbers, and I've finally got the
double precision values I was seeking. However, when I try to put
them on an x-axis, they appear to revert back to single precision
values. The array of values are definitely double precision, and I
set xtickformat='(F20.5)', but sadly the labels appear to be (single)
floats disguised in the F20.5 format, and the data being plotted is
clumped into groups instead of nice and continuous (perhaps because it
sees big gaps in the x values due to their single precision?). I am
hoping this is a minor step I've missed in the keywords to PLOT.
Re: two issues with julian dates [message #54811 is a reply to message #54809] Wed, 11 July 2007 15:43 Go to previous messageGo to next message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Josh wrote:
> On Jul 11, 3:58 pm, David Fanning <n...@dfanning.com> wrote:
>> Josh writes:
>>> I've got date and time strings that I've parsed into their respective
>>> hour/minute/etc and month/day/etc form and I'm using the julday()
>>> function to turn them into julian dates. I've come across two
>>> problems that hopefully somebody can help me with.
>>> First off, according to NASA (http://ssd.jpl.nasa.gov/tc.cgi#top), the
>>> returned value of julday() is incorrect. When I use 11/18/2003 at
>>> 16:14:43, I get 2452955.2 from IDL and 2452962.1768866 from NASA.
>>> Thoughts?
>>> Second, the fact that julday() only returns a value with ONE digit
>>> after the decimal is not cool. If it returns a double floating point
>>> value, shouldn't I be able to get 14 sig figs? The time scales in my
>>> data set are such that I need that resolution. Thoughts?
>> Humm. Are you using *this* IDL!
>>
>> IDL> print, julday(11, 18, 2003, 16, 14, 43), format='(F 20.10)
>> 2452962.1768865748
>>
>> 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.")
>
>
> Perhaps it is because it is getting late into the afternoon, but I
> can't use that technique to stuff the new Julian date into a variable,
> correct? If I want to just save that beautifully long number in an
> array, how can I keep it formatted like that?
>

it is saved properly.... it is rounded when you display it only!
to convince yourself:
a = julday(11, 18, 2003, 16, 14, 43)
>> 2452962.1768865748
print, a - 2452962.0

Jean
Re: two issues with julian dates [message #54812 is a reply to message #54811] Wed, 11 July 2007 15:37 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Josh writes:

> Perhaps it is because it is getting late into the afternoon, but I
> can't use that technique to stuff the new Julian date into a variable,
> correct? If I want to just save that beautifully long number in an
> array, how can I keep it formatted like that?

Well, it *is* formatted like that, since it is a double precision
value. I think you are confusing the actual number to what
sometimes happens when you print a value. This article will
be of value to you:

http://www.dfanning.com/math_tips/sky_is_falling.html

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.")
Re: two issues with julian dates [message #54813 is a reply to message #54812] Wed, 11 July 2007 15:36 Go to previous messageGo to next message
news.qwest.net is currently offline  news.qwest.net
Messages: 137
Registered: September 2005
Senior Member
"Josh" <joshuamontague@gmail.com> wrote in message
news:1184192703.958890.225080@d30g2000prg.googlegroups.com.. .
> On Jul 11, 3:58 pm, David Fanning <n...@dfanning.com> wrote:
...
>> IDL> print, julday(11, 18, 2003, 16, 14, 43), format='(F 20.10)
>> 2452962.1768865748
...
> Perhaps it is because it is getting late into the afternoon, but I
> can't use that technique to stuff the new Julian date into a variable,
> correct? If I want to just save that beautifully long number in an
> array, how can I keep it formatted like that?


Yes you can put that into a (double) variable.
It is "formatted" like that. Do not confuse the format of the print
statement,
with the precision of a double variable.

Cheers,
bob
Re: two issues with julian dates [message #54814 is a reply to message #54813] Wed, 11 July 2007 15:25 Go to previous messageGo to next message
Josh is currently offline  Josh
Messages: 21
Registered: June 2007
Junior Member
On Jul 11, 3:58 pm, David Fanning <n...@dfanning.com> wrote:
> Josh writes:
>> I've got date and time strings that I've parsed into their respective
>> hour/minute/etc and month/day/etc form and I'm using the julday()
>> function to turn them into julian dates. I've come across two
>> problems that hopefully somebody can help me with.
>
>> First off, according to NASA (http://ssd.jpl.nasa.gov/tc.cgi#top), the
>> returned value of julday() is incorrect. When I use 11/18/2003 at
>> 16:14:43, I get 2452955.2 from IDL and 2452962.1768866 from NASA.
>> Thoughts?
>
>> Second, the fact that julday() only returns a value with ONE digit
>> after the decimal is not cool. If it returns a double floating point
>> value, shouldn't I be able to get 14 sig figs? The time scales in my
>> data set are such that I need that resolution. Thoughts?
>
> Humm. Are you using *this* IDL!
>
> IDL> print, julday(11, 18, 2003, 16, 14, 43), format='(F 20.10)
> 2452962.1768865748
>
> 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.")


Perhaps it is because it is getting late into the afternoon, but I
can't use that technique to stuff the new Julian date into a variable,
correct? If I want to just save that beautifully long number in an
array, how can I keep it formatted like that?
Re: two issues with julian dates [message #54815 is a reply to message #54814] Wed, 11 July 2007 14:58 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Josh writes:

> I've got date and time strings that I've parsed into their respective
> hour/minute/etc and month/day/etc form and I'm using the julday()
> function to turn them into julian dates. I've come across two
> problems that hopefully somebody can help me with.
>
> First off, according to NASA (http://ssd.jpl.nasa.gov/tc.cgi#top), the
> returned value of julday() is incorrect. When I use 11/18/2003 at
> 16:14:43, I get 2452955.2 from IDL and 2452962.1768866 from NASA.
> Thoughts?
>
> Second, the fact that julday() only returns a value with ONE digit
> after the decimal is not cool. If it returns a double floating point
> value, shouldn't I be able to get 14 sig figs? The time scales in my
> data set are such that I need that resolution. Thoughts?

Humm. Are you using *this* IDL!

IDL> print, julday(11, 18, 2003, 16, 14, 43), format='(F 20.10)
2452962.1768865748

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.")
Re: two issues with julian dates [message #54867 is a reply to message #54806] Mon, 16 July 2007 15:11 Go to previous message
Josh is currently offline  Josh
Messages: 21
Registered: June 2007
Junior Member
On Jul 12, 1:51 pm, David Fanning <n...@dfanning.com> wrote:
> Josh writes:
>> First of all, thank you educating me about this. I read a number of
>> your articles on the precision of numbers, and I've finally got the
>> double precision values I was seeking. However, when I try to put
>> them on an x-axis, they appear to revert back to single precision
>> values. The array of values are definitely double precision, and I
>> set xtickformat='(F20.5)', but sadly the labels appear to be (single)
>> floats disguised in the F20.5 format, and the data being plotted is
>> clumped into groups instead of nice and continuous (perhaps because it
>> sees big gaps in the x values due to their single precision?). I am
>> hoping this is a minor step I've missed in the keywords to PLOT.
>
> The more I think about this, the more likely it seems to me
> that the problem comes from converting doubles to strings.
> Have you read this article?
>
> http://www.dfanning.com/misc_tips/dbl_to_str.html
>
> You might well have to write your own tick formatting function
> to make this work the way you want it to work. It's just hard
> to tell without seeing what you are doing.
>
> 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.")


Having given up Julian dates, in lieu of a simpler route, I am now
simply taking the date/time and storing it as a double with respect to
the year (e.g. 3/21/2004 @ 12:17:44.767 = 2004.2903452730). All the
variables used to create the value were born doubles, and stayed
doubles all along.

Alas, the same problem persists. I can see the following:
IDL> print, ROItimeArr[85], format='(F20.10)'
2004.2903452730

But on the plot, I get 2004.2903 which is the above, sans the 'format'
at the end. So, everything within +-0.0001 (which happens to be about
20% of the data set) gets put on that x value.

I also tried subtracting 2004 from all the data, thinking that might
help, but I simply get the same x values without the 2004 (e.g.
0.2903).

Just thought I'd post a minor update. If anyone else has ever had/
solved this problem, I'd appreciate any advice
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDLgrAxis determining character dimensions
Next Topic: Array concatenation

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

Current Time: Wed Oct 08 19:23:50 PDT 2025

Total time taken to generate the page: 0.00830 seconds