Not an elegant solution but I just converted the feet to metres:

#set $tides = $forecast.xtides
#if len($tides) > 0
  #for $tide in $tides  
  #set $height=$tide.offset.raw / 3.281
<tr>
   <td>$tide.event_ts.format("%a %d %H:%M")</td>
   <td>$tide.hilo</td>
   <td>
   #echo '%.2f' % $height
   m</td>
</tr>
#end for

Produces:

Mon 22 19:21 L 0.66 m
Tue 23 01:40 H 1.91 m
Tue 23 07:52 L 0.49 m
Tue 23 14:12 H 1.72 m
Tue 23 19:56 L 0.76 m
Wed 24 02:16 H 1.84...

On Monday, May 22, 2023 at 1:21:50 PM UTC+1 Rory Gillies wrote:

> OK, I sussed it out by adding duration = 1209600 to the XTide section. I 
> thought this was the default value as it is commented out in forecast.py 
> but it needs to be there for it to work.
>
> Now I have the tides the heights are showing up in feet, not metres, any 
> idea how to change this?
>
> Thanks,
>
> Rory
>
> On Monday, May 22, 2023 at 11:29:43 AM UTC+1 Rory Gillies wrote:
>
>> Hi,
>>
>> I am trying to add tides to my ephemeris page on my website but having 
>> difficulty getting it to work. I'm not at the stage of adding he code to my 
>> page template yet as I can't seem to get valid tide data. I am running 
>> forecast version 3.4.0b12. I have the nonfree data installed and XTide is 
>> working:
>>
>> weewx@weather:$ sudo tide -l "Lerwick"
>> Indexing /usr/share/xtide/harmonics-dwf-20100529-nonfree.tcd...
>> Indexing /usr/share/xtide/harmonics-initial.tcd...
>> Indexing /usr/share/xtide/harmonics-dwf-20191229-free.tcd...
>> Lerwick, Shetland Islands, Scotland - READ flaterco.com/pol.html
>> 60.1540° N, 1.1403° W
>>
>> 2023-05-22  1:32 PM BST   1.83 meters  High Tide
>> 2023-05-22  7:21 PM BST   0.66 meters  Low Tide
>> 2023-05-22  9:52 PM BST   Sunset
>> 2023-05-23  1:40 AM BST   1.91 meters  High Tide
>> 2023-05-23  2:17 AM BST   Moonset
>> 2023-05-23  4:08 AM BST   Sunrise
>> 2023-05-23  5:38 AM BST   Moonrise
>> 2023-05-23  7:52 AM BST   0.49 meters  Low Tide
>> 2023-05-23  2:12 PM BST   1.72 meters  High Tide
>> 2023-05-23  7:56 PM BST   0.76 meters  Low Tide
>> 2023-05-23  9:55 PM BST   Sunset
>> 2023-05-24  2:16 AM BST   1.84 meters  High Tide....>
>>
>> When WeeWX restarts I can see the XTide thread:
>>
>> May 22 08:56:52 weather weewx[1048507] INFO user.forecast: MainThread: 
>> XTide: forecast version 3.4.0b12
>> May 22 08:56:52 weather weewx[1048507] INFO user.forecast: MainThread: 
>> XTide: interval=1800 max_age=2419200 location='Lerwick, Shetland Islands, 
>> Scotland' duration=3600
>>
>> But when it generates a report it reports no tidal events:
>>
>> May 22 09:35:18 weather weewx[1048507] INFO user.forecast: XTideThread: 
>> XTide: generating tides from 2023-05-22 00:00:00 BST (1684710000) to 
>> 2023-05-22 01:00:00 BST (1684713600)
>> May 22 09:35:18 weather weewx[1048507] INFO user.forecast: XTideThread: 
>> XTide: got no tidal events
>>
>> For some reason it appears to be generating tides from the past, and 
>> between midnight and 01:00, where is it getting this time range from?
>>
>> Here's the [Forecast] section in weewx.conf:
>>
>> [Forecast]
>>     data_binding = forecast_binding
>>     interval = 1800
>>     [[XTide]]
>>         location = "Lerwick, Shetland Islands, Scotland"
>>     [[Zambretti]]
>>         hemisphere = NORTH
>>     [[Aeris]]
>>         client_id = xxxxxxxxxxxxxxxxxxxxxx
>>         client_secret = xxxxxxxxxxxxxxxxxx
>>     [[WU]]
>>         api_key = xxxxxxxxxxxxxxxxxxxxxxxx
>>     [[UKMO]]
>>         api_key = xxxxxxxxxxxxxxxxxxxxxxxx
>>         location = 352262
>>
>> And here's the [Services] section:
>>
>>  [[Services]]
>>  archive_services = weewx.engine.StdArchive, 
>> user.forecast.ZambrettiForecast, user.forecast.NWSForecast, 
>> user.forecast.WUForecast, user.forecast.OWMForecast, 
>> user.forecast.UKMOForecast, user.forecast.AerisForecast, 
>> user.forecast.WWOForecast, user.forecast.DSForecast, 
>> user.forecast.XTideForecast
>>
>> All other forecast threads are working correctly, just the XTide thread 
>> with the issue. If I use the bundled tides.html it reports "Tide forecast 
>> is not available."
>>
>> Any ideas?
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/cbdd8b5e-be80-44bc-b94a-d4f1354b2b9bn%40googlegroups.com.

Reply via email to