You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NCAS-CMS/cf-python#197 has highlighted that cfdm as-is is not able to interpret as definite field(s) some cases of CDL inputs which provide only schema and/or coordinate information, e.g. as produced from a ncdump -h or ncdump -c. We realised it may not in fact be possible given the nature of the CF data model to unambiguously map CDL with metadata but no data arrays provided onto fields, though we aren't certain.
The direct problem resulting from this is that such missing data is not accounted for so errors may emerge when such CDLis read-in.
Long-term solution
Ultimately we should:
determine whether header- and coordinate-based CDL can be mapped conclusively to field constructs,
a) if so, adapt the logic so that missing data is dealt with appropriately and does not emerge downstream as errors for reading of such CDL, both here in standalone cfdm or indeed in dependencies like cf-python, like as for NumPy MaskError with read-in of header-info CDL cf-python#197;
b) if not so, decide on the best approach for a result of reading in such CDL, whether that is to provide some sensible "best guess" field encapsulating the known information, or to tell users via appropriate error message that the CDL can't be read-in as fields for these reasons.
Short-term fix
For the forthcoming release, to address NCAS-CMS/cf-python#197, I am catching the MaskErrors to raise them as a user-friendly message stating that the CDL metadata is insufficient for conversion to field constructs, i.e. assuming case (b) and raising a ValueError. This is sufficient for the release but should be re-evaluated in the longer term.
Even if we end up going with this approach after the review, I would like to create a custom error class to raise for related errors, rather than using a Python built-in Exception.
The text was updated successfully, but these errors were encountered:
NCAS-CMS/cf-python#197 has highlighted that
cfdm
as-is is not able to interpret as definite field(s) some cases of CDL inputs which provide only schema and/or coordinate information, e.g. as produced from ancdump -h
orncdump -c
. We realised it may not in fact be possible given the nature of the CF data model to unambiguously map CDL with metadata but no data arrays provided onto fields, though we aren't certain.The direct problem resulting from this is that such missing data is not accounted for so errors may emerge when such CDLis read-in.
Long-term solution
Ultimately we should:
b) if not so, decide on the best approach for a result of reading in such CDL, whether that is to provide some sensible "best guess" field encapsulating the known information, or to tell users via appropriate error message that the CDL can't be read-in as fields for these reasons.
Short-term fix
For the forthcoming release, to address NCAS-CMS/cf-python#197, I am catching the
MaskError
s to raise them as a user-friendly message stating that the CDL metadata is insufficient for conversion to field constructs, i.e. assuming case (b) and raising aValueError
. This is sufficient for the release but should be re-evaluated in the longer term.Even if we end up going with this approach after the review, I would like to create a custom error class to raise for related errors, rather than using a Python built-in Exception.
The text was updated successfully, but these errors were encountered: