[Kst] Reading formatted dates and mixing with ctimes

Nicolas Brisset nicolas.brisset at free.fr
Thu Jul 4 20:07:32 UTC 2013


David,

Thanks for providing the test file, it allowed me to find the issue. It's a really stupid one: a typo in the help text!

If you load the data with the following format string: dd/MM/yy-hh:mm:ss it works (lowercase y as per QDateTime documentation), whereas if you use dd/MM/YY-hh:mm:ss as you are led to think by the help text which associates a capital Y to year, you get nans indeed.

I'll fix it, and in the meantime you can just use a small y for the year spec, it will work. 
Note that this help text is just a summary of possible options, all that is indicated in the QDateTime doc should work.

Nicolas

----- Mail original -----
> De: "David McMinn" <david.mcminn at iwcdownhole.com>
> À: kst at kde.org
> Envoyé: Lundi 1 Juillet 2013 13:31:13
> Objet: Re: [Kst] Reading formatted dates and mixing with ctimes
> 
> Hi Nicolas,
> 
> I was using 2.0.7 beta 4 but I've just downloaded the 2.0.7 final
> release. With the final 2.0.7 all the dates that are read in using
> the formatted string end up being "nan"s after being read in. I
> guess the formatter does not like the string I have or I have used
> an invalid format specifier. I tried replacing the dashes with
> spaces but still had no success.
> 
> I have uploaded
> (https://www.dropbox.com/s/45futbmigci0n1z/formatted%20date%20times.zip)
> a section of the data for testing and the KST session file.
> Data1.csv has the time in seconds since the unix epoch. Data2.asc
> uses the formatted dates.
> 
> Regards,
> David
> 
> -----Original Message-----
> From: Nicolas Brisset [mailto:nicolas.brisset at free.fr]
> Sent: 27 June 2013 21:34
> To: kst at kde.org
> Cc: David McMinn
> Subject: Re: [Kst] Reading formatted dates and mixing with ctimes
> 
> 
> Hi David,
> 
> Your use case sounds like an interesting test for the support of
> string-formatted time in ASCII files. I guess you're using a recent
> 2.0.7 snapshot, right?
> It would be helpful if you could post some samples or screenshots. Is
> that possible?
> 
> Nicolas
> 
> ----- Mail original -----
> > De: "David McMinn" <david.mcminn at iwcdownhole.com>
> > À: "kst at kde.org" <kst at kde.org>
> > Envoyé: Jeudi 27 Juin 2013 16:27:18
> > Objet: [Kst] Reading formatted dates and mixing with ctimes
> > 
> > Hi,
> > 
> > I have two separate data files, both ASCII, both time/value. They
> > are
> > not sampled or aligned in the time axis. I'd like to be able to
> > plot
> > them in two separate plots but have their zoom tied so that I can
> > visually see the corresponding data.
> > 
> > The first data set has the time in seconds since the UNIX epoch, so
> > I'm reading that in interpreting the column as C Time. This is
> > fine.
> > 
> > The second data set has the time formatted as "dd/MM/yy-hh:mm:ss",
> > so
> > I read that in as a formatted time with the above format string.
> > That also seems to read in OK. The values I get are in the range
> > 178458000 + 6e4, corresponding to date/times in the range 13 June
> > 2013 23:00:00 to 15 June 2013 02:16:30. I don't know if that's
> > right
> > as I'm not sure what the QDateTime representation is.
> > 
> > Now the problems start. Whatever I set my X axis "interpret as"
> > setting to I cannot get the date/time for the second data file to
> > be
> > displayed as a date/time that is displayed "sensibly", such as
> > 13/06/2013 23:00 with the additional time in square brackets, as
> > KST
> > does for C Time. The closest I can get is interpreting it as a C
> > Time
> > and displaying with a custom format string of "dd/MM/yy hh:mm:ss"
> > otherwise it seems to have picked the date up as 1913, which I
> > guess
> > is because 1.78e9 loops round to 1913. This obviously stops the
> > tied
> > zoom from working.
> > 
> > Other interpretations end up with the above 1.78e9 numbers or
> > 12:00:00 with spans of hundreds or thousands of years.
> > 
> > What's the best way to read in a formatted time and have it
> > displayed
> > as a timestamp?
> > 
> > Is it possible to align two plots on date/time rather than the
> > numerical value of their timestamp?
> > 
> > Thanks.
> > 
> > 
> > _______________________________________________
> > Kst mailing list
> > Kst at kde.org
> > https://mail.kde.org/mailman/listinfo/kst
> > 
> 
> 
> 
> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst
>


More information about the Kst mailing list