Skip to content

Instantly share code, notes, and snippets.

@Morstis
Last active April 28, 2024 07:42
Show Gist options
  • Save Morstis/8a4e19e9aca62817ff7a4dd1431a7fb6 to your computer and use it in GitHub Desktop.
Save Morstis/8a4e19e9aca62817ff7a4dd1431a7fb6 to your computer and use it in GitHub Desktop.
open meteo marine forecast openApi spec
openapi: 3.0.0
info:
title: Marine Weather Forecast API
description: Provides hourly marine weather forecast data for specified geographical coordinates.
version: 1.0.0
servers:
- url: https://marine-api.open-meteo.com/v1/
paths:
/marine:
get:
summary: Get Marine Weather Forecast
description: |
Retrieves a JSON hourly marine weather forecast for 7 days based on the provided geographical coordinate and optional parameters.
parameters:
- in: query
name: latitude
schema:
type: number
description: Geographical latitude coordinate (WGS84).
required: true
example: 10.227487
- in: query
name: longitude
schema:
type: number
description: Geographical longitude coordinate (WGS84).
required: true
example: 54.544587
- in: query
name: hourly
schema:
type: array
items:
type: string
enum: [wave_height, wave_direction, wave_period, wind_wave_height, wind_wave_direction, wind_wave_period, wind_wave_peak_period, swell_wave_height, swell_wave_direction, swell_wave_period, swell_wave_peak_period]
description: List of weather variables to be returned hourly.
required: false
- in: query
name: daily
schema:
type: array
items:
type: string
enum: [wave_height_max, wave_direction_dominant, wave_period_max, wind_wave_height_max, wind_wave_direction_dominant, wind_wave_period_max, wind_wave_peak_period_max, swell_wave_height_max, swell_wave_direction_dominant, swell_wave_period_max, swell_wave_peak_period_max]
description: List of daily weather variable aggregations to be returned.
required: false
- in: query
name: current
schema:
type: array
items:
type: string
enum: [wave_height,wave_direction,wave_period,wind_wave_height,wind_wave_direction,wind_wave_period,wind_wave_peak_period,swell_wave_height,swell_wave_direction,swell_wave_period,swell_wave_peak_period]
description: List of current weather variable to be returned.
required: false
- in: query
name: timeformat
schema:
type: string
enum: [iso8601, unixtime]
description: "If format unixtime is selected, all time values are returned in UNIX epoch time in seconds. Please note that all timestamp are in GMT+0! For daily values with unix timestamps, please apply utc_offset_seconds again to get the correct date."
- in: query
name: timezone
schema:
type: string
description: Timezone identifier (e.g., Europe/Berlin).
required: false
- in: query
name: past_days
schema:
type: integer
minimum: 0
maximum: 92
description: Number of past days to include in the forecast.
required: false
- in: query
name: forecast_days
schema:
type: integer
minimum: 0
maximum: 8
description: "Number of forecast days to include (default: 5)."
required: false
- in: query
name: forecast_hours
schema:
type: integer
minimum: 1
description: Number of forecast hours to include.
required: false
- in: query
name: past_hours
schema:
type: integer
minimum: 1
description: Number of past hours to include.
required: false
- in: query
name: start_date
schema:
type: string
format: date
description: Start date for weather data retrieval.
required: false
- in: query
name: end_date
schema:
type: string
format: date
description: End date for weather data retrieval.
required: false
- in: query
name: start_hour
schema:
type: string
format: date-time
description: Start hour for hourly data retrieval.
required: false
- in: query
name: end_hour
schema:
type: string
format: date-time
description: End hour for hourly data retrieval.
required: false
- in: query
name: length_unit
schema:
type: string
enum: [metric, imperial]
description: Unit of length (metric or imperial).
required: false
- in: query
name: cell_selection
schema:
type: string
enum: [sea, land, nearest]
description: Preference for selecting grid cells.
required: false
- in: query
name: apikey
schema:
type: string
description: API key for commercial use (required for accessing reserved resources).
required: false
responses:
'200':
description: Successful response with weather forecast data.
content:
application/json:
schema:
type: object
properties:
latitude:
type: number
format: float
description: Geographical latitude coordinate.
example: 54.550003
longitude:
type: number
format: float
description: Geographical longitude coordinate.
example: 10.200001
generationtime_ms:
type: number
format: float
description: Generation time of the weather forecast in milliseconds.
example: 0.34499168395996094
utc_offset_seconds:
type: integer
description: Applied timezone offset from the &timezone parameter.
example: 0
timezone:
type: string
description: Timezone identifier.
example: GMT
timezone_abbreviation:
type: string
description: Timezone abbreviation.
example: GMT
elevation:
type: number
format: float
description: Elevation in meters.
example: 0.0
current_units:
type: object
description: Units for current weather variables.
properties:
time:
type: string
description: Format of time.
example: unixtime
interval:
type: string
description: Format of interval.
example: seconds
wave_height:
type: string
description: Unit for wave height.
example: m
wave_direction:
type: string
description: Unit for wave direction.
example: °
wave_period:
type: string
description: Unit for wave period.
example: s
wind_wave_height:
type: string
description: Unit for wind wave height.
example: m
wind_wave_direction:
type: string
description: Unit for wind wave direction.
example: °
wind_wave_period:
type: string
description: Unit for wind wave period.
example: s
wind_wave_peak_period:
type: string
description: Unit for wind wave peak period.
example: s
swell_wave_height:
type: string
description: Unit for swell wave height.
example: m
swell_wave_direction:
type: string
description: Unit for swell wave direction.
example: °
swell_wave_period:
type: string
description: Unit for swell wave period.
example: s
swell_wave_peak_period:
type: string
description: Unit for swell wave peak period.
example: s
current:
type: object
description: Current weather data.
properties:
time:
type: integer
description: Time in the specified format.
interval:
type: integer
description: Interval in seconds.
wave_height:
type: number
format: float
description: Wave height.
wave_direction:
type: number
format: float
description: Wave direction.
wave_period:
type: number
format: float
description: Wave period.
wind_wave_height:
type: number
format: float
description: Wind wave height.
wind_wave_direction:
type: number
format: float
description: Wind wave direction.
wind_wave_period:
type: number
format: float
description: Wind wave period.
wind_wave_peak_period:
type: number
format: float
description: Wind wave peak period.
swell_wave_height:
type: number
format: float
description: Swell wave height.
swell_wave_direction:
type: number
format: float
description: Swell wave direction.
swell_wave_period:
type: number
format: float
description: Swell wave period.
swell_wave_peak_period:
type: number
format: float
description: Swell wave peak period.
hourly_units:
type: object
description: Units for current weather variables.
properties:
time:
type: string
description: Format of time.
example: unixtime
wave_height:
type: string
description: Unit for wave height.
example: m
wave_direction:
type: string
description: Unit for wave direction.
example: °
wave_period:
type: string
description: Unit for wave period.
example: s
wind_wave_height:
type: string
description: Unit for wind wave height.
example: m
wind_wave_direction:
type: string
description: Unit for wind wave direction.
example: °
wind_wave_period:
type: string
description: Unit for wind wave period.
example: s
wind_wave_peak_period:
type: string
description: Unit for wind wave peak period.
example: s
swell_wave_height:
type: string
description: Unit for swell wave height.
example: m
swell_wave_direction:
type: string
description: Unit for swell wave direction.
example: °
swell_wave_period:
type: string
description: Unit for swell wave period.
example: s
swell_wave_peak_period:
type: string
description: Unit for swell wave peak period.
example: s
hourly:
type: object
description: Hourly weather forecast data.
properties:
time:
type: array
items:
type: integer
description: List of timestamps.
wave_height:
type: array
items:
type: number
format: float
description: List of wave heights.
wave_direction:
type: array
items:
type: number
format: float
description: List of wave directions.
wave_period:
type: array
items:
type: number
format: float
description: List of wave periods.
wind_wave_height:
type: array
items:
type: number
format: float
description: List of wind wave heights.
wind_wave_direction:
type: array
items:
type: number
format: float
description: List of wind wave directions.
wind_wave_period:
type: array
items:
type: number
format: float
description: List of wind wave periods.
wind_wave_peak_period:
type: array
items:
type: number
format: float
description: List of wind wave peak periods.
swell_wave_height:
type: array
items:
type: number
format: float
description: List of swell wave heights.
swell_wave_direction:
type: array
items:
type: number
format: float
description: List of swell wave directions.
swell_wave_period:
type: array
items:
type: number
format: float
description: List of swell wave periods.
swell_wave_peak_period:
type: array
items:
type: number
format: float
description: List of swell wave peak periods.
daily_units:
type: object
description: Units for current weather variables.
properties:
time:
type: string
description: Format of time.
example: unixtime
wave_height_max:
type: string
description: Unit for wave height.
example: m
wave_direction_dominant:
type: string
description: Unit for wave direction.
example: °
wave_period_max:
type: string
description: Unit for wave period.
example: s
wind_wave_height_max:
type: string
description: Unit for wind wave height.
example: m
wind_wave_direction_dominant:
type: string
description: Unit for wind wave direction.
example: °
wind_wave_period_max:
type: string
description: Unit for wind wave period.
example: s
wind_wave_peak_period_max:
type: string
description: Unit for wind wave peak period.
example: s
swell_wave_height_max:
type: string
description: Unit for swell wave height.
example: m
swell_wave_direction_dominant:
type: string
description: Unit for swell wave direction.
example: °
swell_wave_period_max:
type: string
description: Unit for swell wave period.
example: s
swell_wave_peak_period_max:
type: string
description: Unit for swell wave peak period.
example: s
daily:
type: object
description: Daily weather forecast data.
properties:
time:
type: array
items:
type: integer
description: List of timestamps.
wave_height_max:
type: array
items:
type: number
format: float
description: List of maximum wave heights.
wave_direction_dominant:
type: array
items:
type: number
format: float
description: List of dominant wave directions.
wave_period_max:
type: array
items:
type: number
format: float
description: List of maximum wave periods.
wind_wave_height_max:
type: array
items:
type: number
format: float
description: List of maximum wind wave heights.
wind_wave_direction_dominant:
type: array
items:
type: number
format: float
description: List of dominant wind wave directions.
wind_wave_period_max:
type: array
items:
type: number
format: float
description: List of maximum wind wave periods.
wind_wave_peak_period_max:
type: array
items:
type: number
format: float
description: List of maximum wind wave peak periods.
swell_wave_height_max:
type: array
items:
type: number
format: float
description: List of maximum swell wave heights.
swell_wave_direction_dominant:
type: array
items:
type: number
format: float
description: List of dominant swell wave directions.
swell_wave_period_max:
type: array
items:
type: number
format: float
description: List of maximum swell wave periods.
swell_wave_peak_period_max:
type: array
items:
type: number
format: float
description: List of maximum swell wave peak periods.
'400':
description: Bad request due to invalid parameters.
content:
application/json:
schema:
type: object
properties:
error:
type: boolean
description: Indicates if an error occurred.
example: true
reason:
type: string
description: Description of the error.
example: "Cannot initialize WeatherVariable from invalid String value temperature_2m for key hourly"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment