argopy.reference.concept.ArgoReferenceValue

argopy.reference.concept.ArgoReferenceValue#

class ArgoReferenceValue(name: str, reference: str | None = None, **kwargs)[source]#

A class to work with an Argo Reference Value, i.e. a NVS vocabulary “concept”

An Argo Reference Value is one possible and documented value for one Argo parameter.

For instance, ‘AANDERAA_OPTODE_3835’ is an Argo Reference Value for the ‘SENSOR_MODEL’ parameter. All other possible values for this parameter are in the Argo reference table 27 for “Argo sensor models” (see ArgoReferenceTable).

Examples

Creation#
from argopy import ArgoReferenceValue

# One possible value for the Argo parameter 'SENSOR_MODEL':
arv = ArgoReferenceValue('AANDERAA_OPTODE_3835')

# For ambiguous value seen in more than one Reference Table
arv = ArgoReferenceValue('4', reference='RT_QC_FLAG')
arv = ArgoReferenceValue('4', reference='RR2')

# From NVS/URN jargon:
arv = ArgoReferenceValue.from_urn('SDN:R27::AANDERAA_OPTODE_3835')
Read attributes#
from argopy import ArgoReferenceValue
arv = ArgoReferenceValue('AANDERAA_OPTODE_3835')

# All possible attributes are listed in:
arv.attrs

# Reference Value attributes (and NVS origin):
arv.name       # nvs["skos:altLabel"] or urnparser(id2urn(nvs["@id"]))["termid"] if altLabel is None
arv.long_name  # nvs["skos:prefLabel"]["@value"]
arv.definition # nvs["skos:definition"]["@value"]
arv.deprecated # nvs["owl:deprecated"]
arv.reference  # The reference table this concept belongs to, can be used with ArgoReferenceTable (eg 'R27')
arv.parameter  # The netcdf parameter this concept applies to, can be used with ArgoReferenceTable (eg 'SENSOR_MODEL')

# Other reference Value attributes (more technical):
arv.version    # nvs["owl:versionInfo"]
arv.date       # nvs["dc:date"]
arv.uri        # nvs["@id"]
arv.urn        # nvs["skos:notation"]

# Relationships with other Reference Values or Context:
arv.broader    # nvs["skos:broader"]
arv.narrower   # nvs["skos:narrower"]
arv.related    # nvs["skos:related"]
arv.sameas     # nvs["owl:sameAs"]
arv.context    # nvs["@context"]

# Extra attributes for R03, R14, R18 values (content curated from the value definition string, see e.g. below)
arv.extra

# Raw NVS json data:
arv.nvs
Extra attributes (R03, R14, R18)#
from argopy import ArgoReferenceValue

# For Values from R03 table
arv = ArgoReferenceValue('BBP470')
arv.extra
arv.extra['Local_Attributes'].long_name
arv.extra['Properties'].category

# For Values from R14 table
arv = ArgoReferenceValue('T000015')
arv.extra
arv.extra['Template_Values'].unit

# For Values from R18 table
arv = ArgoReferenceValue('CB00001')
arv.extra
arv.extra['Template_Values'].short_sensor_name
Export methods#
from argopy import ArgoReferenceValue
arv = ArgoReferenceValue('AANDERAA_OPTODE_3835')

# Export to a dictionary:
arv.to_dict()
arv.to_dict(keys=['name', 'deprecated'])  # Select attributes to export in dictionary keys

# Export to json structure:
arv.to_json()  # In memory
arv.to_json('reference_value.json')  # To a json file
arv.to_json('reference_value.json', keys=['name', 'deprecated'])  # Select attributes to export
__init__(name: str, reference: str | None = None, **kwargs) None[source]#

Methods

__init__(name[, reference])

from_dict([data])

Create a ArgoReferenceValue from a dictionary (JSON-like)

from_urn([urn])

to_dict([keys])

Export reference value attributes to a dictionary

to_json([path, keys])

Export to a JSON string or path

Attributes

name

reference

long_name

definition

deprecated

version

date

uri

urn

parameter

related

broader

narrower

sameas

attrs

Public attributes

context

extra

keys

Attributes used in exporting this reference value

nvs