Forecast Xtide

122 views
Skip to first unread message

Phil Owers

unread,
Jun 2, 2020, 8:18:55 AM6/2/20
to weewx-user
Hi
Using the tide.html.tmpl that is associated with weewx-forecast-master.zip it displays 12 days ish of tide times
Im trying to increase this to a month or even longer. The times in the forecast.sdb are for about a month 
Just wondered how I could display further than 12 days.
Thanks for any help
Phil

mwall

unread,
Jun 2, 2020, 9:16:19 AM6/2/20
to weewx-user
hi phil,

there are two parts to the answer:

1) how far into the future should the forecast go
2) how much of that forecast should be shown

for the first part, the default is 28 days.  if you want a longer forecast, change the 'duration' parameter.  these are the parameters that control the forecast generation:

[Forecast]
  [[XTide]]
    location = Boston
    interval = 1209600 # how often to generate forecast. default is 14 days
    duration = 2419200 # how far in future to forecast. default is 28 days
    max_age = 2419200 # how long to keep each forecast

for the second part, adjust the reporting parameters in the skin.  for the tides.html.tmpl template, this is controlled by this expression:

#for $tide in $tides
...
#end for

this will return every tide value from the current time into the future.

so if you have 28 days of tide predictions, and you do the report on day 1, you'll see tide values for 28 days.

if you do the report on day 10, you will see tide values for 18 days.

so there are a few ways to "show more tide data"

option 1: set a longer duration.  make the forecast generate more data points, then there will be more to display

option 2: adjust the "interval" parameter.  if you generate a forecast once per day, then each report will always have a full 28 days of forecast data

m

Phil Owers

unread,
Jun 2, 2020, 11:15:37 AM6/2/20
to weewx-user
Thanks for the quick reply
Ive checked that Im using
#set $tides = $forecast.xtides
#if len($tides) > 0
  #for $tide in $tides
$tide.event_ts $tide.hilo $tide.offset<br/>
  #end for
and the interval and duration are set to the default
Ive check that in the forecast.sdb has tide times that go to June28
The page gets updated every 10 mins and the first tide is June 2 16:18 but the last time is June 14th
When the first time is reached that goes and a new date gets added to the end
.I cant get it to go any further. than 12 days
Phil

Phil Owers

unread,
Jun 2, 2020, 11:25:01 AM6/2/20
to weewx-user
Sorry I had set the interval to 86400.


On Tuesday, June 2, 2020 at 1:18:55 PM UTC+1, Phil Owers wrote:

Phil Owers

unread,
Jun 2, 2020, 4:04:30 PM6/2/20
to weewx-user
Whatever I change It still only displays 12 days
Any help will be appreciated
Thanks Phil


On Tuesday, June 2, 2020 at 1:18:55 PM UTC+1, Phil Owers wrote:

mwall

unread,
Jun 2, 2020, 5:10:56 PM6/2/20
to weewx-user


On Tuesday, June 2, 2020 at 4:04:30 PM UTC-4, Phil Owers wrote:
Whatever I change It still only displays 12 days

what does the log say?

exactly what configuration are you using?

you might want to stop weewx, delete the forecast database, then start weewx

if you just keep restarting weewx, there is a good chance that forecast is doing nothing, since you already have a tide forecast.  it won't calculate a new forecast until it has to.

the log will tell you what is happening

m

Phil Owers

unread,
Jun 2, 2020, 7:51:11 PM6/2/20
to weewx-user
Thanks Mathew
By changing the interval and deleting the database I can now change whats displayed
Interval = 86400 displays jun3 to jun4
Interval = 864000 gives a display of Jun3rd to Jun14
However changing the interval to anything higher  say 20 days (1728000) makes no difference and I did delete the database twice .
When you start weewx the log shows 
Xtide interval=1728000 max_age=2419200 duration=3456000
Xtide thread getting tides for 3/6/2020 to 13/7/2020
Im changing the parameters interval and max_age is also there but I cant find duration so Im wondering where that is.
weewx is ver 4.1

On Tuesday, June 2, 2020 at 1:18:55 PM UTC+1, Phil Owers wrote:

mwall

unread,
Jun 2, 2020, 10:56:11 PM6/2/20
to weewx-user
On Tuesday, June 2, 2020 at 7:51:11 PM UTC-4, Phil Owers wrote:
By changing the interval and deleting the database I can now change whats displayed
Interval = 86400 displays jun3 to jun4
Interval = 864000 gives a display of Jun3rd to Jun14
However changing the interval to anything higher  say 20 days (1728000) makes no difference and I did delete the database twice .

the 'interval' determines how often the tide forecast is calculated

the 'duration' determines how far into the future the forecast will extend

if you do not specify a duration, then the duration defaults to twice the interval

Phil Owers

unread,
Jun 3, 2020, 5:07:35 AM6/3/20
to weewx-user
From the logs

Jun  3 00:05:16 raspberrypi weewx[15036] INFO user.forecast: MainThread: XTide: forecast version 3.4.0b1
Jun  3 00:05:16 raspberrypi weewx[15036] INFO user.forecast: MainThread: XTide: interval=1728000 max_age=2419200 location='Cromer, England' duration=3456000

Jun  3 00:10:15 raspberrypi weewx[15036] INFO user.forecast: XTideThread: XTide: generating tides from 2020-06-03 00:00:00 BST (1591138800) to 2020-07-13 00:00:00 BST (1594594800)
Jun  3 00:10:15 raspberrypi weewx[15036] INFO user.forecast: ZambrettiThread: Zambretti: generated 1 forecast record
Jun  3 00:10:15 raspberrypi weewx[15036] INFO user.forecast: UKMOThread: UKMO: got 34 forecast records
Jun  3 00:10:15 raspberrypi weewx[15036] INFO user.forecast: XTideThread: XTide: saved 154 forecast records
Jun  3 00:10:16 raspberrypi weewx[15036] INFO user.forecast: XTideThread: XTide: deleted forecasts prior to 1588720215

Duration is 3456000 with the interval set at 1728000 (20 days) so shouldn't that display 20 days, I cant get it any further than 12 days.

To clear one thing up 
[Forecast]
  [[XTide]]
    location = Boston
    interval = 1209600 # how often to generate forecast. default is 14 days
    duration = 2419200 # how far in future to forecast. default is 28 days
    max_age = 2419200 # how long to keep each forecast
Where should this go please as Im changing the values in forecast.py where I couldn't find DURATION
Sorry to be a pain
Phil



On Tuesday, June 2, 2020 at 1:18:55 PM UTC+1, Phil Owers wrote:

Phil Owers

unread,
Jun 3, 2020, 8:28:30 AM6/3/20
to weewx-user
Took a while for the penny to drop but now  realise they go in the weewx.conf file. 
Still cant display more than 12 days with the previous method but using the following method

#set $periods = $forecast.weather_periods('XTide', max_events=50)
  #for $period in $periods
  $period.event_ts $period.hilo<br/>
  #end for

I can get anything I wont displayed.

Phil

On Tuesday, June 2, 2020 at 1:18:55 PM UTC+1, Phil Owers wrote:

mwall

unread,
Jun 3, 2020, 8:33:08 AM6/3/20
to weewx-user


On Wednesday, June 3, 2020 at 5:07:35 AM UTC-4, Phil Owers wrote:

Where should this go please as Im changing the values in forecast.py where I couldn't find DURATION
Sorry to be a pain

no pain at all!  we just need a common reference frame.

when you make changes to weewx, most of the time you will modify the configuration file (typically weewx.conf) to affect the program behavior, or the template files (typically in a directory called 'skins') to affect the look/content of reports.  you should never have to modify the code (the .py files) unless you are writing new features or working on a bleeding edge bugfix.

in this case, you should modify weewx.conf.  it should be in /etc/weewx/weewx.conf or /home/weewx/weewx.conf, depending on how you installed weewx.

in that file, look for a section called 'Forecast'.  that is where you make the changes

then you must restart weewx for the changes to take effect

you should also only delete the forecast database while weewx is stopped - if you delete it while weewx is running it could become very confused

m

Phil Owers

unread,
Jun 4, 2020, 11:10:30 AM6/4/20
to weewx-user
Hi Mathew
Sorry I need your help again
Im trying to display at least 3 months of tide time data

Jun  4 15:32:12 raspberrypi weewx[9290] INFO user.forecast: MainThread: XTide: forecast version 3.4.0b1
Jun  4 15:32:12 raspberrypi weewx[9290] INFO user.forecast: MainThread: XTide: interval=86400 max_age=2419200 location='Cromer, England' duration=8640000
The above log has the data in the database and have confirmed by looking at the XTide first and last entry.
By using
#set $tides = $forecast.xtides
#if len($tides) > 0
  #for $tide in $tides
$tide.event_ts $tide.hilo $tide.offset<br/>
  #end for
I can only get 12 days displayed so I decided to see what this displayed 
#set $periods = $forecast.weather_periods('XTide', max_events=100)

  #for $period in $periods
  $period.event_ts $period.hilo<br/>
  #end for
It worked but only up to 54 events and refused to go any further
So what am I doing wrong.
Thanks in advance
Phil


On Tuesday, June 2, 2020 at 1:18:55 PM UTC+1, Phil Owers wrote:

Phil Owers

unread,
Jun 4, 2020, 3:08:46 PM6/4/20
to weewx...@googlegroups.com
In forecast.py under def xtides there is a max_events = 45. Changing that to a higher number has sorted my problem, however you may well tell me that could upset something.
Phil

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/03a35cca-2c4d-4127-a1d1-5e4b78c0ad75%40googlegroups.com.

John Kline

unread,
Jun 4, 2020, 3:25:03 PM6/4/20
to weewx...@googlegroups.com
It’s best to leave forecast.py alone and pass max_events as an arg when using that variable.

For example, to change max_events to 100 in the tides.html.tmpl template that ships with the extension:

Change:
#set $tides = $forecast.xtides()
to:
#set $tides = $forecast.xtides(max_events=100)

On Jun 4, 2020, at 12:08 PM, Phil Owers <philip....@gmail.com> wrote:


Reply all
Reply to author
Forward
0 new messages