NOAA-GFDL / fre-workflows

Code to generate, describe, validate, and configure scientific workflows within the FRE software framework
2 stars 4 forks source link

Validator does not recognize years as being divisible into months #12

Open uwagura opened 3 months ago

uwagura commented 3 months ago

Describe the bug When you try to run fre pp validate with history_segment: P1M and pp_chunk_a: P1Y, you'll get an error that says that pp_chunk_a should be evenly divisible by the size of the history segment

To Reproduce Add the above key value pairs to your pp yaml

Expected behavior The validator should recognize months as being divisible by years and accept PXM as a history segment for any pp chunk of the form PNY if 12*N is divisible by X.

Additional context This issue seems to stem from how the metomi.isodatetime.parser interprets months - it assumes all months are 30 days long, so when we try to check if a year (which metomi interprets as 365 days) is divisible by months, we get false in the following function:

https://github.com/NOAA-GFDL/fre-workflows/blob/c18dedd918a09fef11a24ffcab692ab8d86a3e7b/meta/lib/python/macros/chunkcheck.py#L23-L31

ceblanton commented 3 months ago

Thanks! Completely agree, great catch. @kiihne-noaa started looking at this in #21 and a solution looks straightforward.