@@ -490,6 +490,54 @@ def inspect(self, file=None, issue_handling="print"):
490490 # output to console
491491 print (info_str )
492492
493+ @property
494+ def convention_status (self ):
495+ """
496+ Get the status of the SOFA convention.
497+
498+ Returns
499+ -------
500+ status : str
501+ The status of the SOFA convention
502+
503+ - ``'current'`` if the convention is up to date.
504+ - ``'deprecated'`` if the convention is outdated. In this case
505+ :py:func:`~upgrade` can be used to upgrade the data to the latest
506+ version of the convention.
507+ - ``'preliminary'`` if the convention is still under development
508+ and not contained in the official SOFA standard, which is
509+ indicated by a version number smaller than 1.0. Note that
510+ preliminary conventions may be subject to change or could be
511+ discarded completely. Data written with preliminary conventions
512+ might thus become invalid in the future.
513+ """
514+
515+ status = None
516+
517+ # get deprecations and information about Sofa object
518+ _ , _ , deprecations , upgrade = self ._verification_rules ()
519+ convention = self .GLOBAL_SOFAConventions
520+ version = self .GLOBAL_SOFAConventionsVersion
521+
522+ # conventions can be completely deprecated or upgradable to a later
523+ # version of the same convention or to a later convention
524+ if convention in deprecations ["GLOBAL:SOFAConventions" ]:
525+ status = 'deprecated'
526+ elif convention in upgrade :
527+ for from_to in upgrade [convention ]["from_to" ]:
528+ if version in from_to [0 ]:
529+ status = 'deprecated'
530+ break
531+ # conventions are preliminary if they are not deprecated and have a
532+ # version number < 1.0
533+ if status is None and parse (version ) < parse ('1.0' ):
534+ status = 'preliminary'
535+ # if both is not the case, the convention is current.
536+ if status is None :
537+ status = 'current'
538+
539+ return status
540+
493541 def add_missing (self , mandatory = True , optional = True , verbose = True ):
494542 """
495543 Add missing data with default values.
0 commit comments