opendrift.models.openoil.adios.models.oil.product_type
Class that represents the product type
With validation
Also maintains the products types and labels mapping
Module Contents
Classes
class to maintain a many to many relationship between product types and labels |
|
str(object='') -> str |
Functions
|
Loads the product types and labels mapping from a CSV file |
Attributes
- class opendrift.models.openoil.adios.models.oil.product_type.TypeLabelsMap(initial_data=None)[source]
Bases:
opendrift.models.openoil.adios.util.many_many.ManyMany
class to maintain a many to many relationship between product types and labels
The
.product_types
attribute is a mapping with the labels as keys, and product types as values.The
.labels
attribute is a mapping with the product type as keys, and the associated labels as values.initialize a ManyMany structure
- Parameters:
initial_data –
initial data for the left dict. of the form: {key1: iterable_of_values,
key2: iterable_of_values, … }
all values must be hashable
- product_types
- labels
- opendrift.models.openoil.adios.models.oil.product_type.load_from_csv_file(filepath=None)[source]
Loads the product types and labels mapping from a CSV file
- Parameters:
filepath=None – The name of the file to load from. If not provided, it will look for: “product_types_and_labels.csv” next to this module
- opendrift.models.openoil.adios.models.oil.product_type.PRODUCT_TYPE_LABEL_MAPPING
- opendrift.models.openoil.adios.models.oil.product_type.PRODUCT_TYPES
- opendrift.models.openoil.adios.models.oil.product_type.types_to_labels
- opendrift.models.openoil.adios.models.oil.product_type.DOESNT_NEED_API
- class opendrift.models.openoil.adios.models.oil.product_type.ProductType[source]
Bases:
str
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
Initialize self. See help(type(self)) for accurate signature.
- _valid_types
- _validator