adios_db.data_sources package
Collection of file readers
Subpackages
- adios_db.data_sources.env_canada package
- adios_db.data_sources.exxon_assays package
- adios_db.data_sources.noaa_fm package
- Submodules
- adios_db.data_sources.noaa_fm.mapper module
OilLibraryAttributeMapper
OilLibraryAttributeMapper.adhesion
OilLibraryAttributeMapper.bulk_composition
OilLibraryAttributeMapper.compounds
OilLibraryAttributeMapper.distillation_data
OilLibraryAttributeMapper.environmental_behavior()
OilLibraryAttributeMapper.filter_weathered_attr()
OilLibraryAttributeMapper.fresh_sample_props
OilLibraryAttributeMapper.generate_sample_id_attrs()
OilLibraryAttributeMapper.industry_properties
OilLibraryAttributeMapper.metadata
OilLibraryAttributeMapper.oil_props
OilLibraryAttributeMapper.physical_properties()
OilLibraryAttributeMapper.py_json()
OilLibraryAttributeMapper.sample()
OilLibraryAttributeMapper.sub_samples
OilLibraryAttributeMapper.weathered_sample_props
- adios_db.data_sources.noaa_fm.parser module
OilLibraryRecordParser
OilLibraryRecordParser.API
OilLibraryRecordParser.SARA
OilLibraryRecordParser.conradson
OilLibraryRecordParser.cut_units
OilLibraryRecordParser.cuts
OilLibraryRecordParser.densities
OilLibraryRecordParser.dynamic_viscosities
OilLibraryRecordParser.emulsions
OilLibraryRecordParser.flash_point
OilLibraryRecordParser.flash_point_max_k
OilLibraryRecordParser.flash_point_min_k
OilLibraryRecordParser.get_property_sets()
OilLibraryRecordParser.interfacial_tension_air
OilLibraryRecordParser.interfacial_tension_seawater
OilLibraryRecordParser.interfacial_tension_water
OilLibraryRecordParser.interfacial_tensions
OilLibraryRecordParser.kinematic_viscosities
OilLibraryRecordParser.name
OilLibraryRecordParser.oil_class
OilLibraryRecordParser.oil_id
OilLibraryRecordParser.pour_point
OilLibraryRecordParser.pour_point_max_k
OilLibraryRecordParser.pour_point_min_k
OilLibraryRecordParser.preferred_oils
OilLibraryRecordParser.product_type
OilLibraryRecordParser.reference
OilLibraryRecordParser.source_id
OilLibraryRecordParser.sulfur
OilLibraryRecordParser.synonyms
OilLibraryRecordParser.toxicities
OilLibraryRecordParser.weathering
- adios_db.data_sources.noaa_fm.reader module
- adios_db.data_sources.noaa_fm.scoring module
ImportedRecordWithScore
ImportedRecordWithScore.aggregate_score()
ImportedRecordWithScore.score()
ImportedRecordWithScore.score_api()
ImportedRecordWithScore.score_cuts()
ImportedRecordWithScore.score_demographics()
ImportedRecordWithScore.score_densities()
ImportedRecordWithScore.score_emulsion_constants()
ImportedRecordWithScore.score_flash_point()
ImportedRecordWithScore.score_interfacial_tensions()
ImportedRecordWithScore.score_pour_point()
ImportedRecordWithScore.score_sara_fractions()
ImportedRecordWithScore.score_toxicities()
ImportedRecordWithScore.score_viscosities()
Submodules
adios_db.data_sources.importer_base module
- class adios_db.data_sources.importer_base.ImporterBase
Bases:
object
Only things that are common to all importer modules
- deep_get(obj, attr_path, default=None)
- deep_set(obj, attr_path, value)
Navigate a period (‘.’) delimited path of attribute values into the oil data structure and set a value at that location in the structure.
Example paths:
sub_samples.0.metadata.sample_id
(sub_samples is assumed to be a list, and we go to the zero index for that part)physical_properties.densities.-1
(densities is assumed to be a list, goes to the last item)physical_properties.densities.+
(appends an item to the densities list and goes to that part. the index value is assumed to be -1 in this case)
- is_int(value)
- slugify(label)
Generate a string that is suitable for use as an object attribute.
The strings will be snake-case, all lowercase words separated by underscores.
They will not start with a numeric digit. If the original label starts with a digit, the slug will be prepended with an underscore (‘_’).
Note: Some unicode characters are not intuitive. Specifically, In German orthography, the grapheme ß, called Eszett or scharfes S (Sharp S). It looks sorta like a capital B to English readers, but converting it to ‘ss’ is not completely inappropriate.
- adios_db.data_sources.importer_base.date_only(func)
- adios_db.data_sources.importer_base.join_with(separator)
Class method decorator to join a list of labels with a separator
- adios_db.data_sources.importer_base.parse_single_datetime(date_str)
- adios_db.data_sources.importer_base.parse_time(func)
Class method decorator to parse an attribute return value as a datetime
- Note: Apparently there are a few records that just don’t have
a sample date. So we can’t really enforce the presence of a date here.
- Note: The April 2020 Env Canada datasheet has much more consistent
date formats, but there are still some variations. Some formats that I have seen: - YYYY-MM-DD # most common - YYYY # 2 records - YYYY-MM # 5 records
Fortunately, dateutil will handle these without problems
adios_db.data_sources.mapper module
- class adios_db.data_sources.mapper.MapperBase
Bases:
ImporterBase
- compound(name, measurement, method=None, groups=None, sparse=False)
Example of content:
{ 'name': "1-Methyl-2-Isopropylbenzene", 'method': "ESTS 2002b", 'groups': ["C4-C6 Alkyl Benzenes", ...], 'measurement': { value: 3.4, unit: "ppm", unit_type: "Mass Fraction", replicates: 3, standard_deviation: 0.1 } }
- measurement(value, unit, unit_type=None, standard_deviation=None, replicates=None)
- min_max(value)
- classmethod slugify(label)
Generate a string that is suitable for use as an object attribute.
The strings will be snake-case, all lowercase words separated by underscores.
They will not start with a numeric digit. If the original label starts with a digit, the slug will be prepended with an underscore (‘_’).
Note: Some unicode characters are not intuitive. Specifically, In German orthography, the grapheme ß, called Eszett or scharfes S (Sharp S). It looks sorta like a capital B to English readers, but converting it to ‘ss’ is not completely inappropriate.
Note: this function is duplicated in the mapper. Perhaps a base class to all the importer types.
adios_db.data_sources.parser module
- class adios_db.data_sources.parser.ParserBase(values)
Bases:
ImporterBase
Only things that are common to all parsers
adios_db.data_sources.reader module
Base classes for various different readers that we may want to use.
- class adios_db.data_sources.reader.CsvFile(name, field_delim=',', encoding='mac_roman')
Bases:
object
A generalized file reader for comma separated variables (.csv) flat datafiles. In spite of its name, this type of file can have various different separating characters besides commas for its rows and fields.
- convert_field(field)
Convert data fields to numeric if possible
- convert_fields(row)
- export(filename)
- init_field_names()
- readline()
- readlines()
- rewind()