Grafana dashboard: Common Weather Website of Teide Observatory
Description: IAC


{
  "__inputs": [
    {
      "name": "DS_CWW_DB_OT-ADMIN.NET",
      "label": "cww_db_ot-admin.net",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    },
    {
      "name": "DS_JSON_OT_SUN",
      "label": "JSON_OT_SUN",
      "description": "",
      "type": "datasource",
      "pluginId": "marcusolsson-json-datasource",
      "pluginName": "JSON API"
    },
    {
      "name": "DS_TESS",
      "label": "tess",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    },
    {
      "name": "DS_JSON_OT_MOON",
      "label": "JSON_OT_MOON",
      "description": "",
      "type": "datasource",
      "pluginId": "marcusolsson-json-datasource",
      "pluginName": "JSON API"
    },
    {
      "name": "DS___EXPR__",
      "label": "__expr__",
      "description": "",
      "type": "datasource",
      "pluginId": "__expr__"
    }
  ],
  "__elements": [],
  "__requires": [
    {
      "type": "datasource",
      "id": "__expr__",
      "version": "1.0.0"
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": ""
    },
    {
      "type": "panel",
      "id": "grafana-clock-panel",
      "name": "Clock",
      "version": "1.3.0"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph (old)",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "datasource",
      "id": "marcusolsson-json-datasource",
      "name": "JSON API",
      "version": "1.3.1"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "text",
      "name": "Text",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": true,
  "panels": [
    {
      "clockType": "24 hour",
      "countdownSettings": {
        "endCountdownTime": "2019-08-20T11:09:00.000Z",
        "endText": "00:00:00"
      },
      "dateSettings": {
        "dateFormat": "YYYY-MM-DD",
        "fontSize": "15px",
        "fontWeight": "normal",
        "showDate": true
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "links": [],
      "mode": "time",
      "options": {
        "bgColor": "",
        "clockType": "24 hour",
        "countdownSettings": {
          "endCountdownTime": "2022-02-25T15:24:51+01:00",
          "endText": "00:00:00"
        },
        "countupSettings": {
          "beginCountupTime": "2022-02-25T15:24:51+01:00",
          "beginText": "00:00:00"
        },
        "dateSettings": {
          "dateFormat": "YYYY-MM-DD",
          "fontSize": "20px",
          "fontWeight": "normal",
          "locale": "",
          "showDate": false
        },
        "mode": "time",
        "refresh": "sec",
        "timeSettings": {
          "fontSize": "22px",
          "fontWeight": "normal"
        },
        "timezone": "",
        "timezoneSettings": {
          "fontSize": "12px",
          "fontWeight": "normal",
          "showTimezone": false,
          "zoneFormat": "offsetAbbv"
        }
      },
      "pluginVersion": "1.3.0",
      "refreshSettings": {
        "syncWithDashboard": false
      },
      "timeSettings": {
        "customFormat": "HH:mm:ss",
        "fontSize": "30px",
        "fontWeight": "normal"
      },
      "timezone": "UTC",
      "timezoneSettings": {
        "fontSize": "10px",
        "fontWeight": "normal",
        "showTimezone": true,
        "zoneFormat": "name"
      },
      "title": "Time",
      "type": "grafana-clock-panel"
    },
    {
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 2,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#299c46",
                "value": null
              },
              {
                "color": "rgba(237, 129, 40, 0.89)",
                "value": 70
              },
              {
                "color": "#d44a3a",
                "value": 90
              }
            ]
          },
          "unit": "humidity"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 3,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 8,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"humidity\")\r\n  |> filter(fn: (r) => r[\"station\"] !=  \"ttt1\" and r[\"station\"] !=  \"ttt2\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> last()",
          "refId": "A"
        }
      ],
      "timeFrom": "15m",
      "title": "Humidity",
      "type": "stat"
    },
    {
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 2,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#299c46",
                "value": null
              },
              {
                "color": "rgba(237, 129, 40, 0.89)",
                "value": 44
              },
              {
                "color": "#d44a3a",
                "value": 54
              }
            ]
          },
          "unit": "velocitykmh"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 6,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 10,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "import \"math\"\r\nimport \"array\"\r\n\r\nnull2zero = (val) => float(v:val)//if math.isNaN(f:val) then 0.0 else float(v:val)\r\n\r\ndeg2Rad = (deg) => null2zero(val:deg) * math.pi / 180.0\r\nrad2Deg = (rad) => null2zero(val:rad) * 180.0 / math.pi\r\nvectorMedian = (column, tables=<-) => tables \r\n  |> median()\r\n\r\narr_size = (arr) => arr |> array.filter(fn: (x) => x > 0) |> length()\r\n\r\ndata = from(bucket: \"cww_db\")\r\n        |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n        |> filter(fn: (r) => r[\"_measurement\"] == \"wind_direction\" or r[\"_measurement\"] == \"wind_velocity\")\r\n        |> group(columns: [\"station\", \"_measurement\"], mode:\"by\")  \r\n        |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n        |> keep(columns: [\"_value\", \"_time\", \"_measurement\", \"station\"]) \r\n        //|> yield(name: \"data\")     \r\n\r\newV = data \r\n        |> pivot(rowKey:[\"_time\"], columnKey: [\"station\",\"_measurement\"], valueColumn: \"_value\")  \r\n        |> map(fn: (r) => ({ r with _value_ttt: math.sin(x:deg2Rad(deg:if exists r.ttt_wind_direction then r.ttt_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.ttt_wind_velocity then r.ttt_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_mons: math.sin(x:deg2Rad(deg:if exists r.mons_wind_direction then r.mons_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.mons_wind_velocity then r.mons_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_stella: math.sin(x:deg2Rad(deg:if exists r.stella_wind_direction then r.stella_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.stella_wind_velocity then r.stella_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_open_uni: math.sin(x:deg2Rad(deg:if exists r.open_uni_wind_direction then r.open_uni_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.open_uni_wind_velocity then r.open_uni_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_song: math.sin(x:deg2Rad(deg:if exists r.song_wind_direction then r.song_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.song_wind_velocity then r.song_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({r with _value: (( r._value_ttt +r._value_mons+r._value_stella+r._value_open_uni+r._value_song)/ float(v:arr_size(arr:[r._value_ttt ,r._value_mons,r._value_stella,r._value_open_uni,r._value_song])))*-1.0}))        \r\n        |> drop(columns: [ \"ttt_wind_direction\", \"ttt_wind_velocity\",\"open_uni_wind_direction\", \"open_uni_wind_velocity\",\"mons_wind_direction\", \"mons_wind_velocity\",\"stella_wind_direction\", \"stella_wind_velocity\",\"song_wind_direction\", \"song_wind_velocity\"])\r\n        |> drop(columns: [ \"_value_ttt\", \"_value_mons\",\"_value_stella\", \"_value_open_uni\",\"_value_song\"])\r\n        //|> yield(name: \"ewV\")\r\n\r\nnsV = data \r\n        |> pivot(rowKey:[\"_time\"], columnKey: [\"station\",\"_measurement\"], valueColumn: \"_value\")  \r\n        |> map(fn: (r) => ({ r with _value_ttt: math.cos(x:deg2Rad(deg:if exists r.ttt_wind_direction then r.ttt_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.ttt_wind_velocity then r.ttt_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_mons: math.cos(x:deg2Rad(deg:if exists r.mons_wind_direction then r.mons_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.mons_wind_velocity then r.mons_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_stella: math.cos(x:deg2Rad(deg:if exists r.stella_wind_direction then r.stella_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.stella_wind_velocity then r.stella_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_open_uni: math.cos(x:deg2Rad(deg:if exists r.open_uni_wind_direction then r.open_uni_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.open_uni_wind_velocity then r.open_uni_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_song: math.cos(x:deg2Rad(deg:if exists r.song_wind_direction then r.song_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.song_wind_velocity then r.song_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({r with _value: (( r._value_ttt +r._value_mons+r._value_stella+r._value_open_uni+r._value_song)/ float(v:arr_size(arr:[r._value_ttt ,r._value_mons,r._value_stella,r._value_open_uni,r._value_song])))*-1.0}))        \r\n        |> drop(columns: [ \"ttt_wind_direction\", \"ttt_wind_velocity\",\"open_uni_wind_direction\", \"open_uni_wind_velocity\",\"mons_wind_direction\", \"mons_wind_velocity\",\"stella_wind_direction\", \"stella_wind_velocity\",\"song_wind_direction\", \"song_wind_velocity\"])\r\n        |> drop(columns: [ \"_value_ttt\", \"_value_mons\",\"_value_stella\", \"_value_open_uni\",\"_value_song\"])\r\n        //|> yield(name: \"nsV\")\r\n\r\n\r\nspeed = join(tables: {ewV: ewV, nsV: nsV}, on: [\"_time\"])\r\n        |> map(fn: (r) => ({r with _value: math.sqrt(x:math.pow(x:r._value_ewV,y:2.0) + math.pow(x:r._value_nsV,y:2.0))}))\r\n        |> drop(columns: [\"_value_ewV\", \"_value_nsV\"])\r\n        |> filter(fn: (r) => r._value > -300 and r._value < 300)\r\n        |> yield(name: \"speed\")\r\n        |> last()\r\n",
          "refId": "A"
        }
      ],
      "timeFrom": "15m",
      "title": "Wind velocity",
      "type": "stat"
    },
    {
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 2,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "degree"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 9,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 6,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "none",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "hide": true,
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"wind_direction\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> filter(fn: (r) => r[\"station\"] == \"open_uni\" or r[\"station\"] == \"res\" or r[\"station\"] == \"song\" or r[\"station\"] == \"stella\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> last()",
          "refId": "A"
        },
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "hide": false,
          "query": "import \"math\"\r\nimport \"array\"\r\n\r\nnull2zero = (val) => float(v:val)//if math.isNaN(f:val) then 0.0 else float(v:val)\r\n\r\ndeg2Rad = (deg) => null2zero(val:deg) * math.pi / 180.0\r\nrad2Deg = (rad) => null2zero(val:rad) * 180.0 / math.pi\r\nvectorMedian = (column, tables=<-) => tables \r\n  |> median()\r\n\r\narr_size = (arr) => arr |> array.filter(fn: (x) => x > 0) |> length()\r\n\r\ndata = from(bucket: \"cww_db\")\r\n        |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n        |> filter(fn: (r) => r[\"_measurement\"] == \"wind_direction\" or r[\"_measurement\"] == \"wind_velocity\")\r\n        |> group(columns: [\"station\", \"_measurement\"], mode:\"by\")  \r\n        |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n        |> keep(columns: [\"_value\", \"_time\", \"_measurement\", \"station\"]) \r\n        //|> yield(name: \"data\")     \r\n\r\newV = data \r\n        |> pivot(rowKey:[\"_time\"], columnKey: [\"station\",\"_measurement\"], valueColumn: \"_value\")  \r\n        |> map(fn: (r) => ({ r with _value_ttt: math.sin(x:deg2Rad(deg:if exists r.ttt_wind_direction then r.ttt_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.ttt_wind_velocity then r.ttt_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_mons: math.sin(x:deg2Rad(deg:if exists r.mons_wind_direction then r.mons_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.mons_wind_velocity then r.mons_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_stella: math.sin(x:deg2Rad(deg:if exists r.stella_wind_direction then r.stella_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.stella_wind_velocity then r.stella_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_open_uni: math.sin(x:deg2Rad(deg:if exists r.open_uni_wind_direction then r.open_uni_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.open_uni_wind_velocity then r.open_uni_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_song: math.sin(x:deg2Rad(deg:if exists r.song_wind_direction then r.song_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.song_wind_velocity then r.song_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({r with _value: (( r._value_ttt +r._value_mons+r._value_stella+r._value_open_uni+r._value_song)/ float(v:arr_size(arr:[r._value_ttt ,r._value_mons,r._value_stella,r._value_open_uni,r._value_song])))*-1.0}))        \r\n        |> drop(columns: [ \"ttt_wind_direction\", \"ttt_wind_velocity\",\"open_uni_wind_direction\", \"open_uni_wind_velocity\",\"mons_wind_direction\", \"mons_wind_velocity\",\"stella_wind_direction\", \"stella_wind_velocity\",\"song_wind_direction\", \"song_wind_velocity\"])\r\n        |> drop(columns: [ \"_value_ttt\", \"_value_mons\",\"_value_stella\", \"_value_open_uni\",\"_value_song\"])\r\n        //|> yield(name: \"ewV\")\r\n\r\nnsV = data \r\n        |> pivot(rowKey:[\"_time\"], columnKey: [\"station\",\"_measurement\"], valueColumn: \"_value\")  \r\n        |> map(fn: (r) => ({ r with _value_ttt: math.cos(x:deg2Rad(deg:if exists r.ttt_wind_direction then r.ttt_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.ttt_wind_velocity then r.ttt_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_mons: math.cos(x:deg2Rad(deg:if exists r.mons_wind_direction then r.mons_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.mons_wind_velocity then r.mons_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_stella: math.cos(x:deg2Rad(deg:if exists r.stella_wind_direction then r.stella_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.stella_wind_velocity then r.stella_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_open_uni: math.cos(x:deg2Rad(deg:if exists r.open_uni_wind_direction then r.open_uni_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.open_uni_wind_velocity then r.open_uni_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_song: math.cos(x:deg2Rad(deg:if exists r.song_wind_direction then r.song_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.song_wind_velocity then r.song_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({r with _value: (( r._value_ttt +r._value_mons+r._value_stella+r._value_open_uni+r._value_song)/ float(v:arr_size(arr:[r._value_ttt ,r._value_mons,r._value_stella,r._value_open_uni,r._value_song])))*-1.0}))        \r\n        |> drop(columns: [ \"ttt_wind_direction\", \"ttt_wind_velocity\",\"open_uni_wind_direction\", \"open_uni_wind_velocity\",\"mons_wind_direction\", \"mons_wind_velocity\",\"stella_wind_direction\", \"stella_wind_velocity\",\"song_wind_direction\", \"song_wind_velocity\"])\r\n        |> drop(columns: [ \"_value_ttt\", \"_value_mons\",\"_value_stella\", \"_value_open_uni\",\"_value_song\"])\r\n        //|> yield(name: \"nsV\")\r\n\r\n\r\n\r\ndirection = join(tables: {ewV: ewV, nsV: nsV}, on: [\"_time\"])\r\n        |> map(fn: (r) => ({r with _value: rad2Deg(rad: math.atan2(x:r._value_ewV, y: r._value_nsV))}))\r\n        |> drop(columns: [\"_value_ewV\", \"_value_nsV\"])\r\n        |> map(fn: (r) => ({r with _value: \r\n                    if r._value > 180.0 then\r\n                        r._value - 180.0\r\n                    else if r._value < 180.0 then\r\n                        r._value + 180.0\r\n                    else\r\n                        r._value,\r\n                })\r\n            )\r\n        |> yield(name: \"direction\")\r\n        |> last()\r\n",
          "refId": "B"
        }
      ],
      "timeFrom": "15m",
      "title": "Wind direction",
      "type": "stat"
    },
    {
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 12,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 14,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "none",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"dust\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> last()",
          "refId": "A"
        }
      ],
      "timeFrom": "15m",
      "title": "Dust",
      "type": "stat"
    },
    {
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "arcsec"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 15,
        "y": 0
      },
      "id": 25,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "none",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"seeing\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 1m, fn: median, createEmpty: false)\r\n  |> last()",
          "refId": "A",
          "target": "moon_illumination"
        }
      ],
      "title": "Seeing",
      "type": "stat"
    },
    {
      "gridPos": {
        "h": 7,
        "w": 6,
        "x": 18,
        "y": 0
      },
      "hideTimeOverride": true,
      "id": 65,
      "links": [],
      "options": {
        "content": "<div style=\"margin:0px;padding:0px;overflow:hidden\">\n    <a href=\"https://www.sky-live.tv/liveimages/webcam/opensky/cam56-TTT1-OT-CAN-faeton.jpg\" target=\"_blank\">\n    <img id=\"webcam_image_cam13\" src=\"https://www.sky-live.tv/liveimages/webcam/opensky/cam56-TTT1-OT-CAN-faeton.jpg\" frameborder=\"0\" style=\"overflow:hidden;overflow-x:hidden;overflow-y:hidden;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px\" width=\"100%\">\n    </a>\n</div>\n\n<script type=\"text/javascript\">\n    function doRefreshCam13(){\n        document.getElementById('webcam_image_cam13').src = \"https://www.sky-live.tv/liveimages/webcam/opensky/cam56-TTT1-OT-CAN-faeton.jpg?nocache=\"+Date.now();\n    }\n    $(function() {\n        setInterval(doRefreshCam13, 60000);\n    });\n</script>\n\n",
        "mode": "html"
      },
      "pluginVersion": "",
      "timeFrom": "15m",
      "transparent": true,
      "type": "text"
    },
    {
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 0,
        "y": 3
      },
      "id": 67,
      "links": [],
      "options": {
        "content": "<div class=\"singlestat-panel\">\n  <div class=\"singlestat-panel-value-container\"><span class=\"singlestat-panel-value\" id=\"sidereal_time\" style=\"font-size:22px\"></span></div>\n</div>\n\n<script>\n  function getLMST() {\n    longit = getLongitude();\n    lmst = LM_Sidereal_Time(jd, longit);\n    return lmst;\n  }\n\n\n  function JulDay(d, m, y, u) {\n    if (m <= 2) {\n      m = m + 12;\n      y = y - 1\n    }\n    var A = Math.floor(y / 100);\n    JD = Math.floor(365.25 * (y + 4716)) + Math.floor(30.6001 * (m + 1)) + d - 13 - 1524.5 + u / 24.0;\n    return JD\n  }\n\n\n  function HoursMinutesSeconds(time) {\n    var h = Math.floor(time);\n    var min = Math.floor(60.0 * frac(time));\n    var secs = Math.round(60.0 * (60.0 * frac(time) - min));\n    var str;\n    if (min >= 10) str = h + \":\" + min;\n    else str = h + \":0\" + min;\n    if (secs < 10) str = str + \":0\" + secs;\n    else str = str + \":\" + secs;\n    return \" \" + str;\n\n  }\n\n\n  function LM_Sidereal_Time(jd, longitude) {\n    var GMST = GM_Sidereal_Time(jd);\n    var LMST = 24.0 * frac((GMST + longitude / 15.0) / 24.0);\n    return HoursMinutesSeconds(LMST);\n  }\n\n  function GM_Sidereal_Time(jd) {\n    var t_eph, ut, MJD0, MJD;\n    MJD = jd - 2400000.5;\n    MJD0 = Math.floor(MJD);\n    ut = (MJD - MJD0) * 24.0;\n    t_eph = (MJD0 - 51544.5) / 36525.0;\n    return 6.697374558 + 1.0027379093 * ut + (8640184.812866 + (0.093104 - 0.0000062 * t_eph) * t_eph) * t_eph / 3600.0;\n  }\n\n  function frac(X) {\n    X = X - Math.floor(X);\n    if (X < 0) X = X + 1.0;\n    return X;\n  }\n\n  function getLongitude() {\n    return -16.507255817;\n\n  }\n\n  function doRefreshSiderealTime() {\n\n    var dat = new Date();\n    var ut = dat.getUTCHours() + dat.getUTCMinutes() / 60 + dat.getUTCSeconds() / 3600;\n    jd = JulDay(dat.getUTCDate(), dat.getUTCMonth() + 1, dat.getUTCFullYear(), ut);\n    lmst = getLMST()\n    //console.log(lmst);\n\n    document.getElementById(\"sidereal_time\").innerHTML = lmst; //toString(result['apparentSiderealTime'])\n\n  }\n  $(function() {\n    setInterval(doRefreshSiderealTime, 1000);\n  });\n  doRefreshSiderealTime()\n</script>\n\n",
        "mode": "html"
      },
      "pluginVersion": "",
      "title": "Sidereal Time",
      "type": "text"
    },
    {
      "datasource": {
        "type": "marcusolsson-json-datasource",
        "uid": "${DS_JSON_OT_SUN}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 1,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "dark-green",
                "value": null
              },
              {
                "color": "#1105ad",
                "value": -18
              },
              {
                "color": "#003cff",
                "value": -12
              },
              {
                "color": "#458ccc",
                "value": -6
              },
              {
                "color": "#dbbe1a",
                "value": 0
              }
            ]
          },
          "unit": "degree"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 3,
        "y": 3
      },
      "id": 24,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "cacheDurationSeconds": 300,
          "datasource": {
            "type": "marcusolsson-json-datasource",
            "uid": "${DS_JSON_OT_SUN}"
          },
          "fields": [
            {
              "jsonPath": "alt"
            }
          ],
          "method": "GET",
          "queryParams": "",
          "refId": "A",
          "target": "moon_illumination",
          "urlPath": ""
        }
      ],
      "title": "Sun altitude",
      "type": "stat"
    },
    {
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 2,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#299c46",
                "value": null
              },
              {
                "color": "rgba(237, 129, 40, 0.89)",
                "value": 44
              },
              {
                "color": "#d44a3a",
                "value": 54
              }
            ]
          },
          "unit": "velocitykmh"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 6,
        "y": 3
      },
      "hideTimeOverride": true,
      "id": 82,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "max"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "import \"math\"\r\nimport \"array\"\r\n\r\nnull2zero = (val) => float(v:val)//if math.isNaN(f:val) then 0.0 else float(v:val)\r\n\r\ndeg2Rad = (deg) => null2zero(val:deg) * math.pi / 180.0\r\nrad2Deg = (rad) => null2zero(val:rad) * 180.0 / math.pi\r\nvectorMedian = (column, tables=<-) => tables \r\n  |> median()\r\n\r\narr_size = (arr) => arr |> array.filter(fn: (x) => x > 0) |> length()\r\n\r\ndata = from(bucket: \"cww_db\")\r\n        |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n        |> filter(fn: (r) => r[\"_measurement\"] == \"wind_direction\" or r[\"_measurement\"] == \"wind_velocity\")\r\n        |> group(columns: [\"station\", \"_measurement\"], mode:\"by\")  \r\n        |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n        |> keep(columns: [\"_value\", \"_time\", \"_measurement\", \"station\"]) \r\n        //|> yield(name: \"data\")     \r\n\r\newV = data \r\n        |> pivot(rowKey:[\"_time\"], columnKey: [\"station\",\"_measurement\"], valueColumn: \"_value\")  \r\n        |> map(fn: (r) => ({ r with _value_ttt: math.sin(x:deg2Rad(deg:if exists r.ttt_wind_direction then r.ttt_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.ttt_wind_velocity then r.ttt_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_mons: math.sin(x:deg2Rad(deg:if exists r.mons_wind_direction then r.mons_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.mons_wind_velocity then r.mons_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_stella: math.sin(x:deg2Rad(deg:if exists r.stella_wind_direction then r.stella_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.stella_wind_velocity then r.stella_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_open_uni: math.sin(x:deg2Rad(deg:if exists r.open_uni_wind_direction then r.open_uni_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.open_uni_wind_velocity then r.open_uni_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_song: math.sin(x:deg2Rad(deg:if exists r.song_wind_direction then r.song_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.song_wind_velocity then r.song_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({r with _value: (( r._value_ttt +r._value_mons+r._value_stella+r._value_open_uni+r._value_song)/ float(v:arr_size(arr:[r._value_ttt ,r._value_mons,r._value_stella,r._value_open_uni,r._value_song])))*-1.0}))        \r\n        |> drop(columns: [ \"ttt_wind_direction\", \"ttt_wind_velocity\",\"open_uni_wind_direction\", \"open_uni_wind_velocity\",\"mons_wind_direction\", \"mons_wind_velocity\",\"stella_wind_direction\", \"stella_wind_velocity\",\"song_wind_direction\", \"song_wind_velocity\"])\r\n        |> drop(columns: [ \"_value_ttt\", \"_value_mons\",\"_value_stella\", \"_value_open_uni\",\"_value_song\"])\r\n        //|> yield(name: \"ewV\")\r\n\r\nnsV = data \r\n        |> pivot(rowKey:[\"_time\"], columnKey: [\"station\",\"_measurement\"], valueColumn: \"_value\")  \r\n        |> map(fn: (r) => ({ r with _value_ttt: math.cos(x:deg2Rad(deg:if exists r.ttt_wind_direction then r.ttt_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.ttt_wind_velocity then r.ttt_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_mons: math.cos(x:deg2Rad(deg:if exists r.mons_wind_direction then r.mons_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.mons_wind_velocity then r.mons_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_stella: math.cos(x:deg2Rad(deg:if exists r.stella_wind_direction then r.stella_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.stella_wind_velocity then r.stella_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_open_uni: math.cos(x:deg2Rad(deg:if exists r.open_uni_wind_direction then r.open_uni_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.open_uni_wind_velocity then r.open_uni_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_song: math.cos(x:deg2Rad(deg:if exists r.song_wind_direction then r.song_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.song_wind_velocity then r.song_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({r with _value: (( r._value_ttt +r._value_mons+r._value_stella+r._value_open_uni+r._value_song)/ float(v:arr_size(arr:[r._value_ttt ,r._value_mons,r._value_stella,r._value_open_uni,r._value_song])))*-1.0}))        \r\n        |> drop(columns: [ \"ttt_wind_direction\", \"ttt_wind_velocity\",\"open_uni_wind_direction\", \"open_uni_wind_velocity\",\"mons_wind_direction\", \"mons_wind_velocity\",\"stella_wind_direction\", \"stella_wind_velocity\",\"song_wind_direction\", \"song_wind_velocity\"])\r\n        |> drop(columns: [ \"_value_ttt\", \"_value_mons\",\"_value_stella\", \"_value_open_uni\",\"_value_song\"])\r\n        //|> yield(name: \"nsV\")\r\n\r\n\r\nspeed = join(tables: {ewV: ewV, nsV: nsV}, on: [\"_time\"])\r\n        |> map(fn: (r) => ({r with _value: math.sqrt(x:math.pow(x:r._value_ewV,y:2.0) + math.pow(x:r._value_nsV,y:2.0))}))\r\n        |> drop(columns: [\"_value_ewV\", \"_value_nsV\"])\r\n        |> filter(fn: (r) => r._value > -300 and r._value < 300)\r\n        |> yield(name: \"speed\")\r\n        |> max()\r\n",
          "refId": "A"
        }
      ],
      "timeFrom": "24h",
      "title": "Wind peak",
      "type": "stat"
    },
    {
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 1,
          "mappings": [
            {
              "options": {
                "from": 80,
                "result": {
                  "index": 0,
                  "text": "Cloudy"
                },
                "to": 100
              },
              "type": "range"
            },
            {
              "options": {
                "from": 0,
                "result": {
                  "index": 1,
                  "text": "Clear"
                },
                "to": 80
              },
              "type": "range"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#299c46",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 9,
        "y": 3
      },
      "hideTimeOverride": true,
      "id": 18,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"cloud\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> filter(fn: (r) => r[\"station\"] == \"open_uni\" or r[\"station\"] == \"res\" or r[\"station\"] == \"song\" or r[\"station\"] == \"stella\")\r\n  |> map(fn: (r) => ({r with _value: r._value * 100.0}))\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> last()",
          "refId": "A"
        }
      ],
      "timeFrom": "15m",
      "title": "Cloud",
      "type": "stat"
    },
    {
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 2,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "semi-dark-green",
                "value": null
              },
              {
                "color": "rgba(237, 129, 40, 0.89)",
                "value": 20
              },
              {
                "color": "rgba(245, 54, 54, 0.9)",
                "value": 25
              }
            ]
          },
          "unit": "celsius"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 12,
        "y": 3
      },
      "hideTimeOverride": true,
      "id": 4,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"temperature\")\r\n  |> filter(fn: (r) => r[\"station\"] !=  \"ttt1\" and r[\"station\"] !=  \"ttt2\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> last()",
          "refId": "A"
        }
      ],
      "timeFrom": "20m",
      "title": "Temperature",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_TESS}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 2,
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "orange",
                "value": null
              },
              {
                "color": "dark-green",
                "value": 20
              }
            ]
          },
          "unit": "none"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 15,
        "y": 3
      },
      "hideTimeOverride": true,
      "id": 53,
      "interval": "",
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_TESS}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT  median(\"mag\") FROM \"mqtt_consumer\" WHERE (\"name\" = 'stars433' OR \"name\" = 'stars211' OR \"name\" = 'stars385' OR \"name\" = 'stars426' OR \"name\" = 'stars427') AND $timeFilter",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": []
        }
      ],
      "timeFrom": "5m",
      "title": "TESS - Mag.",
      "type": "stat"
    },
    {
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 0,
        "y": 6
      },
      "id": 79,
      "links": [],
      "options": {
        "content": "<div class=\"singlestat-panel\">\n  <div class=\"singlestat-panel-value-container\"><span class=\"singlestat-panel-value\" id=\"next_twilight\" style=\"font-size:22px\"></span></div>\n</div>\n\n<script>\n  var J1970 = 2440588,\n    J2000 = 2451545,\n    deg2rad = Math.PI / 180,\n    M0 = 357.5291 * deg2rad,\n    M1 = 0.98560028 * deg2rad,\n    J0 = 0.0009,\n    J1 = 0.0053,\n    J2 = -0.0069,\n    C1 = 1.9148 * deg2rad,\n    C2 = 0.0200 * deg2rad,\n    C3 = 0.0003 * deg2rad,\n    P = 102.9372 * deg2rad,\n    e = 23.45 * deg2rad,\n    th0 = 280.1600 * deg2rad,\n    th1 = 360.9856235 * deg2rad,\n    h0 = -0.83 * deg2rad, //sunset angle\n    d0 = 0.53 * deg2rad, //sun diameter\n    h1 = -6 * deg2rad, //nautical twilight angle\n    h2 = -12 * deg2rad, //astronomical twilight angle\n    h3 = -18 * deg2rad //darkness angle\n  msInDay = 1000 * 60 * 60 * 24;\n\n  function dateToJulianDate(date) {\n    return date.valueOf() / msInDay - 0.5 + J1970;\n  }\n\n  function julianDateToDate(j) {\n    return new Date((j + 0.5 - J1970) * msInDay);\n  }\n\n  function getJulianCycle(J, lw) {\n    return Math.round(J - J2000 - J0 - lw / (2 * Math.PI));\n  }\n\n  function getApproxSolarTransit(Ht, lw, n) {\n    return J2000 + J0 + (Ht + lw) / (2 * Math.PI) + n;\n  }\n\n  function getSolarMeanAnomaly(Js) {\n    return M0 + M1 * (Js - J2000);\n  }\n\n  function getEquationOfCenter(M) {\n    return C1 * Math.sin(M) + C2 * Math.sin(2 * M) + C3 * Math.sin(3 * M);\n  }\n\n  function getEclipticLongitude(M, C) {\n    return M + P + C + Math.PI;\n  }\n\n  function getSolarTransit(Js, M, Lsun) {\n    return Js + (J1 * Math.sin(M)) + (J2 * Math.sin(2 * Lsun));\n  }\n\n  function getSunDeclination(Lsun) {\n    return Math.asin(Math.sin(Lsun) * Math.sin(e));\n  }\n\n  function getRightAscension(Lsun) {\n    return Math.atan2(Math.sin(Lsun) * Math.cos(e), Math.cos(Lsun));\n  }\n\n  function getSiderealTime(J, lw) {\n    return th0 + th1 * (J - J2000) - lw;\n  }\n\n  function getAzimuth(th, a, phi, d) {\n    var H = th - a;\n    return Math.atan2(Math.sin(H), Math.cos(H) * Math.sin(phi) -\n      Math.tan(d) * Math.cos(phi));\n  }\n\n  function getAltitude(th, a, phi, d) {\n    var H = th - a;\n    return Math.asin(Math.sin(phi) * Math.sin(d) +\n      Math.cos(phi) * Math.cos(d) * Math.cos(H));\n  }\n\n  function getHourAngle(h, phi, d) {\n    return Math.acos((Math.sin(h) - Math.sin(phi) * Math.sin(d)) /\n      (Math.cos(phi) * Math.cos(d)));\n  }\n\n  function getSunsetJulianDate(w0, M, Lsun, lw, n) {\n    return getSolarTransit(getApproxSolarTransit(w0, lw, n), M, Lsun);\n  }\n\n  function getSunriseJulianDate(Jtransit, Jset) {\n    return Jtransit - (Jset - Jtransit);\n  }\n\n  function getSunPosition(J, lw, phi) {\n    var M = getSolarMeanAnomaly(J),\n      C = getEquationOfCenter(M),\n      Lsun = getEclipticLongitude(M, C),\n      d = getSunDeclination(Lsun),\n      a = getRightAscension(Lsun),\n      th = getSiderealTime(J, lw);\n\n    return {\n      azimuth: getAzimuth(th, a, phi, d),\n      altitude: getAltitude(th, a, phi, d)\n    };\n  }\n\n  function getDayInfo(date, lat, lng, detailed) {\n    var lw = -lng * deg2rad,\n      phi = lat * deg2rad,\n      J = d\n<script>\n  var J1970 = 2440588,\n    J2000 = 2451545,\n    deg2rad = Math.PI / 180,\n    M0 = 357.5291 * deg2rad,\n    M1 = 0.98560028 * deg2rad,\n    J0 = 0.0009,\n    J1 = 0.0053,\n    J2 = -0.0069,\n    C1 = 1.9148 * deg2rad,\n    C2 = 0.0200 * deg2rad,\n    C3 = 0.0003 * deg2rad,\n    P = 102.9372 * deg2rad,\n    e = 23.45 * deg2rad,\n    th0 = 280.1600 * deg2rad,\n    th1 = 360.9856235 * deg2rad,\n    h0 = -0.83 * deg2rad, //sunset angle\n    d0 = 0.53 * deg2rad, //sun diameter\n    h1 = -6 * deg2rad, //nautical twilight angle\n    h2 = -12 * deg2rad, //astronomical twilight angle\n    h3 = -18 * deg2rad //darkness angle\n  msInDay = 1000 * 60 * 60 * 24;\n\n  function dateToJulianDate(date) {\n    return date.valueOf() / msInDay - 0.5 + J1970;\n  }\n\n  function julianDateToDate(j) {\n    return new Date((j + 0.5 - J1970) * msInDay);\n  }\n\n  function getJulianCycle(J, lw) {\n    return Math.round(J - J2000 - J0 - lw / (2 * Math.PI));\n  }\n\n  function getApproxSolarTransit(Ht, lw, n) {\n    return J2000 + J0 + (Ht + lw) / (2 * Math.PI) + n;\n  }\n\n  function getSolarMeanAnomaly(Js) {\n    return M0 + M1 * (Js - J2000);\n  }\n\n  function getEquationOfCenter(M) {\n    return C1 * Math.sin(M) + C2 * Math.sin(2 * M) + C3 * Math.sin(3 * M);\n  }\n\n  function getEclipticLongitude(M, C) {\n    return M + P + C + Math.PI;\n  }\n\n  function getSolarTransit(Js, M, Lsun) {\n    return Js + (J1 * Math.sin(M)) + (J2 * Math.sin(2 * Lsun));\n  }\n\n  function getSunDeclination(Lsun) {\n    return Math.asin(Math.sin(Lsun) * Math.sin(e));\n  }\n\n  function getRightAscension(Lsun) {\n    return Math.atan2(Math.sin(Lsun) * Math.cos(e), Math.cos(Lsun));\n  }\n\n  function getSiderealTime(J, lw) {\n    return th0 + th1 * (J - J2000) - lw;\n  }\n\n  function getAzimuth(th, a, phi, d) {\n    var H = th - a;\n    return Math.atan2(Math.sin(H), Math.cos(H) * Math.sin(phi) -\n      Math.tan(d) * Math.cos(phi));\n  }\n\n  function getAltitude(th, a, phi, d) {\n    var H = th - a;\n    return Math.asin(Math.sin(phi) * Math.sin(d) +\n      Math.cos(phi) * Math.cos(d) * Math.cos(H));\n  }\n\n  function getHourAngle(h, phi, d) {\n    return Math.acos((Math.sin(h) - Math.sin(phi) * Math.sin(d)) /\n      (Math.cos(phi) * Math.cos(d)));\n  }\n\n  function getSunsetJulianDate(w0, M, Lsun, lw, n) {\n    return getSolarTransit(getApproxSolarTransit(w0, lw, n), M, Lsun);\n  }\n\n  function getSunriseJulianDate(Jtransit, Jset) {\n    return Jtransit - (Jset - Jtransit);\n  }\n\n  function getSunPosition(J, lw, phi) {\n    var M = getSolarMeanAnomaly(J),\n      C = getEquationOfCenter(M),\n      Lsun = getEclipticLongitude(M, C),\n      d = getSunDeclination(Lsun),\n      a = getRightAscension(Lsun),\n      th = getSiderealTime(J, lw);\n\n    return {\n      azimuth: getAzimuth(th, a, phi, d),\n      altitude: getAltitude(th, a, phi, d)\n    };\n  }\n\n  function getDayInfo(date, lat, lng, detailed) {\n    var lw = -lng * deg2rad,\n      phi = lat * deg2rad,\n      J = dateToJulianDate(date);\n\n    var n = getJulianCycle(J, lw),\n      Js = getApproxSolarTransit(0, lw, n),\n      M = getSolarMeanAnomaly(Js),\n      C = getEquationOfCenter(M),\n      Lsun = getEclipticLongitude(M, C),\n      d = getSunDeclination(Lsun),\n      Jtransit = getSolarTransit(Js, M, Lsun),\n      w0 = getHourAngle(h0, phi, d),\n      w1 = getHourAngle(h0 + d0, phi, d),\n      Jset = getSunsetJulianDate(w0, M, Lsun, lw, n),\n      Jsetstart = getSunsetJulianDate(w1, M, Lsun, lw, n),\n      Jrise = getSunriseJulianDate(Jtransit, Jset),\n      Jriseend = getSunriseJulianDate(Jtransit, Jsetstart),\n      w2 = getHourAngle(h1, phi, d),\n      Jnau = getSunsetJulianDate(w2, M, Lsun, lw, n),\n      Jciv2 = getSunriseJulianDate(Jtransit, Jnau);\n\n    var info = {\n      // dawn: julianDateToDate(Jciv2),\n      // sunrise: {\n      //   start: julianDateToDate(Jrise),\n      //   end: julianDateToDate(Jriseend)\n      // },\n      // transit: julianDateToDate(Jtransit),\n      // sunset: {\n      //   start: julianDateToDate(Jsetstart),\n      //   end: julianDateToDate(Jset)\n      // },\n      // dusk: julianDateToDate(Jnau)\n    };\n\n    if (detailed) {\n      var w3 = getHourAngle(h2, phi, d),\n        w4 = getHourAngle(h3, phi, d),\n        Jastro = getSunsetJulianDate(w3, M, Lsun, lw, n),\n        Jdark = getSunsetJulianDate(w4, M, Lsun, lw, n),\n        Jnau2 = getSunriseJulianDate(Jtransit, Jastro),\n        Jastro2 = getSunriseJulianDate(Jtransit, Jdark);\n\n      info.morningTwilight = {\n        astronomical: {\n          start: julianDateToDate(Jastro2),\n          end: julianDateToDate(Jnau2)\n        },\n        // nautical: {\n        //   start: julianDateToDate(Jnau2),\n        //   end: julianDateToDate(Jciv2)\n        // },\n        // civil: {\n        //   start: julianDateToDate(Jciv2),\n        //   end: julianDateToDate(Jrise)\n        // }\n      };\n      info.nightTwilight = {\n        // civil: {\n        //   start: julianDateToDate(Jset),\n        //   end: julianDateToDate(Jnau)\n        // },\n        // nautical: {\n        //   start: julianDateToDate(Jnau),\n        //   end: julianDateToDate(Jastro)\n        // },\n        astronomical: {\n          start: julianDateToDate(Jastro),\n          end: julianDateToDate(Jdark)\n        }\n      };\n    }\n\n    return info;\n  }\n\n  function getSunPositionDate(date, lat, lng) {\n    return getSunPosition(dateToJulianDate(date), -lng * deg2rad, lat * deg2rad);\n  }\n\n\n  function doRefreshNextTwilight() {\n    // var yesterday = new Date();\n    var today = new Date();\n    var tomorrow = new Date();\n    // yesterday.setDate(today.getDate() - 1);\n    tomorrow.setDate(today.getDate() + 1);\n\n    var lat = \"28.3010937\";\n    var lon = \"-16.507255817\";\n\n    // var dayInfoYesterday = getDayInfo(yesterday, lat, lon, true)\n    var dayInfoToday = getDayInfo(today, lat, lon, true)\n    var dayInfoTomorrow = getDayInfo(tomorrow, lat, lon, true)\n    /*\n        if (today < dayInfoToday.morningTwilight.astronomical.start) {\n          document.getElementById(\"astronomical_night\").innerHTML = dayInfoYesterday.nightTwilight.astronomical.start.toUTCString() + \"<br><br>\" + dayInfoToday.morningTwilight.astronomical.end.toUTCString();\n        } else {\n          document.getElementById(\"astronomical_night\").innerHTML = dayInfoToday.nightTwilight.astronomical.start.toUTCString() + \"<br><br>\" + dayInfoTomorrow.morningTwilight.astronomical.end.toUTCString();\n        }\n        */\n    // console.log(dayInfoYesterday)\n    if (today < dayInfoToday.morningTwilight.astronomical.end) {\n      document.getElementById(\"next_twilight\").innerHTML = new Date(dayInfoToday.morningTwilight.astronomical.end - today).toISOString().substr(11, 8);\n    } else if (today < dayInfoToday.nightTwilight.astronomical.start) {\n      document.getElementById(\"next_twilight\").innerHTML = new Date(dayInfoToday.nightTwilight.astronomical.start - today).toISOString().substr(11, 8);\n    } else {\n      document.getElementById(\"next_twilight\").innerHTML = new Date(dayInfoTomorrow.morningTwilight.astronomical.end - today).toISOString().substr(11, 8);\n\n    }\n\n\n  }\n  $(function() {\n    setInterval(doRefreshNextTwilight, 1000);\n  });\n  doRefreshNextTwilight()\n</script>\n<script>\n  var J1970 = 2440588,\n    J2000 = 2451545,\n    deg2rad = Math.PI / 180,\n    M0 = 357.5291 * deg2rad,\n    M1 = 0.98560028 * deg2rad,\n    J0 = 0.0009,\n    J1 = 0.0053,\n    J2 = -0.0069,\n    C1 = 1.9148 * deg2rad,\n    C2 = 0.0200 * deg2rad,\n    C3 = 0.0003 * deg2rad,\n    P = 102.9372 * deg2rad,\n    e = 23.45 * deg2rad,\n    th0 = 280.1600 * deg2rad,\n    th1 = 360.9856235 * deg2rad,\n    h0 = -0.83 * deg2rad, //sunset angle\n    d0 = 0.53 * deg2rad, //sun diameter\n    h1 = -6 * deg2rad, //nautical twilight angle\n    h2 = -12 * deg2rad, //astronomical twilight angle\n    h3 = -18 * deg2rad //darkness angle\n  msInDay = 1000 * 60 * 60 * 24;\n\n  function dateToJulianDate(date) {\n    return date.valueOf() / msInDay - 0.5 + J1970;\n  }\n\n  function julianDateToDate(j) {\n    return new Date((j + 0.5 - J1970) * msInDay);\n  }\n\n  function getJulianCycle(J, lw) {\n    return Math.round(J - J2000 - J0 - lw / (2 * Math.PI));\n  }\n\n  function getApproxSolarTransit(Ht, lw, n) {\n    return J2000 + J0 + (Ht + lw) / (2 * Math.PI) + n;\n  }\n\n  function getSolarMeanAnomaly(Js) {\n    return M0 + M1 * (Js - J2000);\n  }\n\n  function getEquationOfCenter(M) {\n    return C1 * Math.sin(M) + C2 * Math.sin(2 * M) + C3 * Math.sin(3 * M);\n  }\n\n  function getEclipticLongitude(M, C) {\n    return M + P + C + Math.PI;\n  }\n\n  function getSolarTransit(Js, M, Lsun) {\n    return Js + (J1 * Math.sin(M)) + (J2 * Math.sin(2 * Lsun));\n  }\n\n  function getSunDeclination(Lsun) {\n    return Math.asin(Math.sin(Lsun) * Math.sin(e));\n  }\n\n  function getRightAscension(Lsun) {\n    return Math.atan2(Math.sin(Lsun) * Math.cos(e), Math.cos(Lsun));\n  }\n\n  function getSiderealTime(J, lw) {\n    return th0 + th1 * (J - J2000) - lw;\n  }\n\n  function getAzimuth(th, a, phi, d) {\n    var H = th - a;\n    return Math.atan2(Math.sin(H), Math.cos(H) * Math.sin(phi) -\n      Math.tan(d) * Math.cos(phi));\n  }\n\n  function getAltitude(th, a, phi, d) {\n    var H = th - a;\n    return Math.asin(Math.sin(phi) * Math.sin(d) +\n      Math.cos(phi) * Math.cos(d) * Math.cos(H));\n  }\n\n  function getHourAngle(h, phi, d) {\n    return Math.acos((Math.sin(h) - Math.sin(phi) * Math.sin(d)) /\n      (Math.cos(phi) * Math.cos(d)));\n  }\n\n  function getSunsetJulianDate(w0, M, Lsun, lw, n) {\n    return getSolarTransit(getApproxSolarTransit(w0, lw, n), M, Lsun);\n  }\n\n  function getSunriseJulianDate(Jtransit, Jset) {\n    return Jtransit - (Jset - Jtransit);\n  }\n\n  function getSunPosition(J, lw, phi) {\n    var M = getSolarMeanAnomaly(J),\n      C = getEquationOfCenter(M),\n      Lsun = getEclipticLongitude(M, C),\n      d = getSunDeclination(Lsun),\n      a = getRightAscension(Lsun),\n      th = getSiderealTime(J, lw);\n\n    return {\n      azimuth: getAzimuth(th, a, phi, d),\n      altitude: getAltitude(th, a, phi, d)\n    };\n  }\n\n  function getDayInfo(date, lat, lng, detailed) {\n    var lw = -lng * deg2rad,\n      phi = lat * deg2rad,\n      J = dateToJulianDate(date);\n\n    var n = getJulianCycle(J, lw),\n      Js = getApproxSolarTransit(0, lw, n),\n      M = getSolarMeanAnomaly(Js),\n      C = getEquationOfCenter(M),\n      Lsun = getEclipticLongitude(M, C),\n      d = getSunDeclination(Lsun),\n      Jtransit = getSolarTransit(Js, M, Lsun),\n      w0 = getHourAngle(h0, phi, d),\n      w1 = getHourAngle(h0 + d0, phi, d),\n      Jset = getSunsetJulianDate(w0, M, Lsun, lw, n),\n      Jsetstart = getSunsetJulianDate(w1, M, Lsun, lw, n),\n      Jrise = getSunriseJulianDate(Jtransit, Jset),\n      Jriseend = getSunriseJulianDate(Jtransit, Jsetstart),\n      w2 = getHourAngle(h1, phi, d),\n      Jnau = getSunsetJulianDate(w2, M, Lsun, lw, n),\n      Jciv2 = getSunriseJulianDate(Jtransit, Jnau);\n\n    var info = {\n      // dawn: julianDateToDate(Jciv2),\n      // sunrise: {\n      //   start: julianDateToDate(Jrise),\n      //   end: julianDateToDate(Jriseend)\n      // },\n      // transit: julianDateToDate(Jtransit),\n      // sunset: {\n      //   start: julianDateToDate(Jsetstart),\n      //   end: julianDateToDate(Jset)\n      // },\n      // dusk: julianDateToDate(Jnau)\n    };\n\n    if (detailed) {\n      var w3 = getHourAngle(h2, phi, d),\n        w4 = getHourAngle(h3, phi, d),\n        Jastro = getSunsetJulianDate(w3, M, Lsun, lw, n),\n        Jdark = getSunsetJulianDate(w4, M, Lsun, lw, n),\n        Jnau2 = getSunriseJulianDate(Jtransit, Jastro),\n        Jastro2 = getSunriseJulianDate(Jtransit, Jdark);\n\n      info.morningTwilight = {\n        astronomical: {\n          start: julianDateToDate(Jastro2),\n          end: julianDateToDate(Jnau2)\n        },\n        // nautical: {\n        //   start: julianDateToDate(Jnau2),\n        //   end: julianDateToDate(Jciv2)\n        // },\n        // civil: {\n        //   start: julianDateToDate(Jciv2),\n        //   end: julianDateToDate(Jrise)\n        // }\n      };\n      info.nightTwilight = {\n        // civil: {\n        //   start: julianDateToDate(Jset),\n        //   end: julianDateToDate(Jnau)\n        // },\n        // nautical: {\n        //   start: julianDateToDate(Jnau),\n        //   end: julianDateToDate(Jastro)\n        // },\n        astronomical: {\n          start: julianDateToDate(Jastro),\n          end: julianDateToDate(Jdark)\n        }\n      };\n    }\n\n    return info;\n  }\n\n  function getSunPositionDate(date, lat, lon) {\n    return getSunPosition(dateToJulianDate(date), -lon * deg2rad, lat * deg2rad);\n  }\n\n\n  function doRefreshNextTwilight() {\n    // var yesterday = new Date();\n    var today = new Date();\n    var tomorrow = new Date();\n    // yesterday.setDate(today.getDate() - 1);\n    tomorrow.setDate(today.getDate() + 1);\n\n    var lat = \"28.3010937\";\n    var lon = \"-16.507255817\";\n    //console.log(getSunPositionDate(today, lat, lon).altitude*180/Math.PI)\n\n    // var dayInfoYesterday = getDayInfo(yesterday, lat, lon, true)\n    var dayInfoToday = getDayInfo(today, lat, lon, true)\n    var dayInfoTomorrow = getDayInfo(tomorrow, lat, lon, true)\n    /*\n        if (today < dayInfoToday.morningTwilight.astronomical.start) {\n          document.getElementById(\"astronomical_night\").innerHTML = dayInfoYesterday.nightTwilight.astronomical.start.toUTCString() + \"<br><br>\" + dayInfoToday.morningTwilight.astronomical.end.toUTCString();\n        } else {\n          document.getElementById(\"astronomical_night\").innerHTML = dayInfoToday.nightTwilight.astronomical.start.toUTCString() + \"<br><br>\" + dayInfoTomorrow.morningTwilight.astronomical.end.toUTCString();\n        }\n        */\n    // console.log(dayInfoYesterday)\n    if (today < dayInfoToday.morningTwilight.astronomical.end) {\n      document.getElementById(\"next_twilight\").innerHTML = new Date(dayInfoToday.morningTwilight.astronomical.end - today).toISOString().substr(11, 8);\n    } else if (today < dayInfoToday.nightTwilight.astronomical.start) {\n      document.getElementById(\"next_twilight\").innerHTML = new Date(dayInfoToday.nightTwilight.astronomical.start - today).toISOString().substr(11, 8);\n    } else {\n      document.getElementById(\"next_twilight\").innerHTML = new Date(dayInfoTomorrow.morningTwilight.astronomical.end - today).toISOString().substr(11, 8);\n\n    }\n\n\n  }\n  $(function() {\n    setInterval(doRefreshNextTwilight, 1000);\n  });\n  doRefreshNextTwilight()\n</script>",
        "mode": "html"
      },
      "pluginVersion": "",
      "title": "Next Astronomical Twilight",
      "type": "text"
    },
    {
      "datasource": {
        "type": "marcusolsson-json-datasource",
        "uid": "${DS_JSON_OT_MOON}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 1,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "#299c46",
                "value": null
              },
              {
                "color": "orange",
                "value": 0
              }
            ]
          },
          "unit": "degree"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 3,
        "y": 6
      },
      "id": 21,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "cacheDurationSeconds": 300,
          "datasource": {
            "type": "marcusolsson-json-datasource",
            "uid": "${DS_JSON_OT_MOON}"
          },
          "fields": [
            {
              "jsonPath": "alt"
            }
          ],
          "method": "GET",
          "queryParams": "",
          "refId": "A",
          "target": "moon_illumination",
          "urlPath": ""
        }
      ],
      "title": "Moon altitude",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "marcusolsson-json-datasource",
        "uid": "${DS_JSON_OT_MOON}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "percentunit"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 6,
        "y": 6
      },
      "id": 20,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "none",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "cacheDurationSeconds": 300,
          "datasource": {
            "type": "marcusolsson-json-datasource",
            "uid": "${DS_JSON_OT_MOON}"
          },
          "fields": [
            {
              "jsonPath": "illumination"
            }
          ],
          "method": "GET",
          "queryParams": "",
          "refId": "A",
          "target": "moon_illumination",
          "urlPath": ""
        }
      ],
      "title": "Moon illumination",
      "type": "stat"
    },
    {
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 2,
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "pressurembar"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 9,
        "y": 6
      },
      "hideTimeOverride": true,
      "id": 12,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "none",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"pressure\")\r\n  |> filter(fn: (r) => r[\"station\"] !=  \"ttt1\" and r[\"station\"] !=  \"ttt2\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> last()",
          "refId": "A"
        }
      ],
      "timeFrom": "15m",
      "title": "Pressure",
      "type": "stat"
    },
    {
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "degree"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 12,
        "y": 6
      },
      "id": 83,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "none",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "/^dew_point$/",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"temperature\")\r\n  |> filter(fn: (r) => r[\"station\"] !=  \"ttt1\" and r[\"station\"] !=  \"ttt2\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> last()",
          "refId": "t"
        },
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "hide": false,
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"humidity\")\r\n  |> filter(fn: (r) => r[\"station\"] !=  \"ttt1\" and r[\"station\"] !=  \"ttt2\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> last()",
          "refId": "rh"
        },
        {
          "datasource": {
            "type": "__expr__",
            "uid": "${DS___EXPR__}"
          },
          "expression": "log($rh/100)+(18.678*$t)/(257.14+$t)",
          "hide": false,
          "refId": "t_rh",
          "type": "math"
        },
        {
          "datasource": {
            "type": "__expr__",
            "uid": "${DS___EXPR__}"
          },
          "expression": "(257.14*$t_rh)/(18.678-$t_rh)",
          "hide": false,
          "refId": "dew_point",
          "type": "math"
        }
      ],
      "title": "Dew Point",
      "type": "stat"
    },
    {
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "options": {
                "match": "null",
                "result": {
                  "text": "N/A"
                }
              },
              "type": "special"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "lengthkm"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 15,
        "y": 6
      },
      "id": 23,
      "links": [],
      "maxDataPoints": 100,
      "options": {
        "colorMode": "none",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "refId": "A",
          "target": "moon_illumination"
        }
      ],
      "title": "Extinction",
      "type": "stat"
    },
    {
      "gridPos": {
        "h": 7,
        "w": 6,
        "x": 18,
        "y": 7
      },
      "hideTimeOverride": true,
      "id": 68,
      "links": [],
      "options": {
        "content": "<div style=\"margin:0px;padding:0px;overflow:hidden\">\n    <a href=\"https://eumetview.eumetsat.int/static-images/latestImages/EUMETSAT_MSG_IR039Color_WesternAfrica.jpg\" target=\"_blank\">\n    <img id=\"webcam_image_eumetsat\" src=\"https://eumetview.eumetsat.int/static-images/latestImages/EUMETSAT_MSG_IR039Color_WesternAfrica.jpg\" frameborder=\"0\" style=\"overflow:hidden;overflow-x:hidden;overflow-y:hidden;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px\" width=\"100%\">\n    </a>\n</div>\n\n<script type=\"text/javascript\">\n    function doRefreshEumetsat(){\n        document.getElementById('webcam_image_eumetsat').src = \"https://eumetview.eumetsat.int/static-images/latestImages/EUMETSAT_MSG_IR039Color_WesternAfrica.jpg?nocache=\"+Date.now();\n    }\n    $(function() {\n        setInterval(doRefreshEumetsat, 60000);\n    });\n</script>\n\n",
        "mode": "html"
      },
      "pluginVersion": "",
      "timeFrom": "15m",
      "transparent": true,
      "type": "text"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "description": "",
      "fieldConfig": {
        "defaults": {
          "links": []
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "median"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "humidity value open_uni"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "OpenUni"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "humidity value res"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Res"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "humidity value song"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Song"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "humidity value stella"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Stella"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "humidity value atlas"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Atlas"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "humidity value mons"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Mons"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "humidity value ttt"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "TTT"
              }
            ]
          }
        ]
      },
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 9,
        "x": 0,
        "y": 9
      },
      "hiddenSeries": false,
      "id": 81,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "rightSide": true,
        "show": false,
        "sort": "current",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "$$hashKey": "object:176",
          "alias": "Res",
          "color": "#37872D"
        },
        {
          "$$hashKey": "object:177",
          "alias": "Song",
          "color": "#E0B400"
        },
        {
          "$$hashKey": "object:178",
          "alias": "Stella",
          "color": "#C4162A"
        },
        {
          "$$hashKey": "object:179",
          "alias": "OpenUni",
          "color": "#1F60C4"
        },
        {
          "$$hashKey": "object:180",
          "alias": "median",
          "color": "#8a4f03",
          "dashLength": 2,
          "dashes": true,
          "spaceLength": 4
        },
        {
          "$$hashKey": "object:167",
          "alias": "Atlas",
          "color": "#A352CC"
        },
        {
          "$$hashKey": "object:156",
          "alias": "Mons",
          "color": "#FF7383"
        },
        {
          "$$hashKey": "object:162",
          "alias": "TTT",
          "color": "#6f0c4f"
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "hide": false,
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"humidity\")\r\n  |> filter(fn: (r) => r[\"station\"] !=  \"ttt1\" and r[\"station\"] !=  \"ttt2\")\r\n  |> aggregateWindow(every: 5s, fn: last, createEmpty: false)\r\n  |> yield(name: \"last\")\r\n",
          "refId": "B"
        },
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "hide": false,
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"humidity\")  \r\n  |> filter(fn: (r) => r[\"station\"] !=  \"ttt1\" and r[\"station\"] !=  \"ttt2\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> yield(name: \"median\")",
          "refId": "A"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Humidity",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "transformations": [],
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:373",
          "decimals": 0,
          "format": "humidity",
          "label": "",
          "logBase": 1,
          "max": "100",
          "min": "0",
          "show": true
        },
        {
          "$$hashKey": "object:374",
          "format": "short",
          "logBase": 1,
          "show": false
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "fieldConfig": {
        "defaults": {
          "links": []
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "wind_velocity value open_uni"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "OpenUni"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "wind_velocity value res"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Res"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "wind_velocity value song"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Song"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "wind_velocity value stella"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Stella"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "median"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "wind_velocity value mons"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Mons"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "avg_wind_speed value ttt"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "TTT"
              }
            ]
          }
        ]
      },
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 9,
        "x": 9,
        "y": 9
      },
      "hiddenSeries": false,
      "id": 38,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "rightSide": true,
        "show": false,
        "sort": "current",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "$$hashKey": "object:771",
          "alias": "Res",
          "color": "#37872D"
        },
        {
          "$$hashKey": "object:772",
          "alias": "Song",
          "color": "#E0B400"
        },
        {
          "$$hashKey": "object:773",
          "alias": "Stella",
          "color": "#C4162A"
        },
        {
          "$$hashKey": "object:774",
          "alias": "OpenUni",
          "color": "#1F60C4"
        },
        {
          "$$hashKey": "object:775",
          "alias": "median",
          "color": "#8a4f03",
          "dashLength": 2,
          "dashes": true,
          "spaceLength": 4
        },
        {
          "$$hashKey": "object:280",
          "alias": "Mons",
          "color": "#FF7383"
        },
        {
          "$$hashKey": "object:311",
          "alias": "TTT",
          "color": "#6f0c4f"
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"wind_velocity\" or r[\"_measurement\"] == \"avg_wind_speed\")\r\n  |> filter(fn: (r) => r._value > -300 and r._value < 300)\r\n  |> map(fn: (r) => ({r with _value: r._value * 3.6}))\r\n  |> aggregateWindow(every: 5s, fn: last, createEmpty: false)\r\n  |> yield(name: \"last\")\r\n",
          "refId": "A"
        },
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "hide": false,
          "query": "import \"math\"\r\nimport \"array\"\r\n\r\nnull2zero = (val) => float(v:val)//if math.isNaN(f:val) then 0.0 else float(v:val)\r\n\r\ndeg2Rad = (deg) => null2zero(val:deg) * math.pi / 180.0\r\nrad2Deg = (rad) => null2zero(val:rad) * 180.0 / math.pi\r\nvectorMedian = (column, tables=<-) => tables \r\n  |> median()\r\n\r\narr_size = (arr) => arr |> array.filter(fn: (x) => x > 0) |> length()\r\n\r\ndata = from(bucket: \"cww_db\")\r\n        |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n        |> filter(fn: (r) => r[\"_measurement\"] == \"wind_direction\" or r[\"_measurement\"] == \"wind_velocity\")\r\n        |> group(columns: [\"station\", \"_measurement\"], mode:\"by\")  \r\n        |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n        |> keep(columns: [\"_value\", \"_time\", \"_measurement\", \"station\"]) \r\n        //|> yield(name: \"data\")     \r\n\r\newV = data \r\n        |> pivot(rowKey:[\"_time\"], columnKey: [\"station\",\"_measurement\"], valueColumn: \"_value\")  \r\n        |> map(fn: (r) => ({ r with _value_ttt: math.sin(x:deg2Rad(deg:if exists r.ttt_wind_direction then r.ttt_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.ttt_wind_velocity then r.ttt_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_mons: math.sin(x:deg2Rad(deg:if exists r.mons_wind_direction then r.mons_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.mons_wind_velocity then r.mons_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_stella: math.sin(x:deg2Rad(deg:if exists r.stella_wind_direction then r.stella_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.stella_wind_velocity then r.stella_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_open_uni: math.sin(x:deg2Rad(deg:if exists r.open_uni_wind_direction then r.open_uni_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.open_uni_wind_velocity then r.open_uni_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_song: math.sin(x:deg2Rad(deg:if exists r.song_wind_direction then r.song_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.song_wind_velocity then r.song_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({r with _value: (( r._value_ttt +r._value_mons+r._value_stella+r._value_open_uni+r._value_song)/ float(v:arr_size(arr:[r._value_ttt ,r._value_mons,r._value_stella,r._value_open_uni,r._value_song])))*-1.0}))        \r\n        |> drop(columns: [ \"ttt_wind_direction\", \"ttt_wind_velocity\",\"open_uni_wind_direction\", \"open_uni_wind_velocity\",\"mons_wind_direction\", \"mons_wind_velocity\",\"stella_wind_direction\", \"stella_wind_velocity\",\"song_wind_direction\", \"song_wind_velocity\"])\r\n        |> drop(columns: [ \"_value_ttt\", \"_value_mons\",\"_value_stella\", \"_value_open_uni\",\"_value_song\"])\r\n        //|> yield(name: \"ewV\")\r\n\r\nnsV = data \r\n        |> pivot(rowKey:[\"_time\"], columnKey: [\"station\",\"_measurement\"], valueColumn: \"_value\")  \r\n        |> map(fn: (r) => ({ r with _value_ttt: math.cos(x:deg2Rad(deg:if exists r.ttt_wind_direction then r.ttt_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.ttt_wind_velocity then r.ttt_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_mons: math.cos(x:deg2Rad(deg:if exists r.mons_wind_direction then r.mons_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.mons_wind_velocity then r.mons_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_stella: math.cos(x:deg2Rad(deg:if exists r.stella_wind_direction then r.stella_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.stella_wind_velocity then r.stella_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_open_uni: math.cos(x:deg2Rad(deg:if exists r.open_uni_wind_direction then r.open_uni_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.open_uni_wind_velocity then r.open_uni_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({ r with _value_song: math.cos(x:deg2Rad(deg:if exists r.song_wind_direction then r.song_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.song_wind_velocity then r.song_wind_velocity * 3.6 else 0.0) }))\r\n        |> map(fn: (r) => ({r with _value: (( r._value_ttt +r._value_mons+r._value_stella+r._value_open_uni+r._value_song)/ float(v:arr_size(arr:[r._value_ttt ,r._value_mons,r._value_stella,r._value_open_uni,r._value_song])))*-1.0}))        \r\n        |> drop(columns: [ \"ttt_wind_direction\", \"ttt_wind_velocity\",\"open_uni_wind_direction\", \"open_uni_wind_velocity\",\"mons_wind_direction\", \"mons_wind_velocity\",\"stella_wind_direction\", \"stella_wind_velocity\",\"song_wind_direction\", \"song_wind_velocity\"])\r\n        |> drop(columns: [ \"_value_ttt\", \"_value_mons\",\"_value_stella\", \"_value_open_uni\",\"_value_song\"])\r\n        //|> yield(name: \"nsV\")\r\n\r\n\r\nspeed = join(tables: {ewV: ewV, nsV: nsV}, on: [\"_time\"])\r\n        |> map(fn: (r) => ({r with _value: math.sqrt(x:math.pow(x:r._value_ewV,y:2.0) + math.pow(x:r._value_nsV,y:2.0))}))\r\n        |> drop(columns: [\"_value_ewV\", \"_value_nsV\"])\r\n        |> filter(fn: (r) => r._value > -300 and r._value < 300)\r\n        |> yield(name: \"speed\")\r\n",
          "refId": "B"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Wind velocity",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:812",
          "decimals": 0,
          "format": "velocitykmh",
          "label": "",
          "logBase": 1,
          "show": true
        },
        {
          "$$hashKey": "object:813",
          "format": "short",
          "logBase": 1,
          "show": false
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "description": "SDO/HMI Continuum Image\n",
      "gridPos": {
        "h": 9,
        "w": 6,
        "x": 18,
        "y": 14
      },
      "hideTimeOverride": true,
      "id": 80,
      "links": [],
      "options": {
        "content": "<div style=\"margin:0px;padding:0px;overflow:hidden\">\n    <a href=\"https://soho.nascom.nasa.gov/data/realtime/hmi_igr/1024/latest.jpg\" target=\"_blank\">\n    <img id=\"webcam_image_soho_nascom\" src=\"https://soho.nascom.nasa.gov/data/realtime/hmi_igr/1024/latest.jpg\" frameborder=\"0\" style=\"overflow:hidden;overflow-x:hidden;overflow-y:hidden;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px\" width=\"100%\">\n    </a>\n</div>\n\n<script type=\"text/javascript\">\n    function doRefreshEumetsat(){\n        document.getElementById('webcam_image_soho_nascom').src = \"https://soho.nascom.nasa.gov/data/realtime/hmi_igr/1024/latest.jpg?nocache=\"+Date.now();\n    }\n    $(function() {\n        setInterval(doRefreshEumetsat, 60000);\n    });\n</script>",
        "mode": "html"
      },
      "pluginVersion": "",
      "timeFrom": "15m",
      "transparent": true,
      "type": "text"
    },
    {
      "aliasColors": {
        "TESS 1": "#7eb26d",
        "TESS 2": "#eab839"
      },
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "fieldConfig": {
        "defaults": {
          "links": []
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "median"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "temperature value open_uni"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "OpenUni"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "temperature value res"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Res"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "temperature value song"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Song"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "temperature value stella"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Stella"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "temperature value atlas"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Atlas"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "temperature value mons"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Mons"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "temperature value ttt"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "TTT"
              }
            ]
          }
        ]
      },
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 5,
        "w": 9,
        "x": 0,
        "y": 15
      },
      "hiddenSeries": false,
      "id": 34,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "rightSide": true,
        "show": false,
        "sort": "current",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "$$hashKey": "object:927",
          "alias": "Res",
          "color": "#37872D"
        },
        {
          "$$hashKey": "object:928",
          "alias": "Song",
          "color": "#E0B400"
        },
        {
          "$$hashKey": "object:929",
          "alias": "Stella",
          "color": "#C4162A"
        },
        {
          "$$hashKey": "object:930",
          "alias": "OpenUni",
          "color": "#1F60C4"
        },
        {
          "$$hashKey": "object:931",
          "alias": "median",
          "color": "#8a4f03",
          "dashLength": 2,
          "dashes": true,
          "spaceLength": 4
        },
        {
          "$$hashKey": "object:244",
          "alias": "Atlas",
          "color": "#A352CC"
        },
        {
          "$$hashKey": "object:410",
          "alias": "Mons",
          "color": "#FF7383"
        },
        {
          "$$hashKey": "object:449",
          "alias": "TTT",
          "color": "#6f0c4f"
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"temperature\")\r\n  |> filter(fn: (r) => r[\"station\"] !=  \"ttt1\" and r[\"station\"] !=  \"ttt2\")\r\n  |> aggregateWindow(every: 5s, fn: last, createEmpty: false)\r\n  |> yield(name: \"last\")",
          "refId": "A"
        },
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "hide": false,
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"temperature\")\r\n  |> filter(fn: (r) => r[\"station\"] !=  \"ttt1\" and r[\"station\"] !=  \"ttt2\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> yield(name: \"median\")",
          "refId": "B"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Temperature",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:968",
          "decimals": 0,
          "format": "celsius",
          "label": "",
          "logBase": 1,
          "show": true
        },
        {
          "$$hashKey": "object:969",
          "format": "short",
          "logBase": 1,
          "show": false
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "fieldConfig": {
        "defaults": {
          "links": []
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "median"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "pressure value stella"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Stella"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "pressure value res"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Res"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "pressure value atlas"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Atlas"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "pressure value mons"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Mons"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "pressure value ttt"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "TTT"
              }
            ]
          }
        ]
      },
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 5,
        "w": 9,
        "x": 9,
        "y": 15
      },
      "hiddenSeries": false,
      "id": 42,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "rightSide": true,
        "show": false,
        "sort": "current",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "$$hashKey": "object:1075",
          "alias": "Res",
          "color": "#37872D"
        },
        {
          "$$hashKey": "object:1076",
          "alias": "Song",
          "color": "#E0B400"
        },
        {
          "$$hashKey": "object:1077",
          "alias": "Stella",
          "color": "#C4162A"
        },
        {
          "$$hashKey": "object:1078",
          "alias": "OpenUni",
          "color": "#1F60C4"
        },
        {
          "$$hashKey": "object:1079",
          "alias": "median",
          "color": "#8a4f03",
          "dashLength": 2,
          "dashes": true,
          "spaceLength": 4
        },
        {
          "$$hashKey": "object:208",
          "alias": "Atlas",
          "color": "#A352CC"
        },
        {
          "$$hashKey": "object:540",
          "alias": "Mons",
          "color": "#FF7383"
        },
        {
          "$$hashKey": "object:587",
          "alias": "TTT",
          "color": "#6f0c4f"
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"pressure\")\r\n  |> filter(fn: (r) => r[\"station\"] !=  \"ttt1\" and r[\"station\"] !=  \"ttt2\")\r\n  |> aggregateWindow(every: 5s, fn: last, createEmpty: false)\r\n  |> yield(name: \"last\")\r\n",
          "refId": "A"
        },
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "hide": false,
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"pressure\")\r\n  |> filter(fn: (r) => r[\"station\"] !=  \"ttt1\" and r[\"station\"] !=  \"ttt2\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> yield(name: \"median\")",
          "refId": "B"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Pressure",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:1116",
          "decimals": 0,
          "format": "pressurembar",
          "label": "",
          "logBase": 1,
          "show": true
        },
        {
          "$$hashKey": "object:1117",
          "format": "short",
          "logBase": 1,
          "show": false
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "fieldConfig": {
        "defaults": {
          "links": []
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "dust value {station=\"song\"}"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Song"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "dust value {station=\"stella\"}"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Stella"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "dust_pm1 value {station=\"atlas\"}"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Atlas - PM1"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "median_dust"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "median"
              }
            ]
          }
        ]
      },
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 9,
        "x": 0,
        "y": 20
      },
      "hiddenSeries": false,
      "id": 44,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "rightSide": true,
        "show": false,
        "sort": "current",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "$$hashKey": "object:1191",
          "alias": "Res",
          "color": "#37872D"
        },
        {
          "$$hashKey": "object:1192",
          "alias": "Song",
          "color": "#E0B400"
        },
        {
          "$$hashKey": "object:1193",
          "alias": "Stella",
          "color": "#C4162A"
        },
        {
          "$$hashKey": "object:1194",
          "alias": "OpenUni",
          "color": "#1F60C4"
        },
        {
          "$$hashKey": "object:1195",
          "alias": "/median/",
          "color": "#8a4f03",
          "dashLength": 2,
          "dashes": true,
          "spaceLength": 4
        },
        {
          "$$hashKey": "object:209",
          "alias": "Atlas - PM1",
          "color": "#8F3BB8"
        },
        {
          "$$hashKey": "object:217",
          "alias": "Atlas - PM2.5",
          "color": "#B877D9"
        },
        {
          "$$hashKey": "object:225",
          "alias": "Atlas - PM10",
          "color": "#DEB6F2"
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"dust\")\r\n  |> aggregateWindow(every: 5s, fn: last, createEmpty: false)\r\n  |> yield(name: \"last\")\r\n",
          "refId": "A"
        },
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "hide": false,
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"dust\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> rename(columns: {_value: \"median_dust\"})",
          "refId": "B"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Dust",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:1232",
          "format": "none",
          "label": "PLA m-3",
          "logBase": 1,
          "show": true
        },
        {
          "$$hashKey": "object:1233",
          "format": "short",
          "logBase": 1,
          "show": false
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "fieldConfig": {
        "defaults": {
          "links": []
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "wind_direction value open_uni"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "OpenUni"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "wind_direction value {station=\"res\"}"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Res"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "wind_direction value song"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Song"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "wind_direction value stella"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Stella"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "median"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "wind_direction value mons"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Mons"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "wind_direction value ttt"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "TTT"
              }
            ]
          }
        ]
      },
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 9,
        "x": 9,
        "y": 20
      },
      "hiddenSeries": false,
      "id": 36,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "rightSide": true,
        "show": false,
        "sort": "current",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": false,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "",
      "pointradius": 0.5,
      "points": true,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "$$hashKey": "object:1347",
          "alias": "Res",
          "color": "#37872D"
        },
        {
          "$$hashKey": "object:1348",
          "alias": "Song",
          "color": "#E0B400"
        },
        {
          "$$hashKey": "object:1349",
          "alias": "Stella",
          "color": "#C4162A"
        },
        {
          "$$hashKey": "object:1350",
          "alias": "OpenUni",
          "color": "#1F60C4"
        },
        {
          "$$hashKey": "object:1351",
          "alias": "median",
          "color": "#8a4f03",
          "dashLength": 2,
          "dashes": true,
          "linewidth": 1,
          "pointradius": 1,
          "spaceLength": 4
        },
        {
          "$$hashKey": "object:667",
          "alias": "Mons",
          "color": "#FF7383"
        },
        {
          "$$hashKey": "object:722",
          "alias": "TTT",
          "color": "#6f0c4f"
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"wind_direction\")\r\n  |> aggregateWindow(every: 5s, fn: last, createEmpty: false)\r\n  |> yield(name: \"last\")",
          "refId": "A"
        },
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "hide": false,
          "query": "import \"math\"\nimport \"array\"\n\nnull2zero = (val) => float(v:val)//if math.isNaN(f:val) then 0.0 else float(v:val)\n\ndeg2Rad = (deg) => null2zero(val:deg) * math.pi / 180.0\nrad2Deg = (rad) => null2zero(val:rad) * 180.0 / math.pi\nvectorMedian = (column, tables=<-) => tables \n  |> median()\n\narr_size = (arr) => arr |> array.filter(fn: (x) => x > 0) |> length()\n\ndata = from(bucket: \"cww_db\")\n        |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n        |> filter(fn: (r) => r[\"_measurement\"] == \"wind_direction\" or r[\"_measurement\"] == \"wind_velocity\")\n        |> group(columns: [\"station\", \"_measurement\"], mode:\"by\")  \n        |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\n        |> keep(columns: [\"_value\", \"_time\", \"_measurement\", \"station\"]) \n        //|> yield(name: \"data\")     \n\newV = data \n        |> pivot(rowKey:[\"_time\"], columnKey: [\"station\",\"_measurement\"], valueColumn: \"_value\")  \n        |> map(fn: (r) => ({ r with _value_ttt: math.sin(x:deg2Rad(deg:if exists r.ttt_wind_direction then r.ttt_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.ttt_wind_velocity then r.ttt_wind_velocity * 3.6 else 0.0) }))\n        |> map(fn: (r) => ({ r with _value_mons: math.sin(x:deg2Rad(deg:if exists r.mons_wind_direction then r.mons_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.mons_wind_velocity then r.mons_wind_velocity * 3.6 else 0.0) }))\n        |> map(fn: (r) => ({ r with _value_stella: math.sin(x:deg2Rad(deg:if exists r.stella_wind_direction then r.stella_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.stella_wind_velocity then r.stella_wind_velocity * 3.6 else 0.0) }))\n        |> map(fn: (r) => ({ r with _value_open_uni: math.sin(x:deg2Rad(deg:if exists r.open_uni_wind_direction then r.open_uni_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.open_uni_wind_velocity then r.open_uni_wind_velocity * 3.6 else 0.0) }))\n        |> map(fn: (r) => ({ r with _value_song: math.sin(x:deg2Rad(deg:if exists r.song_wind_direction then r.song_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.song_wind_velocity then r.song_wind_velocity * 3.6 else 0.0) }))\n        |> map(fn: (r) => ({r with _value: (( r._value_ttt +r._value_mons+r._value_stella+r._value_open_uni+r._value_song)/ float(v:arr_size(arr:[r._value_ttt ,r._value_mons,r._value_stella,r._value_open_uni,r._value_song])))*-1.0}))        \n        |> drop(columns: [ \"ttt_wind_direction\", \"ttt_wind_velocity\",\"open_uni_wind_direction\", \"open_uni_wind_velocity\",\"mons_wind_direction\", \"mons_wind_velocity\",\"stella_wind_direction\", \"stella_wind_velocity\",\"song_wind_direction\", \"song_wind_velocity\"])\n        |> drop(columns: [ \"_value_ttt\", \"_value_mons\",\"_value_stella\", \"_value_open_uni\",\"_value_song\"])\n        //|> yield(name: \"ewV\")\n\nnsV = data \n        |> pivot(rowKey:[\"_time\"], columnKey: [\"station\",\"_measurement\"], valueColumn: \"_value\")  \n        |> map(fn: (r) => ({ r with _value_ttt: math.cos(x:deg2Rad(deg:if exists r.ttt_wind_direction then r.ttt_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.ttt_wind_velocity then r.ttt_wind_velocity * 3.6 else 0.0) }))\n        |> map(fn: (r) => ({ r with _value_mons: math.cos(x:deg2Rad(deg:if exists r.mons_wind_direction then r.mons_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.mons_wind_velocity then r.mons_wind_velocity * 3.6 else 0.0) }))\n        |> map(fn: (r) => ({ r with _value_stella: math.cos(x:deg2Rad(deg:if exists r.stella_wind_direction then r.stella_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.stella_wind_velocity then r.stella_wind_velocity * 3.6 else 0.0) }))\n        |> map(fn: (r) => ({ r with _value_open_uni: math.cos(x:deg2Rad(deg:if exists r.open_uni_wind_direction then r.open_uni_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.open_uni_wind_velocity then r.open_uni_wind_velocity * 3.6 else 0.0) }))\n        |> map(fn: (r) => ({ r with _value_song: math.cos(x:deg2Rad(deg:if exists r.song_wind_direction then r.song_wind_direction * 3.6 else 0.0)) * null2zero(val:if exists r.song_wind_velocity then r.song_wind_velocity * 3.6 else 0.0) }))\n        |> map(fn: (r) => ({r with _value: (( r._value_ttt +r._value_mons+r._value_stella+r._value_open_uni+r._value_song)/ float(v:arr_size(arr:[r._value_ttt ,r._value_mons,r._value_stella,r._value_open_uni,r._value_song])))*-1.0}))        \n        |> drop(columns: [ \"ttt_wind_direction\", \"ttt_wind_velocity\",\"open_uni_wind_direction\", \"open_uni_wind_velocity\",\"mons_wind_direction\", \"mons_wind_velocity\",\"stella_wind_direction\", \"stella_wind_velocity\",\"song_wind_direction\", \"song_wind_velocity\"])\n        |> drop(columns: [ \"_value_ttt\", \"_value_mons\",\"_value_stella\", \"_value_open_uni\",\"_value_song\"])\n        //|> yield(name: \"nsV\")\n\n\n\ndirection = join(tables: {ewV: ewV, nsV: nsV}, on: [\"_time\"])\n        |> map(fn: (r) => ({r with _value: rad2Deg(rad: math.atan2(x:r._value_ewV, y: r._value_nsV))}))\n        |> drop(columns: [\"_value_ewV\", \"_value_nsV\"])\n        |> map(fn: (r) => ({r with _value: \n                    if r._value > 180.0 then\n                        r._value - 180.0\n                    else if r._value < 180.0 then\n                        r._value + 180.0\n                    else\n                        r._value,\n                })\n            )\n        |> yield(name: \"direction\")\n",
          "refId": "C"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Wind direction",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:1392",
          "decimals": 0,
          "format": "degree",
          "label": "",
          "logBase": 1,
          "max": "360",
          "min": "0",
          "show": true
        },
        {
          "$$hashKey": "object:1393",
          "format": "short",
          "logBase": 1,
          "show": false
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "fieldConfig": {
        "defaults": {
          "links": []
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "dust value {station=\"song\"}"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Song"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "dust value {station=\"stella\"}"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Stella"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "dust_pm1 value {station=\"atlas\"}"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Atlas - PM1"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "dust_pm2_5 value {station=\"atlas\"}"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Atlas - PM2.5"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "dust_pm10 value {station=\"atlas\"}"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Atlas - PM10"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "median_dust_pm10"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "median - PM10"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "median_dust_pm2_5"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "median - PM2.5"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "median_dust_pm1"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "median - PM1"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "dust_pm10 value {station=\"aemet\"}"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Aemet - PM10"
              }
            ]
          }
        ]
      },
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 9,
        "x": 0,
        "y": 26
      },
      "hiddenSeries": false,
      "id": 84,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "rightSide": true,
        "show": false,
        "sort": "current",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "$$hashKey": "object:1191",
          "alias": "Res",
          "color": "#37872D"
        },
        {
          "$$hashKey": "object:1192",
          "alias": "Song",
          "color": "#E0B400"
        },
        {
          "$$hashKey": "object:1193",
          "alias": "Stella",
          "color": "#C4162A"
        },
        {
          "$$hashKey": "object:1194",
          "alias": "OpenUni",
          "color": "#1F60C4"
        },
        {
          "$$hashKey": "object:1195",
          "alias": "/median/",
          "color": "#8a4f03",
          "dashLength": 2,
          "dashes": true,
          "spaceLength": 4
        },
        {
          "$$hashKey": "object:209",
          "alias": "Atlas - PM1",
          "color": "#8F3BB8"
        },
        {
          "$$hashKey": "object:217",
          "alias": "Atlas - PM2.5",
          "color": "#B877D9"
        },
        {
          "$$hashKey": "object:225",
          "alias": "Atlas - PM10",
          "color": "#DEB6F2"
        },
        {
          "$$hashKey": "object:294",
          "alias": "Aemet - PM10",
          "color": "#6e111a"
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] =~ /dust_/)\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> yield(name: \"last\")\r\n",
          "refId": "A"
        },
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "hide": false,
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"dust_pm1\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> rename(columns: {_value: \"median_dust_pm1\"})",
          "refId": "C"
        },
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "hide": false,
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"dust_pm2_5\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> rename(columns: {_value: \"median_dust_pm2_5\"})",
          "refId": "D"
        },
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "hide": false,
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"dust_pm10\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> rename(columns: {_value: \"median_dust_pm10\"})\r\n",
          "refId": "E"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Dust",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:1232",
          "format": "none",
          "label": "m-3",
          "logBase": 1,
          "show": true
        },
        {
          "$$hashKey": "object:1233",
          "format": "short",
          "logBase": 1,
          "show": false
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "description": "",
      "fieldConfig": {
        "defaults": {
          "links": []
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "wind_direction value open_uni"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "OpenUni"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "wind_direction value res"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Res"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "wind_direction value song"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Song"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "wind_direction value stella"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Stella"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Value"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "median"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "seeing value speculoos"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Speculoos"
              }
            ]
          }
        ]
      },
      "fill": 0,
      "fillGradient": 0,
      "gridPos": {
        "h": 6,
        "w": 9,
        "x": 9,
        "y": 26
      },
      "hiddenSeries": false,
      "id": 85,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "rightSide": true,
        "show": false,
        "sort": "current",
        "sortDesc": true,
        "total": false,
        "values": true
      },
      "lines": false,
      "linewidth": 2,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "",
      "pointradius": 0.5,
      "points": true,
      "renderer": "flot",
      "seriesOverrides": [
        {
          "$$hashKey": "object:1347",
          "alias": "Res",
          "color": "#37872D"
        },
        {
          "$$hashKey": "object:1348",
          "alias": "Song",
          "color": "#E0B400"
        },
        {
          "$$hashKey": "object:1349",
          "alias": "Stella",
          "color": "#C4162A"
        },
        {
          "$$hashKey": "object:1350",
          "alias": "OpenUni",
          "color": "#1F60C4"
        },
        {
          "$$hashKey": "object:1351",
          "alias": "median",
          "color": "#8a4f03",
          "dashLength": 2,
          "dashes": true,
          "linewidth": 1,
          "pointradius": 1,
          "spaceLength": 4
        },
        {
          "$$hashKey": "object:419",
          "alias": "Speculoos",
          "color": "#96D98D"
        }
      ],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"seeing\")\r\n  |> aggregateWindow(every: 5s, fn: last, createEmpty: false)\r\n  |> yield(name: \"last\")",
          "refId": "A"
        },
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_CWW_DB_OT-ADMIN.NET}"
          },
          "hide": false,
          "query": "from(bucket: \"cww_db\")\r\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n  |> filter(fn: (r) => r[\"_measurement\"] == \"seeing\")\r\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\r\n  |> group()\r\n  |> aggregateWindow(every: 5m, fn: median, createEmpty: false)\r\n  |> yield(name: \"median\")",
          "refId": "B"
        }
      ],
      "thresholds": [],
      "timeRegions": [],
      "title": "Seeing",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "mode": "time",
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:1392",
          "decimals": 0,
          "format": "arcsec",
          "label": "",
          "logBase": 1,
          "max": "4",
          "show": true
        },
        {
          "$$hashKey": "object:1393",
          "format": "short",
          "logBase": 1,
          "show": false
        }
      ],
      "yaxis": {
        "align": false
      }
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 32
      },
      "id": 63,
      "panels": [],
      "title": "Webcams",
      "type": "row"
    },
    {
      "gridPos": {
        "h": 10,
        "w": 6,
        "x": 0,
        "y": 33
      },
      "hideTimeOverride": true,
      "id": 54,
      "links": [],
      "options": {
        "content": "<div style=\"margin:0px;padding:0px;overflow:hidden\">\n    <a href=\"http://cww.ot-admin.net/webcam/ot-south.jpg\" target=\"_blank\">\n    <img id=\"webcam_image_south\" src=\"http://cww.ot-admin.net/webcam/ot-south.jpg\" frameborder=\"0\" style=\"overflow:hidden;overflow-x:hidden;overflow-y:hidden;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px\" width=\"100%\">\n    </a>\n</div>\n\n<script type=\"text/javascript\">\n    function doRefreshWebcamS(){\n        document.getElementById('webcam_image_south').src = \"http://cww.ot-admin.net/webcam/ot-south.jpg?nocache=\"+Date.now();\n    }\n    $(function() {\n        setInterval(doRefreshWebcamS, 60000);\n    });\n\nvar images = document.getElementsByTagName(\"img\");\nfor(var i = 0; i < images.length; i++) {\n    var image = images[i];\n    \n    image.onclick = function(event) {\n         window.location.href = this.src;\n    };\n}\n\n</script>\n\n",
        "mode": "html"
      },
      "pluginVersion": "",
      "timeFrom": "15m",
      "title": "South",
      "transparent": true,
      "type": "text"
    },
    {
      "gridPos": {
        "h": 10,
        "w": 6,
        "x": 6,
        "y": 33
      },
      "hideTimeOverride": true,
      "id": 55,
      "links": [],
      "options": {
        "content": "<div style=\"margin:0px;padding:0px;overflow:hidden\">\n  <a href=\"http://cww.ot-admin.net/webcam/ot-west.jpg\" target=\"_blank\">\n  <img id=\"webcam_image_west\" src=\"http://cww.ot-admin.net/webcam/ot-west.jpg\" frameborder=\"0\" style=\"overflow:hidden;overflow-x:hidden;overflow-y:hidden;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px\" width=\"100%\">\n  </a>\n</div>\n\n<script type=\"text/javascript\">\n  function doRefreshWebcamW() {\n    document.getElementById('webcam_image_west').src = \"http://cww.ot-admin.net/webcam/ot-west.jpg?nocache=\" + Date.now();\n  }\n  $(function() {\n    setInterval(doRefreshWebcamW, 60000);\n  });\n</script>",
        "mode": "html"
      },
      "pluginVersion": "",
      "timeFrom": "15m",
      "title": "West",
      "transparent": true,
      "type": "text"
    },
    {
      "gridPos": {
        "h": 10,
        "w": 6,
        "x": 12,
        "y": 33
      },
      "hideTimeOverride": true,
      "id": 56,
      "links": [],
      "options": {
        "content": "<div style=\"margin:0px;padding:0px;overflow:hidden\">\n  <a href=\"http://cww.ot-admin.net/webcam/ot-north.jpg\" target=\"_blank\">\n  <img id=\"webcam_image_north\" src=\"http://cww.ot-admin.net/webcam/ot-north.jpg\" frameborder=\"0\" style=\"overflow:hidden;overflow-x:hidden;overflow-y:hidden;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px\" width=\"100%\">\n  </a>\n</div>\n\n<script type=\"text/javascript\">\n  function doRefreshWebcamN() {\n    document.getElementById('webcam_image_north').src = \"http://cww.ot-admin.net/webcam/ot-north.jpg?nocache=\" + Date.now();\n  }\n  $(function() {\n    setInterval(doRefreshWebcamN, 60000);\n  });\n</script>",
        "mode": "html"
      },
      "pluginVersion": "",
      "timeFrom": "15m",
      "title": "North",
      "transparent": true,
      "type": "text"
    },
    {
      "gridPos": {
        "h": 10,
        "w": 6,
        "x": 18,
        "y": 33
      },
      "hideTimeOverride": true,
      "id": 57,
      "links": [],
      "options": {
        "content": "<div style=\"margin:0px;padding:0px;overflow:hidden\">\n  <a href=\"http://cww.ot-admin.net/webcam/ot-east.jpg\" target=\"_blank\">\n  <img id=\"webcam_image_east\" src=\"http://cww.ot-admin.net/webcam/ot-east.jpg\" frameborder=\"0\" style=\"overflow:hidden;overflow-x:hidden;overflow-y:hidden;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px\" width=\"100%\">\n  </a>\n</div>\n\n<script type=\"text/javascript\">\n  function doRefreshWebcamE() {\n    document.getElementById('webcam_image_east').src = \"http://cww.ot-admin.net/webcam/ot-east.jpg?nocache=\" + Date.now();\n  }\n  $(function() {\n    setInterval(doRefreshWebcamE, 60000);\n  });\n</script>",
        "mode": "html"
      },
      "pluginVersion": "",
      "timeFrom": "15m",
      "title": "East",
      "transparent": true,
      "type": "text"
    }
  ],
  "refresh": "1m",
  "schemaVersion": 35,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "timepicker": {
    "hidden": true,
    "refresh_intervals": [
      "1m"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "utc",
  "title": "Common Weather Website of Teide Observatory",
  "uid": "cww_ot",
  "version": 75,
  "weekStart": "",
  "gnetId": 18799,
  "description": "IAC"
}