← All procedures

weather.forecast

Give the weather forecast of a point for each day, and optionally each hour (Open-Meteo)

CLI
Package
@procedures/weather · README
Path
["weather","forecast"]
CLI
mark weather forecast --lat <number> --lon <number>
As data
{"$proc":["weather","forecast"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/weather/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["weather","forecast"], { lat: 1, lon: 1 });
console.log(JSON.stringify(result));

From the command line

$ mark weather forecast --lat <number> --lon <number>

As data, in a program

{ "$proc": ["weather", "forecast"], "input": { "lat": 1, "lon": 1 } }

Input

FieldTypeRequiredDefaultDescription
latnumberyesThe latitude of the point, in degrees
lonnumberyesThe longitude of the point, in degrees
daysintegerno7The number of days (default: 7, at most 16)
units"metric" | "imperial"no"metric"metric (°C, km/h) or imperial (°F, mph). The default is metric.
hourlybooleannofalseAlso give each hour (default: false)
baseUrlstringnoAnother Open-Meteo server (default: the public server). The host policy refuses a loopback, private or link-local address.
timeoutMsintegerno20000The time limit, in milliseconds (default: 20000)

Output

FieldTypeRequiredDefaultDescription
timezonestringyes
unitsobjectyes
dailyobject[]yes
hourlyobject[]no
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "lat": {
        "type": "number",
        "minimum": -90,
        "maximum": 90,
        "description": "The latitude of the point, in degrees"
      },
      "lon": {
        "type": "number",
        "minimum": -180,
        "maximum": 180,
        "description": "The longitude of the point, in degrees"
      },
      "days": {
        "default": 7,
        "description": "The number of days (default: 7, at most 16)",
        "type": "integer",
        "minimum": 1,
        "maximum": 16
      },
      "units": {
        "default": "metric",
        "description": "metric (°C, km/h) or imperial (°F, mph). The default is metric.",
        "type": "string",
        "enum": [
          "metric",
          "imperial"
        ]
      },
      "hourly": {
        "default": false,
        "description": "Also give each hour (default: false)",
        "type": "boolean"
      },
      "baseUrl": {
        "description": "Another Open-Meteo server (default: the public server). The host policy refuses a loopback, private or link-local address.",
        "type": "string",
        "format": "uri"
      },
      "timeoutMs": {
        "default": 20000,
        "description": "The time limit, in milliseconds (default: 20000)",
        "type": "integer",
        "exclusiveMinimum": 0,
        "maximum": 120000
      }
    },
    "required": [
      "lat",
      "lon"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "timezone": {
        "type": "string"
      },
      "units": {
        "type": "object",
        "properties": {
          "temperature": {
            "type": "string"
          },
          "windSpeed": {
            "type": "string"
          }
        },
        "required": [
          "temperature",
          "windSpeed"
        ],
        "additionalProperties": false
      },
      "daily": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "date": {
              "type": "string"
            },
            "temperatureMax": {
              "type": [
                "number",
                "null"
              ]
            },
            "temperatureMin": {
              "type": [
                "number",
                "null"
              ]
            },
            "precipitationProbability": {
              "type": [
                "number",
                "null"
              ]
            },
            "windSpeedMax": {
              "type": [
                "number",
                "null"
              ]
            },
            "weatherCode": {
              "type": [
                "number",
                "null"
              ]
            }
          },
          "required": [
            "date",
            "temperatureMax",
            "temperatureMin",
            "precipitationProbability",
            "windSpeedMax",
            "weatherCode"
          ],
          "additionalProperties": false
        }
      },
      "hourly": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "time": {
              "type": "string"
            },
            "temperature": {
              "type": [
                "number",
                "null"
              ]
            },
            "precipitationProbability": {
              "type": [
                "number",
                "null"
              ]
            },
            "weatherCode": {
              "type": [
                "number",
                "null"
              ]
            }
          },
          "required": [
            "time",
            "temperature",
            "precipitationProbability",
            "weatherCode"
          ],
          "additionalProperties": false
        }
      }
    },
    "required": [
      "timezone",
      "units",
      "daily"
    ],
    "additionalProperties": false
  }
}