opendrift.models.openoil.adios.models.oil.oil

Main class that represents an oil record.

This maps to the JSON used in the DB

Having a Python class makes it easier to write importing, validating etc, code.

Module Contents

Classes

Oil

Attributes

ADIOS_DATA_MODEL_VERSION

opendrift.models.openoil.adios.models.oil.oil.ADIOS_DATA_MODEL_VERSION
class opendrift.models.openoil.adios.models.oil.oil.Oil[source]
oil_id: str
adios_data_model_version: opendrift.models.openoil.adios.models.oil.version.Version
metadata: opendrift.models.openoil.adios.models.oil.metadata.MetaData
sub_samples: opendrift.models.openoil.adios.models.oil.sample.SampleList
status: list
permanent_warnings: list
extra_data: dict
review_status: opendrift.models.openoil.adios.models.oil.review_status.ReviewStatus
__post_init__()[source]

Put any validation code here (__init__() is auto-generated by the dataclass decorator, and it will clobber any attempt to overload the __init__.)

__str__()[source]

need a custom str here, so we don’t get a huge dump of the entire tree of data

static _pre_from_py_json(py_json)[source]
classmethod from_file(infile)[source]

load an Oil object from the passed in JSON file

it can be either a path or an open file object

NOTE: this could be in the decorator – but we only really need it

for a full record.

static _validate_id(id)[source]
validate()

validation specific to the Oil object itself

validation of sub-objects is automatically applied

reset_validation()[source]

calls the validate method, and updates the status with the result

to_file(outfile, sparse=True)[source]

save an Oil object as JSON to the passed in file

it can be either a path or a writable open file object

NOTE: this could be in the decorator – but we only really need it

for a full record.