argopy.reference.mapping.ArgoReferenceMapping

argopy.reference.mapping.ArgoReferenceMapping#

class ArgoReferenceMapping(sub: str, obj: str, **kwargs)[source]#

A class to work with Argo Reference Value Relationships, i.e. a NVS “mapping”

More details from the AVTT documentation: OneArgo/ArgoVocabs

> Mappings are used to inform relationship between concepts. For instance, inform all the sensor_models manufactured by one sensor_maker, or all the platform_types manufactures by one platform_maker, etc. > They are used by the FileChecker to ensure the consistency between these metadata fields in the Argo dataset.

Examples

..code-block: python
caption:

Creation

from argopy import ArgoReferenceMapping

# Use two Argo parameter names, documented by one of the Argo reference tables: ArgoReferenceMapping(‘PLATFORM_MAKER’, ‘PLATFORM_TYPE’)

# or reference table identifiers: ArgoReferenceMapping(‘R24’, ‘R23’)

Indexing and values#
from argopy import ArgoReferenceMapping
arm = ArgoReferenceMapping('R24', 'R23')

# Relationships within this reference mapping:
len(arm)     # Number of relationships
arm.subjects   # Ordered list of unique 'subject' reference values names
arm.objects    # Ordered list of unique 'object' reference values names
arm.predicates # Ordered list of unique 'predicate', aka relationships, in this mapping

# Check if a reference value is in this mapping as a subject or an object:
'SBE' in arm  # Return True

# Indexing is by subject values:
arm['SBE']  # Return a dict with predicate as keys and objects as values

# Iterate over all relationships:
for relation in arm:
    print(relation['subject'], relation['predicate'])
Export method#
from argopy import ArgoReferenceMapping
arm = ArgoReferenceMapping('R24', 'R23')

# Export all mapping relationships in a DataFrame:
arm.to_dataframe()

# To export mapping using AVTT jargon:
arm.to_dataframe(raw=True)
__init__(sub: str, obj: str, **kwargs)[source]#

Methods

__init__(sub, obj, **kwargs)

to_dataframe([raw])

Return mapping as a pd.DataFrame

Attributes

sub_id

sub_parameter

obj_id

obj_parameter

nvs

objects

predicates

subjects