Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #2433 > unrolled thread
| Started by | Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> |
|---|---|
| First post | 2014-05-02 15:10 +0200 |
| Last post | 2014-05-02 18:22 +0200 |
| Articles | 12 — 4 participants |
Back to article view | Back to comp.graphics.apps.gnuplot
timefmt, changing the day of the week Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> - 2014-05-02 15:10 +0200
Re: timefmt, changing the day of the week Ethan A Merritt <EAMerritt@gmail.com> - 2014-05-02 09:15 -0700
Re: timefmt, changing the day of the week Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> - 2014-05-02 19:34 +0200
Re: timefmt, changing the day of the week Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2014-05-02 22:16 +0200
Re: timefmt, changing the day of the week Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> - 2014-05-03 08:16 +0200
Re: timefmt, changing the day of the week Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2014-05-03 14:48 +0200
Re: timefmt, changing the day of the week Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> - 2014-05-05 08:37 +0200
Re: timefmt, changing the day of the week Karl <mail.kfr@gmx.net> - 2014-05-05 13:16 +0200
Re: timefmt, changing the day of the week Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> - 2014-05-05 14:09 +0200
Re: timefmt, changing the day of the week Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2014-05-05 18:49 +0200
Re: timefmt, changing the day of the week Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> - 2014-05-06 07:39 +0200
Re: timefmt, changing the day of the week Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2014-05-02 18:22 +0200
| From | Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> |
|---|---|
| Date | 2014-05-02 15:10 +0200 |
| Subject | timefmt, changing the day of the week |
| Message-ID | <alpine.WNT.2.10.1405021459010.828@BecaneCoulon> |
I am plotting an array with x in universal time. I know that 1-Jan-2004 was TU=1072569615. and I am plotting using ($1-1072569615.) I said: set format x "%a-%d-%b\n%H:%M:%Y". I obtain the right month and day-of-the month on the X axis scale, but day-of-the-week is false . I guess Gnuplot guesses that 1-Jan-2004 was a Monday or a Sunday. How can I force day-of-the-week to start on the right day? Jean-Pierre Coulon
[toc] | [next] | [standalone]
| From | Ethan A Merritt <EAMerritt@gmail.com> |
|---|---|
| Date | 2014-05-02 09:15 -0700 |
| Message-ID | <lk0g67$29u$1@dont-email.me> |
| In reply to | #2433 |
Jean-Pierre Coulon wrote:
> I am plotting an array with x in universal time. I know that
> 1-Jan-2004 was TU=1072569615. and I am plotting using ($1-1072569615.)
> I said: set format x "%a-%d-%b\n%H:%M:%Y". I obtain the right month
> and day-of-the month on the X axis scale, but day-of-the-week is false
> . I guess Gnuplot guesses that 1-Jan-2004 was a Monday or a Sunday.
> How can I force day-of-the-week to start on the right day?
>
> Jean-Pierre Coulon
Your time offset from the epoch in seconds is not correct.
bash-4.2$ TZ=UT date --date='@1072569615'
Sun Dec 28 00:00:15 2003
bash-4.2$ TZ=UT date --date='@1072915201'
Thu Jan 1 00:00:01 2004
Gnuplot agrees:
gnuplot> print strftime("%a %d-%b-%Y", 1072915201.)
Thu 01-Jan-2004
Note: This is shown for the development version of gnuplot, in which
the standard epoch 1-Jan-1970 is used. Earlier gnuplot versions used
an idiomatic epoch 1-Jan-2000 for which the offset is 946684800.
So for gnuplot_4.6:
gnuplot> EPOCH = 946684800.0
gnuplot> print strftime("%a %d-%B-%Y", 1072915201. - EPOCH )
Thu 01-January-2004
So far as I know, gnuplot does correctly assign days of the week.
[toc] | [prev] | [next] | [standalone]
| From | Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> |
|---|---|
| Date | 2014-05-02 19:34 +0200 |
| Message-ID | <alpine.WNT.2.10.1405021844190.800@BecaneCoulon> |
| In reply to | #2434 |
On Fri, 2 May 2014, Ethan A Merritt wrote: > Your time offset from the epoch in seconds is not correct. > > bash-4.2$ TZ=UT date --date='@1072569615' > Sun Dec 28 00:00:15 2003 Then this is what I had feared: Gnuplot and the application that wrote my input file do not adhere to the same UT school! If I simply say plot <file> using ($1):2 I am brought on Tue-25-April 2034! I'm sure my experiment took place Wed-30-April 2014. So at least counting from 2004-01-01 gives the correct day-of-the month and month. But showing the right day-of-the-week would be a plus! So there are 2 possiblilties: 1: I cause Gnuplot to adhere to the same UT school as may application. If there are many schools I hope I'll find the right one by trial an error! 2: I "cheat" by "forcing" the 1rst day-of-the week. Jean-Pierre Coulon
[toc] | [prev] | [next] | [standalone]
| From | Hans-Bernhard Bröker <HBBroeker@t-online.de> |
|---|---|
| Date | 2014-05-02 22:16 +0200 |
| Message-ID | <bsicoiFqm2pU1@mid.dfncis.de> |
| In reply to | #2436 |
On 02.05.2014 19:34, Jean-Pierre Coulon wrote: > If I simply say plot > <file> using ($1):2 I am brought on Tue-25-April 2034! > I'm sure my > experiment took place Wed-30-April 2014. I'm pretty sure one of those statements is off by a decade. > So at least counting from > 2004-01-01 gives the correct day-of-the month and month. But showing the > right day-of-the-week would be a plus! Well, of course it does! You've beamed your data into entirely the wrong year, Sherlock! > 1: I cause Gnuplot to adhere to the same UT school as may application. No need to. All you have to do is to actually _tell_ it that your data is in Unix epoch time. Instead you're throwing random offsets into the mix and expecting miracles.
[toc] | [prev] | [next] | [standalone]
| From | Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> |
|---|---|
| Date | 2014-05-03 08:16 +0200 |
| Message-ID | <alpine.WNT.2.10.1405030750080.1924@BecaneCoulon> |
| In reply to | #2437 |
On Fri, 2 May 2014, Hans-Bernhard Bröker wrote: >> If I simply say plot >> <file> using ($1):2 I am brought on Tue-25-April 2034! > >> I'm sure my >> experiment took place Wed-30-April 2014. > > I'm pretty sure one of those statements is off by a decade. My data file goes from 1082875699.5 to 1082879698.5. Is there an "offical" UT site providing a [UT to "common language" date and time] conversion after you type a UT into a dialog box? Then I'll make a complaint to developers of the application that provided this data last week. Is set timefmt "%s" correct? And plot using (timecolumn(1)):2 brings me in 2004! Jean-Pierre Coulon
[toc] | [prev] | [next] | [standalone]
| From | Hans-Bernhard Bröker <HBBroeker@t-online.de> |
|---|---|
| Date | 2014-05-03 14:48 +0200 |
| Message-ID | <bsk6t4F7h7tU1@mid.dfncis.de> |
| In reply to | #2438 |
On 03.05.2014 08:16, Jean-Pierre Coulon wrote: > My data file goes from 1082875699.5 to 1082879698.5. Is there an > "offical" UT site providing a [UT to "common language" date and time] > conversion after you type a UT into a dialog box? There can't be, because is no such thing as an "official UT" like the data you have, in the first place. There's UTC, but it's not stated in seconds like you're looking at: it's given in date, hours, minutes and seconds. Then there's conventional Unix/POSIX timestamps, which are measured in seconds since 1970-01-01, but you're not using that either, which is why your use of gnuplot "%s" format threw you into the wrong decade. Your data actually appears to be in seconds since 1980-01-05, which almost certainly means those are GPS timestamps. Calling that "UT" without any further description is indeed a misrepresentation of facts.
[toc] | [prev] | [next] | [standalone]
| From | Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> |
|---|---|
| Date | 2014-05-05 08:37 +0200 |
| Message-ID | <alpine.WNT.2.11.1405050827590.536@dhpc3-6> |
| In reply to | #2439 |
On Sat, 3 May 2014, Hans-Bernhard Bröker wrote: > Your data actually appears to be in seconds since 1980-01-05, which almost > certainly means those are GPS timestamps. Calling that "UT" without any > further description is indeed a misrepresentation of facts. Right. Sat 5-Jan-1980, 23:59:45 to be precise. But how can I tell this to Gnuplot? I can obtain the correct day-of-the-month and month my saying plot using ($1-<the number correponding to 1-Jan-2014>) but then day-of-the-week is wrong. Can I adjust the day of the first point of my plot? Or can I cause "using ($1-something)" to act on the day-of-the-week only? -- Jean-Pierre Coulon
[toc] | [prev] | [next] | [standalone]
| From | Karl <mail.kfr@gmx.net> |
|---|---|
| Date | 2014-05-05 13:16 +0200 |
| Message-ID | <lk7rv0$roa$1@news.rz.uni-karlsruhe.de> |
| In reply to | #2453 |
Am 05.05.2014 08:37, schrieb Jean-Pierre Coulon: > Right. Sat 5-Jan-1980, 23:59:45 to be precise. But how can I tell this > to Gnuplot? > > I can obtain the correct day-of-the-month and month my saying plot using > ($1-<the number correponding to 1-Jan-2014>) but then day-of-the-week is Why 2014? You have to substract the number of seconds between tzero in gnuplot (1Jan2000) and tzero of your GPS time. The way you´re doing it, you don´t get the wrong day-of-week, you´re in the wrong year! > wrong. Can I adjust the day of the first point of my plot? Or can I > cause "using ($1-something)" to act on the day-of-the-week only? Gnuplot just calculates the day-of-week from the date, there´s no way to influence that. If you´re still convinced it does that wrongly, can you post the gnuplot script and a short snippet from your data? Best use inline data, i.e. something like plot "-" using (whatever) 123012938 23.4 123040033 45.5 123084232 12.3 e that way it´s easiest for others to reproduce your problem. Karl
[toc] | [prev] | [next] | [standalone]
| From | Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> |
|---|---|
| Date | 2014-05-05 14:09 +0200 |
| Message-ID | <alpine.WNT.2.11.1405051405320.4992@dhpc3-6> |
| In reply to | #2454 |
On Mon, 5 May 2014, Karl wrote: > Why 2014? You have to substract the number of seconds between tzero in > gnuplot (1Jan2000) and tzero of your GPS time. The way you´re doing it, > you don´t get the wrong day-of-week, you´re in the wrong year! Works fine. Thanks. Jean-Pierre Coulon
[toc] | [prev] | [next] | [standalone]
| From | Hans-Bernhard Bröker <HBBroeker@t-online.de> |
|---|---|
| Date | 2014-05-05 18:49 +0200 |
| Message-ID | <bsptosFdpedU1@mid.dfncis.de> |
| In reply to | #2453 |
On 05.05.2014 08:37, Jean-Pierre Coulon wrote:
> On Sat, 3 May 2014, Hans-Bernhard Bröker wrote:
>
>> Your data actually appears to be in seconds since 1980-01-05, which
>> almost certainly means those are GPS timestamps. Calling that "UT"
>> without any further description is indeed a misrepresentation of facts.
>
> Right. Sat 5-Jan-1980, 23:59:45 to be precise. But how can I tell this
> to Gnuplot?
GPS_offset = strptime('%Y-%m-%dT%H:%M:%S','1980-01-05T23:59:45')
plot 'data' u ($1+GPS_Offset)
[toc] | [prev] | [next] | [standalone]
| From | Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> |
|---|---|
| Date | 2014-05-06 07:39 +0200 |
| Message-ID | <alpine.WNT.2.11.1405060738530.5404@dhpc3-6> |
| In reply to | #2458 |
On Mon, 5 May 2014, Hans-Bernhard Bröker wrote:
> GPS_offset = strptime('%Y-%m-%dT%H:%M:%S','1980-01-05T23:59:45')
>
> plot 'data' u ($1+GPS_Offset)
Perfect! Thanks.
--
Jean-Pierre Coulon
[toc] | [prev] | [next] | [standalone]
| From | Hans-Bernhard Bröker <HBBroeker@t-online.de> |
|---|---|
| Date | 2014-05-02 18:22 +0200 |
| Message-ID | <bshv0vFnpnnU1@mid.dfncis.de> |
| In reply to | #2433 |
On 02.05.2014 15:10, Jean-Pierre Coulon wrote: > I am plotting an array with x in universal time. I know that 1-Jan-2004 > was TU=1072569615. and I am plotting using ($1-1072569615.) On what basis did you decide that 2004-01-01 had any relevance to this task? If x is indeed UTC, you could just set xdata time set timefmt x "%s" in current versions of gnuplot. >I said: set > format x "%a-%d-%b\n%H:%M:%Y". I obtain the right month and day-of-the > month on the X axis scale, but day-of-the-week is false . So what about the year? > I guess > Gnuplot guesses that 1-Jan-2004 was a Monday or a Sunday. On what basis?
[toc] | [prev] | [standalone]
Back to top | Article view | comp.graphics.apps.gnuplot
csiph-web