About the general question ( "is there any appetite to formalise these definitions") I cannot answer now, since we have to discuss the issue internally. About using the old XSD I strongly recommend NOT to do that. For instance the XSD
check the coefficients of variations in the vulnerability functions (not all of it):
anycovs = self.covs.any()
for lr, cov in zip(self.mean_loss_ratios, self.covs):
if lr == 0 and cov > 0:
msg = ("It is not valid to define a mean loss ratio = 0 "
"with a corresponding coefficient of variation > 0")
raise ValueError(msg)
if cov < 0:
raise ValueError(
'Found a negative coefficient of variation in %s' %
self.covs)
if distribution == 'BT':
if lr == 0: # possible with cov == 0
pass
elif lr > 1:
raise ValueError('The meanLRs must be 1, got %s' % lr)
elif cov == 0 and anycovs:
raise ValueError(
'Found a zero coefficient of variation in %s' %
self.covs)
elif cov ** 2 > 1 / lr - 1:
raise ValueError(
'The coefficient of variation %s > %s does not '
'satisfy the requirement 0 < < sqrt[ × (1 - )] '
'in %s' % (cov, numpy.sqrt(1 / lr - 1), self))
There are plenty of special rules depending on arrays of coefficients inside the XML.
Moreover the validity of a file depends on other files (example: the logic tree file contains references to other files, the exposure contains references to other files,
etc). The right way to check the validity of the files is to use a command like
$ oq check_input job.ini
that will check all of the files referred to by the job.ini file.
For what concerns example, I would look at the tests, because then you have the guarantee that such examples works and are tested every day.
Just clone the repository and give a
$ find oq-engine/openquake/qa_tests_data/ -name \*.xml
HTH,
Michele