Dataset Writing#
When connected to an ODC Database, these methods are available for adding, updating and archiving datasets:
dc = Datacube()
dc.index.datasets.{method}
|
Add |
|
Add a location to the dataset if it doesn't already exist. |
|
Mark datasets as archived |
|
Archive a location of the dataset if it exists and is active. |
|
Remove a location from the dataset if it exists. |
|
Mark datasets as not archived |
|
Un-archive a location of the dataset if it exists. |
|
Update dataset metadata and location :type dataset: |
The following “high level” API helps you get new datasets into a form ready to pass to the above methods in a particular index.
- class datacube.index.hl.Doc2Dataset(index, products=None, exclude_products=None, fail_on_missing_lineage=False, verify_lineage=True, skip_lineage=False, eo3='auto', home_index=None)[source]#
Used for constructing Dataset objects from plain metadata documents.
This requires a database connection to perform the automatic matching against available products.
There are options for including and excluding the products to match against, as well as how to deal with source lineage.
Once constructed, call with a dictionary object and location URI, eg:
resolver = Doc2Dataset(index) dataset = resolver(dataset_dictionary, 'file:///tmp/test-dataset.json') index.dataset.add(dataset)
- Parameters:
index (
AbstractIndex
) – an open Database connectionproducts (
Sequence
[str
] |None
) – List of product names against which to match datasets (including lineage datasets). If not supplied we will consider all products.exclude_products (
Sequence
[str
] |None
) – List of products to exclude from matchingfail_on_missing_lineage (
bool
) –If True fail resolve if any lineage datasets are missing from the DB
Only False supported if index.supports_external_lineage is True.
verify_lineage (
bool
) –If True, check that lineage datasets in the supplied document are identical to DB versions
Ignored for EO3 documents. Will be dropped in ODCv2 as only eo3 documents will be supported.
skip_lineage (
bool
) – If True, ignore lineage sub-tree in the supplied document and construct dataset without lineage datasets‘auto’/True/False by default auto-detect EO3 datasets and pre-process them
Cannot be ‘False’ if index.supports_legacy is False. Will be dropped in ODCv2 as only eo3 documents will be supported
home_index (
str
|None
) – Ignored if index.supports_exernal_home is False. Defaults to None. Optional string labelling the “home index” for lineage datasets. home_index is ignored if an explicit source_tree is passed to the resolver.