Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,5 @@ def main():


if __name__ == '__main__':
util.sleep()
main()
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def main(forecast_interval, forecast_iterations):


if __name__ == '__main__':
util.sleep()
try:
args = [int(sys.argv[1]), int(sys.argv[2])]
except IndexError:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import re

import requests

import util


BASE_URL = ('http://datapoint.metoffice.gov.uk/public/data/'
'val/wxobs/all/json/{site_id}'
Expand Down Expand Up @@ -215,5 +217,6 @@ def main(site_id, api_key=None):


if __name__ == '__main__':
util.sleep()
main(os.environ['SITE_ID'],
os.environ.get('API_KEY'))
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,5 @@ def main():


if __name__ == '__main__':
util.sleep(2) # make the tutorial run a little slower
main()
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def main(site_name, time):


if __name__ == '__main__':
util.sleep()
try:
args = (sys.argv[1].lower(), int(sys.argv[2]))
except IndexError:
Expand Down
2 changes: 0 additions & 2 deletions metomi/rose/etc/tutorial/cylc-forecasting-workflow/flow.cylc
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!jinja2
[scheduler]
UTC mode = True
[task parameters]
# A list of the weather stations we will be fetching observations from.
station = camborne, heathrow, shetland, aldergrove
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
from copy import copy
from contextlib import suppress
import math
import jinja2
import os
import sys
import time

import jinja2

R_0 = 6371. # Radius of the Earth (km).

Expand Down Expand Up @@ -280,13 +282,18 @@ def __call__(self, grid_x, grid_y):
return z_val


def parse_domain(domain):
bbox = list(map(float, domain.split(',')))
def parse_domain(domain: str):
lng1, lat1, lng2, lat2 = list(map(float, domain.split(',')))
msg = "Invalid domain '{}' ({} {} >= {})"
if lng1 >= lng2:
raise ValueError(msg.format(domain, 'longitude', lng1, lng2))
if lat1 >= lat2:
raise ValueError(msg.format(domain, 'latitude', lat1, lat2))
return {
'lng1': bbox[0],
'lat1': bbox[1],
'lng2': bbox[2],
'lat2': bbox[3]
'lng1': lng1,
'lat1': lat1,
'lng2': lng2,
'lat2': lat2,
}


Expand All @@ -301,3 +308,12 @@ def generate_html_map(filename, template_file, data, domain, resolution):
lat2=domain['lat2'],
data=data
))


def sleep(secs=4):
"""Make the tutorials run a little slower so users can follow along.

(Only if not running in CI).
"""
if 'CI' not in os.environ:
time.sleep(secs)