pandas_openscm.db.backends#
Available back-ends
This is just a shortcut/convenience module
Classes:
| Name | Description |
|---|---|
DataBackendOptions |
A collection of data back-end options |
IndexBackendOptions |
A collection of index back-end options |
Attributes:
| Name | Type | Description |
|---|---|---|
DATA_BACKENDS |
Inbuilt data back-ends |
|
INDEX_BACKENDS |
Inbuilt index back-ends |
DATA_BACKENDS
module-attribute
#
DATA_BACKENDS = DataBackendOptions(
cast(
tuple[tuple[str, type[OpenSCMDBDataBackend]], ...],
(
("csv", CSVDataBackend),
("feather", FeatherDataBackend),
("in_memory", InMemoryDataBackend),
("netCDF", netCDFDataBackend),
),
)
)
Inbuilt data back-ends
INDEX_BACKENDS
module-attribute
#
INDEX_BACKENDS = IndexBackendOptions(
cast(
tuple[tuple[str, type[OpenSCMDBIndexBackend]], ...],
(
("csv", CSVIndexBackend),
("feather", FeatherIndexBackend),
("in_memory", InMemoryIndexBackend),
("netCDF", netCDFIndexBackend),
),
)
)
Inbuilt index back-ends
DataBackendOptions #
A collection of data back-end options
Methods:
| Name | Description |
|---|---|
get_instance |
Get an instance of one of the options |
guess_backend |
Guess backend from a file name |
Attributes:
| Name | Type | Description |
|---|---|---|
options |
tuple[tuple[str, type[OpenSCMDBDataBackend]], ...]
|
Options |
Source code in src/pandas_openscm/db/backends.py
options
instance-attribute
#
options: tuple[tuple[str, type[OpenSCMDBDataBackend]], ...]
Options
The first element of each option is the option's short name. The second element is the class that matches that option.
get_instance #
get_instance(option: str) -> OpenSCMDBDataBackend
Get an instance of one of the options
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
option
|
str
|
Option for which to get a data back-end instance |
required |
Returns:
| Type | Description |
|---|---|
OpenSCMDBDataBackend
|
Initialised instance |
Raises:
| Type | Description |
|---|---|
KeyError
|
The option is not supported |
Source code in src/pandas_openscm/db/backends.py
guess_backend #
guess_backend(data_file_name: str) -> OpenSCMDBDataBackend
Guess backend from a file name
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_file_name
|
str
|
Name of the data file from which to guess the backend |
required |
Returns:
| Type | Description |
|---|---|
OpenSCMDBDataBackend
|
Guessed backend |
Raises:
| Type | Description |
|---|---|
ValueError
|
The backend could not be guessed from |
Source code in src/pandas_openscm/db/backends.py
IndexBackendOptions #
A collection of index back-end options
Methods:
| Name | Description |
|---|---|
get_instance |
Get an instance of one of the options |
guess_backend |
Guess backend from a file name |
Attributes:
| Name | Type | Description |
|---|---|---|
options |
tuple[tuple[str, type[OpenSCMDBIndexBackend]], ...]
|
Options |
Source code in src/pandas_openscm/db/backends.py
options
instance-attribute
#
options: tuple[tuple[str, type[OpenSCMDBIndexBackend]], ...]
Options
The first element of each option is the option's short name. The second element is the class that matches that option.
get_instance #
get_instance(option: str) -> OpenSCMDBIndexBackend
Get an instance of one of the options
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
option
|
str
|
Option for which to get a index back-end instance |
required |
Returns:
| Type | Description |
|---|---|
OpenSCMDBIndexBackend
|
Initialised instance |
Raises:
| Type | Description |
|---|---|
KeyError
|
The option is not supported |
Source code in src/pandas_openscm/db/backends.py
guess_backend #
guess_backend(
index_file_name: str,
) -> OpenSCMDBIndexBackend
Guess backend from a file name
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index_file_name
|
str
|
Name of the index file from which to guess the backend |
required |
Returns:
| Type | Description |
|---|---|
OpenSCMDBIndexBackend
|
Guessed backend |
Raises:
| Type | Description |
|---|---|
ValueError
|
The backend could not be guessed from |