Skip to content

Instantly share code, notes, and snippets.

const lat = 45.7;
const lng = -6.0;
const params = [
'airTemperature', 'cloudCover',
'gust', 'humidity', 'precipitation',
'snowDepth', 'visiblity', 'windDirection',
'windSpeed'
].join(',');
fetch(`https://api.stormglass.io/v2/weather/point?lat=${lat}&lng=${lng}&params=${params}`, {
const lat = 45.7;
const lng = -6.0;
fetch(`https://api.stormglass.io/v2/astronomy/point?lat=${lat}&lng=${lng}`, {
headers: {
// Get your key by signing up.
'Authorization': '2c16411d-8f11-4565-98a8-321c4e3eef9c'
}
}).then((response) => response.json()).then((jsonData) => {
// Do something with tide data.
const lat = 45.7;
const lng = -6.0;
const params = [
'secondarySwellDirection', 'secondarySwellHeight', 'secondarySwellPeriod',
'windWaveDirection', 'windWaveHeight', 'windWavePeriod',
'swellDirection', 'swellHeight', 'swellPeriod',
'waveDirection', 'waveHeight', 'wavePeriod',
'windDirection', 'windSpeed', 'gust',
'waterTemperature',
].join(',');
const lat = 45.7;
const lng = -6.0;
const params = [
'currentDirection', 'currentSpeed',
'iceCover', 'seaLevel',
'visiblity', 'waterTemperature',
'windDirection', 'windSpeed' 'gust',
'swellDirection', 'swellHeight', 'swellPeriod',
'waveDirection','waveHeight', 'wavePeriod',
'windWaveDirection', 'windWaveHeight', 'windWavePeriod'
@caalle
caalle / single-extrema.js
Last active March 15, 2020 19:52
Single request tide extremas
const lat = 45.7;
const lng = -6.0;
fetch(`https://api.stormglass.io/v2/tide/extremes/point?lat=${lat}&lng=${lng}`, {
headers: {
// Get your key by signing up.
'Authorization': '2c16411d-8f11-4565-98a8-321c4e3eef9c'
}
}).then((response) => response.json()).then((jsonData) => {
// Do something with tide data.
const lat = 45.7;
const lng = -6.0;
const params = [
'airTemperature',
'pressure',
'cloudCover',
'humidity',
'precipitation',
'visiblity',
'windDirection',
@caalle
caalle / using-the-api.js
Last active March 15, 2020 19:53
Single request all params
const lat = 45.7;
const lng = -6.0;
const params = 'windSpeed,windDirection,airTemperature';
fetch(`https://api.stormglass.io/v2/weather/point?lat=${lat}&lng=${lng}&params=${params}`, {
headers: {
// Get your key by signing up.
'Authorization': '2c16411d-8f11-4565-98a8-321c4e3eef9c'
}
}).then((response) => response.json()).then((jsonData) => {
@caalle
caalle / basic-request.py
Last active March 15, 2020 19:53
Fetch forecast for coordinate
import requests
response = requests.get(
'https://api.stormglass.io/v2/weather/point',
params={
'lat': 58.5,
'lng': 17.8,
'params': 'waveHeight,wavePeriod,swellHeight,swellDirection,windSpeed'
},
headers={
{
"scope": "source.js -string -comment -constant",
"completions": [
{ "trigger": "customtrigger.allowBlank\tBoolean", "contents": "allowBlank: $1${2:,}" },
{ "trigger": "customtrigger.allowOnlyWhitespace\tBoolean", "contents": "allowOnlyWhitespace: $1${2:,}" },
{ "trigger": "customtrigger.blankText\tString", "contents": "blankText: '$1'${2:,}" },
{ "trigger": "customtrigger.checkChangeBuffer\tNumber", "contents": "checkChangeBuffer: $1${2:,}" },
{ "trigger": "customtrigger.checkChangeEvents\tString[]", "contents": "checkChangeEvents: ['$1']${2:,}" },
{ "trigger": "customtrigger.dirtyCls\tString", "contents": "dirtyCls: '$1'${2:,}" },