BHGC / bhgc-europe

BHGC Flying Sites in Europe
https://bhgc.github.io/bhgc-europe/
1 stars 0 forks source link

Sweden: Raw Viva data #1

Open HenrikBengtsson opened 1 year ago

HenrikBengtsson commented 1 year ago

For example, for ViVa Station 45 (http://vivadisplay.sjofartsverket.se/#/station/45), I found via reverse engineering using Chrome Inspection that one can get the current live wind readings as:

$ curl 'https://services.viva.sjofartsverket.se:8080/output/vivaoutputservice.svc/vivastation/45?isMVY=false' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'Origin: http://vivadisplay.sjofartsverket.se' -H 'Connection: keep-alive' -H 'Referer: http://vivadisplay.sjofartsverket.se/' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'DNT: 1' -H 'Sec-GPC: 1' -H 'TE: trailers'
{"GetSingleStationResult":{"ID":45,"Name":"Helsingborg","Samples":[{"Name":"Vattenstånd","Value":"23","Heading":0,"Unit":"cm","Type":"level","Trend":"","Msg":"","Calm":0,"Updated":"2023-03-13 14:29:00","StationID":45,"Quality":"Ok","WaterLevelReference":"RH2000","WaterLevelOffset":9.4},{"Name":"Byvind","Value":"SV 15.3","Heading":236,"Unit":"m\/s","Type":"wind","Trend":"","Msg":"","Calm":0,"Updated":"2023-03-13 14:29:20","StationID":45,"Quality":"Ok","WaterLevelReference":null,"WaterLevelOffset":null},{"Name":"Medelvind","Value":"SV 10.6","Heading":236,"Unit":"m\/s","Type":"wind","Trend":"","Msg":"","Calm":0,"Updated":"2023-03-13 14:29:20","StationID":45,"Quality":"Ok","WaterLevelReference":null,"WaterLevelOffset":null},{"Name":"Vattentemp","Value":"3.5","Heading":0,"Unit":"°C","Type":"watertemp","Trend":"","Msg":"","Calm":0,"Updated":"2023-03-13 14:20:00","StationID":45,"Quality":"Ok","WaterLevelReference":null,"WaterLevelOffset":null}],"Felmeddelande":null}}

Same parsed via jq:

$ curl --silent 'https://services.viva.sjofartsverket.se:8080/output/vivaoutputservice.svc/vivastation/45?isMVY=false' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'Origin: http://vivadisplay.sjofartsverket.se' -H 'Connection: keep-alive' -H 'Referer: http://vivadisplay.sjofartsverket.se/' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'DNT: 1' -H 'Sec-GPC: 1' -H 'TE: trailers' | jq 
{
  "GetSingleStationResult": {
    "ID": 45,
    "Name": "Helsingborg",
    "Samples": [
      {
        "Name": "Vattenstånd",
        "Value": "23",
        "Heading": 0,
        "Unit": "cm",
        "Type": "level",
        "Trend": "",
        "Msg": "",
        "Calm": 0,
        "Updated": "2023-03-13 14:33:00",
        "StationID": 45,
        "Quality": "Ok",
        "WaterLevelReference": "RH2000",
        "WaterLevelOffset": 9.4
      },
      {
        "Name": "Byvind",
        "Value": "SV 15.3",
        "Heading": 233,
        "Unit": "m/s",
        "Type": "wind",
        "Trend": "",
        "Msg": "",
        "Calm": 0,
        "Updated": "2023-03-13 14:33:39",
        "StationID": 45,
        "Quality": "Ok",
        "WaterLevelReference": null,
        "WaterLevelOffset": null
      },
      {
        "Name": "Medelvind",
        "Value": "SV 10.8",
        "Heading": 233,
        "Unit": "m/s",
        "Type": "wind",
        "Trend": "",
        "Msg": "",
        "Calm": 0,
        "Updated": "2023-03-13 14:33:39",
        "StationID": 45,
        "Quality": "Ok",
        "WaterLevelReference": null,
        "WaterLevelOffset": null
      },
      {
        "Name": "Vattentemp",
        "Value": "3.5",
        "Heading": 0,
        "Unit": "°C",
        "Type": "watertemp",
        "Trend": "",
        "Msg": "",
        "Calm": 0,
        "Updated": "2023-03-13 14:30:00",
        "StationID": 45,
        "Quality": "Ok",
        "WaterLevelReference": null,
        "WaterLevelOffset": null
      }
    ],
    "Felmeddelande": null
  }
}
HenrikBengtsson commented 1 year ago

All available ViVa stations can be listed via https://services.viva.sjofartsverket.se:8080/output/vivaoutputservice.svc/vivastation/.

HenrikBengtsson commented 1 year ago

Historical wind data (here Medelvind = average wind) for a specific ViVa station can be pulled using:

station_id=45
what="Medelvind"  ## (average wind) or "Byvind" (gust) or "Riktning" (direction)
url="https://services.viva.sjofartsverket.se:8080/output/vivaoutputservice.svc/vivastationhistory/${what}/${station_id}?isMVY=false"

curl --silent "${url}" -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'Origin: http://vivadisplay.sjofartsverket.se' -H 'Connection: keep-alive' -H 'Referer: http://vivadisplay.sjofartsverket.se/' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'DNT: 1' -H 'Sec-GPC: 1' -H 'TE: trailers' | jq

returns

{
  "GetHistoryResult": {
    "StationHistory": [
      {
        "Value": "0.4",
        "Time": "2023-03-12 14:40:08"
      },
      {
        "Value": "0.5",
        "Time": "2023-03-12 14:50:09"
      },
      {
        "Value": "0.0",
        "Time": "2023-03-12 15:00:08"
      },
      {
        "Value": "0.2",
        "Time": "2023-03-12 15:10:07"
      },
      {
        "Value": "1.4",
        "Time": "2023-03-12 15:20:07"
      },
      {
        "Value": "3.3",
        "Time": "2023-03-12 15:30:09"
      },
      {
        "Value": "3.7",
        "Time": "2023-03-12 15:40:08"
      },
      {
        "Value": "3.9",
        "Time": "2023-03-12 15:50:07"
      },
      {
        "Value": "3.9",
        "Time": "2023-03-12 16:00:09"
      },
      {
        "Value": "3.1",
        "Time": "2023-03-12 16:10:08"
      },
      {
        "Value": "3.1",
        "Time": "2023-03-12 16:20:08"
      },
      {
        "Value": "3.1",
        "Time": "2023-03-12 16:30:07"
      },
      {
        "Value": "2.9",
        "Time": "2023-03-12 16:40:09"
      },
      {
        "Value": "5.8",
        "Time": "2023-03-12 16:50:09"
      },
      {
        "Value": "6.2",
        "Time": "2023-03-12 17:00:07"
      },
      {
        "Value": "6.2",
        "Time": "2023-03-12 17:10:08"
      },
      {
        "Value": "5.9",
        "Time": "2023-03-12 17:20:09"
      },
      {
        "Value": "6.2",
        "Time": "2023-03-12 17:30:09"
      },
      {
        "Value": "7.0",
        "Time": "2023-03-12 17:40:08"
      },
      {
        "Value": "8.0",
        "Time": "2023-03-12 17:50:08"
      },
      {
        "Value": "7.5",
        "Time": "2023-03-12 18:00:09"
      },
      {
        "Value": "7.4",
        "Time": "2023-03-12 18:10:08"
      },
      {
        "Value": "6.8",
        "Time": "2023-03-12 18:20:09"
      },
      {
        "Value": "7.0",
        "Time": "2023-03-12 18:30:09"
      },
      {
        "Value": "7.1",
        "Time": "2023-03-12 18:40:08"
      },
      {
        "Value": "7.7",
        "Time": "2023-03-12 18:50:08"
      },
      {
        "Value": "7.5",
        "Time": "2023-03-12 19:00:09"
      },
      {
        "Value": "7.2",
        "Time": "2023-03-12 19:10:08"
      },
      {
        "Value": "6.7",
        "Time": "2023-03-12 19:20:09"
      },
      {
        "Value": "7.7",
        "Time": "2023-03-12 19:30:07"
      },
      {
        "Value": "7.4",
        "Time": "2023-03-12 19:40:07"
      },
      {
        "Value": "7.9",
        "Time": "2023-03-12 19:50:08"
      },
      {
        "Value": "8.2",
        "Time": "2023-03-12 20:00:09"
      },
      {
        "Value": "9.6",
        "Time": "2023-03-12 20:10:09"
      },
      {
        "Value": "9.2",
        "Time": "2023-03-12 20:20:08"
      },
      {
        "Value": "8.9",
        "Time": "2023-03-12 20:30:08"
      },
      {
        "Value": "9.1",
        "Time": "2023-03-12 20:40:09"
      },
      {
        "Value": "8.2",
        "Time": "2023-03-12 20:50:08"
      },
      {
        "Value": "7.7",
        "Time": "2023-03-12 21:00:08"
      },
      {
        "Value": "5.8",
        "Time": "2023-03-12 21:10:08"
      },
      {
        "Value": "6.2",
        "Time": "2023-03-12 21:20:08"
      },
      {
        "Value": "5.3",
        "Time": "2023-03-12 21:30:07"
      },
      {
        "Value": "6.2",
        "Time": "2023-03-12 21:40:08"
      },
      {
        "Value": "6.2",
        "Time": "2023-03-12 21:50:08"
      },
      {
        "Value": "6.5",
        "Time": "2023-03-12 22:00:08"
      },
      {
        "Value": "6.3",
        "Time": "2023-03-12 22:10:07"
      },
      {
        "Value": "6.8",
        "Time": "2023-03-12 22:20:09"
      },
      {
        "Value": "6.7",
        "Time": "2023-03-12 22:30:08"
      },
      {
        "Value": "6.8",
        "Time": "2023-03-12 22:40:08"
      },
      {
        "Value": "7.6",
        "Time": "2023-03-12 22:50:07"
      },
      {
        "Value": "7.7",
        "Time": "2023-03-12 23:00:08"
      },
      {
        "Value": "7.1",
        "Time": "2023-03-12 23:10:08"
      },
      {
        "Value": "6.4",
        "Time": "2023-03-12 23:20:08"
      },
      {
        "Value": "6.5",
        "Time": "2023-03-12 23:30:09"
      },
      {
        "Value": "7.7",
        "Time": "2023-03-12 23:40:09"
      },
      {
        "Value": "10.7",
        "Time": "2023-03-12 23:50:07"
      },
      {
        "Value": "11.3",
        "Time": "2023-03-13 00:00:08"
      },
      {
        "Value": "11.6",
        "Time": "2023-03-13 00:10:07"
      },
      {
        "Value": "12.1",
        "Time": "2023-03-13 00:20:09"
      },
      {
        "Value": "11.6",
        "Time": "2023-03-13 00:30:08"
      },
      {
        "Value": "10.7",
        "Time": "2023-03-13 00:40:08"
      },
      {
        "Value": "11.3",
        "Time": "2023-03-13 00:50:08"
      },
      {
        "Value": "10.8",
        "Time": "2023-03-13 01:00:08"
      },
      {
        "Value": "10.9",
        "Time": "2023-03-13 01:10:08"
      },
      {
        "Value": "10.5",
        "Time": "2023-03-13 01:20:07"
      },
      {
        "Value": "9.7",
        "Time": "2023-03-13 01:30:07"
      },
      {
        "Value": "9.8",
        "Time": "2023-03-13 01:40:09"
      },
      {
        "Value": "9.5",
        "Time": "2023-03-13 01:50:07"
      },
      {
        "Value": "9.4",
        "Time": "2023-03-13 02:00:07"
      },
      {
        "Value": "9.7",
        "Time": "2023-03-13 02:10:08"
      },
      {
        "Value": "9.4",
        "Time": "2023-03-13 02:20:07"
      },
      {
        "Value": "8.7",
        "Time": "2023-03-13 02:30:08"
      },
      {
        "Value": "8.2",
        "Time": "2023-03-13 02:40:07"
      },
      {
        "Value": "7.8",
        "Time": "2023-03-13 02:50:08"
      },
      {
        "Value": "7.8",
        "Time": "2023-03-13 03:00:08"
      },
      {
        "Value": "6.8",
        "Time": "2023-03-13 03:10:08"
      },
      {
        "Value": "6.7",
        "Time": "2023-03-13 03:20:08"
      },
      {
        "Value": "6.3",
        "Time": "2023-03-13 03:30:09"
      },
      {
        "Value": "5.8",
        "Time": "2023-03-13 03:40:07"
      },
      {
        "Value": "5.8",
        "Time": "2023-03-13 03:50:08"
      },
      {
        "Value": "5.8",
        "Time": "2023-03-13 04:00:08"
      },
      {
        "Value": "5.6",
        "Time": "2023-03-13 04:10:08"
      },
      {
        "Value": "4.9",
        "Time": "2023-03-13 04:20:08"
      },
      {
        "Value": "4.3",
        "Time": "2023-03-13 04:30:08"
      },
      {
        "Value": "4.2",
        "Time": "2023-03-13 04:40:07"
      },
      {
        "Value": "4.1",
        "Time": "2023-03-13 04:50:08"
      },
      {
        "Value": "5.3",
        "Time": "2023-03-13 05:00:08"
      },
      {
        "Value": "5.2",
        "Time": "2023-03-13 05:10:08"
      },
      {
        "Value": "5.2",
        "Time": "2023-03-13 05:20:08"
      },
      {
        "Value": "5.1",
        "Time": "2023-03-13 05:30:08"
      },
      {
        "Value": "5.2",
        "Time": "2023-03-13 05:40:07"
      },
      {
        "Value": "4.8",
        "Time": "2023-03-13 05:50:08"
      },
      {
        "Value": "5.3",
        "Time": "2023-03-13 06:00:08"
      },
      {
        "Value": "5.7",
        "Time": "2023-03-13 06:10:08"
      },
      {
        "Value": "6.2",
        "Time": "2023-03-13 06:20:07"
      },
      {
        "Value": "6.7",
        "Time": "2023-03-13 06:30:08"
      },
      {
        "Value": "6.4",
        "Time": "2023-03-13 06:40:08"
      },
      {
        "Value": "6.8",
        "Time": "2023-03-13 06:50:09"
      },
      {
        "Value": "6.4",
        "Time": "2023-03-13 07:00:08"
      },
      {
        "Value": "6.2",
        "Time": "2023-03-13 07:10:08"
      },
      {
        "Value": "6.9",
        "Time": "2023-03-13 07:20:08"
      },
      {
        "Value": "7.4",
        "Time": "2023-03-13 07:30:08"
      },
      {
        "Value": "7.5",
        "Time": "2023-03-13 07:40:07"
      },
      {
        "Value": "8.0",
        "Time": "2023-03-13 07:50:08"
      },
      {
        "Value": "8.6",
        "Time": "2023-03-13 08:00:09"
      },
      {
        "Value": "7.5",
        "Time": "2023-03-13 08:10:08"
      },
      {
        "Value": "7.6",
        "Time": "2023-03-13 08:20:08"
      },
      {
        "Value": "8.2",
        "Time": "2023-03-13 08:30:08"
      },
      {
        "Value": "8.4",
        "Time": "2023-03-13 08:40:08"
      },
      {
        "Value": "8.4",
        "Time": "2023-03-13 08:50:07"
      },
      {
        "Value": "8.5",
        "Time": "2023-03-13 09:00:07"
      },
      {
        "Value": "8.3",
        "Time": "2023-03-13 09:10:07"
      },
      {
        "Value": "8.6",
        "Time": "2023-03-13 09:20:08"
      },
      {
        "Value": "8.3",
        "Time": "2023-03-13 09:30:07"
      },
      {
        "Value": "8.3",
        "Time": "2023-03-13 09:40:09"
      },
      {
        "Value": "8.9",
        "Time": "2023-03-13 09:50:08"
      },
      {
        "Value": "9.5",
        "Time": "2023-03-13 10:00:08"
      },
      {
        "Value": "9.9",
        "Time": "2023-03-13 10:10:08"
      },
      {
        "Value": "9.4",
        "Time": "2023-03-13 10:20:08"
      },
      {
        "Value": "9.6",
        "Time": "2023-03-13 10:30:08"
      },
      {
        "Value": "10.3",
        "Time": "2023-03-13 10:40:08"
      },
      {
        "Value": "10.4",
        "Time": "2023-03-13 10:50:09"
      },
      {
        "Value": "10.5",
        "Time": "2023-03-13 11:00:09"
      },
      {
        "Value": "10.2",
        "Time": "2023-03-13 11:10:07"
      },
      {
        "Value": "9.8",
        "Time": "2023-03-13 11:20:07"
      },
      {
        "Value": "10.1",
        "Time": "2023-03-13 11:30:09"
      },
      {
        "Value": "9.8",
        "Time": "2023-03-13 11:40:08"
      },
      {
        "Value": "8.8",
        "Time": "2023-03-13 11:50:09"
      },
      {
        "Value": "9.6",
        "Time": "2023-03-13 12:00:09"
      },
      {
        "Value": "9.5",
        "Time": "2023-03-13 12:10:07"
      },
      {
        "Value": "9.6",
        "Time": "2023-03-13 12:20:07"
      },
      {
        "Value": "9.6",
        "Time": "2023-03-13 12:30:09"
      },
      {
        "Value": "9.6",
        "Time": "2023-03-13 12:40:09"
      },
      {
        "Value": "9.2",
        "Time": "2023-03-13 12:50:08"
      },
      {
        "Value": "8.4",
        "Time": "2023-03-13 13:00:08"
      },
      {
        "Value": "7.2",
        "Time": "2023-03-13 13:10:09"
      },
      {
        "Value": "7.3",
        "Time": "2023-03-13 13:20:08"
      },
      {
        "Value": "7.6",
        "Time": "2023-03-13 13:30:09"
      },
      {
        "Value": "8.7",
        "Time": "2023-03-13 13:40:07"
      },
      {
        "Value": "9.2",
        "Time": "2023-03-13 13:50:09"
      },
      {
        "Value": "9.1",
        "Time": "2023-03-13 14:00:08"
      },
      {
        "Value": "10.4",
        "Time": "2023-03-13 14:10:09"
      },
      {
        "Value": "9.9",
        "Time": "2023-03-13 14:20:09"
      },
      {
        "Value": "10.6",
        "Time": "2023-03-13 14:30:08"
      }
    ],
    "Felmeddelande": null,
    "WaterLevelRef": null
  }
}