casys.utilities.annex_table

Annex tables management classes.

Functions

normalize_path(path)

Expand and normalize the provided path.

Classes

AnnexTable(name, reference, fields)

AnnexTableManager(location[, reference])

Class allowing to manage writable annex tables.

AnnexTableManagerConfig(reference[, ...])

Field(name[, source, source_aux, subfields, ...])

Field object representing parameters/variables in data sources.

Exceptions

AnnexTableError

Exception raised if an error related to annex table occurs.

class casys.utilities.annex_table.AnnexTable(name, reference, fields)

Bases: object

Parameters:
descriptor(dir_name='Annexes')

Generate the descriptor content of this annex.

Return type:

str

Returns:

Descriptor content.

fields: dict[str, Field]
name: str
reference: str
store_data(data)

Store the provided data into this annex table.

Parameters:

data (Dataset) – Data to store.

exception casys.utilities.annex_table.AnnexTableError

Bases: Exception

Exception raised if an error related to annex table occurs.

add_note(object, /)

Exception.add_note(note) – add a note to the exception

args
with_traceback(object, /)

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class casys.utilities.annex_table.AnnexTableManager(location, reference='/work/ALT/peachi/commun/data/TABLES/DSC/')

Bases: object

Class allowing to manage writable annex tables.

Parameters:
  • location (str)

  • reference (str)

Initialize a writable annex table.

Parameters:
  • location (str) – Location of your annex tables.

  • reference (str) – Location of the reference tables.

annex_table(name)

Return the request annex table.

Parameters:

name (str) – Name of the annex table.

Return type:

AnnexTable

Returns:

Annex table.

create_annex(name, reference, fields)

Create a new annex table.

Parameters:
  • name (str) – Name of the annex table.

  • reference (str) – Name of the reference table.

  • fields (list[Field]) – List of fields to include in the annex table.

remove_annex(name)

Remove the provided annex table data and configuration files.

Parameters:

name (str) – Name of the annex table to remove.

classmethod schema()
Return type:

BaseSchema

store_data(annex, data)

Store the provided data into the annex table. Only fields declared at the annex ta creation are stored.

Parameters:
  • annex (str) – Name of the annex table

  • data (Dataset) – Data to store.

class casys.utilities.annex_table.AnnexTableManagerConfig(reference, annexes=<factory>, field_nb=500000)

Bases: object

Parameters:
annexes: dict[str, AnnexTable]
create_annex(name, reference, fields)

Create a new annex table.

Parameters:
  • name (str) – Name of this annex table.

  • reference (str) – Name of the source of this annex table.

  • fields (list[Field]) – New field contained by this annex.

Return type:

AnnexTable

Returns:

Newly created annex.

field_nb: int = 500000
fields: dict[str, Field]
reference: str
remove_annex(name)

Remove the provided annex table data and configuration files.

Parameters:

name (str) – Name of the annex table to remove.

sources: list[str]