Calculating height of tide now: don't know how to select values from a list

Can anyone help me with some basic list processing? I’ve got Multiscrape scraping a daily list of tide times & heights and I want to do some maths using the most recent tide and the next tide. I think my sensor contains a list but I don’t seem to be able to access individual elements of it. What I’ve got so far:

  - name: Tides scraper
    resource: https://www.tidetimes.org.uk/appledore-tide-times
    sensor:
      - unique_id: tide0
        name: Tide0
        select_list: "#tides > table "
        value_template: '{{ value.split("Height")[1].split("NOT")[-2].split()}}'

Which returns:

sensor.tide0
Tide0
['High', '01:20', '4.56m', 'Low', '07:34', '1.92m', 'High', '14:03', '4.38m', 'Low', '19:57', '1.90m', 'High', '00:20', '4.56m', 'Low', '06:34', '1.92m', 'High', '13:03', '4.38m', 'Low', '18:57', '1.90m']	friendly_name: Tide0

I need 4 elements from this to perform the following maths (This is from my Excel function I used to test it out). The “Time” used in the will be “Now()”

Function TideHeight(Time, LastTide, LastHeight, NextTide, NextHeight)
  TideHeight = LastHeight + 0.5 * (NextHeight - LastHeight) * (1 - Cos(Application.Pi() * (Time - LastTide) / (NextTide - LastTide)))
End Function

As an added complication the Multiscrape sensor contains both BST and UT/GMT times and I’ll need to decide which to use. Each day can either have 4 sets of tides (H/L/H/L) or just 3 (H/L/H or L/H/L). To cope with now() being before the first or after the last of today’s tides, I can scrape other sensors for yesterday’s & tomorrow’s tides but they would be separate lists.
I’m very frustrated because I can do all this in Excel, I just don’t seem to be able to get the hang of YAML.