ES-DOC / pyessv

Python Earth Science Standard Vocabularies
Other
8 stars 7 forks source link

Validate term name - regex #6

Closed asladeofgreen closed 2 years ago

asladeofgreen commented 7 years ago

If target collection is RegExCollection then validate name against regular expression.

E.G. ensemble-variant: r%(digit)si%(digit)sp%(digit)s Note that the above is not a pure regular expression but an 'ESG' regex, equivalent pure regular expression is: r[0-9]+i[0-9]+p[0-9]+

This is fairly simple as the Collection class can be extended with a regex that is applied at the point of term creation / validation.

asladeofgreen commented 7 years ago

ESG INI patterns:

filenameformat = %(variable)s%(cmortable)s%(model)s%(experiment)s%(ensemble)s[_%(period_start)s-%(period_end)s].nc

directory_format = %(root)s/%(project)s/%(product)s/%(institute)s/%(model)s/%(experiment)s/%(time_frequency)s/%(realm)s/%(cmor_table)s/%(ensemble)s/%(version)s/%(variable)s

dataset_id = cmip5.%(product)s.%(institute)s.%(model)s.%(experiment)s.%(time_frequency)s.%(realm)s.%(cmor_table)s.%(ensemble)s

Become regular expressions:

cmip5.[esgf.global.product].[wcrp.global.institute] ...etc