MetOffice / CSET

Toolkit for evaluation and investigation of numerical models for weather and climate applications.
https://metoffice.github.io/CSET/
Apache License 2.0
11 stars 4 forks source link

Error using a period within Cylc cyling task names #775

Open jwarner8 opened 2 months ago

jwarner8 commented 2 months ago

Describe the bug

Many recipes involving looping over variables or model levels to produce numerous plots. If we are iterating over values that include periods, etc. model half levels [0.5,1.5,2.5], parsing these values and creating a unique tasks in the Cylc workflow causes an error and the workflow fails to validate. This is because tasks would be named, for example, plot[var][modellev] would become plot_airtempertaure_0.5.

A possible solution for floats would be to parse '.' as 'p', etc. 0.5 -> 0p5. I can't think of any cases where variable names would involve periods,

How to reproduce

Steps to reproduce the behaviour:

1. 2. 3.

Expected behaviour

Environment

jwarner8 commented 2 months ago

Testing solution which uses jinja2 parsing, etc. {% set level = 1.2 %} {% set formatted_level = level|string|replace('.', 'p') %}

jfrost-mo commented 2 months ago

One of my questions for the cylc surgery this afternoon is what characters are allowed in task names. After that, replacing invalid characters sounds like a sensible plan.

jfrost-mo commented 2 months ago

The allowed task names are documented here: https://cylc.github.io/cylc-doc/stable/html/user-guide/writing-workflows/runtime.html#cylc.flow.unicode_rules.TaskNameValidator