From afbcedeb8dc954dacb4669f53910a3193e806ec5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 17:37:23 +0100 Subject: [PATCH] Update tutorials from cylc-flow (#2816) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../lib/python/util.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/metomi/rose/etc/tutorial/cylc-forecasting-workflow/lib/python/util.py b/metomi/rose/etc/tutorial/cylc-forecasting-workflow/lib/python/util.py index 6f24b28cb..6450bbc16 100644 --- a/metomi/rose/etc/tutorial/cylc-forecasting-workflow/lib/python/util.py +++ b/metomi/rose/etc/tutorial/cylc-forecasting-workflow/lib/python/util.py @@ -282,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, }