Dataset class

The Dataset class is a helper class to store information about datasets in the GWLandscape database. They can be created, updated, deleted and obtained using the GWLandscape class.

class gwlandscape_python.dataset_type.Dataset(client, dataset_id, publication, model)

Bases: gwdc_python.objects.base.GWDCObjectBase

Dataset class is useful for interacting with the Datasets returned from a call to the GWCloud API. It is primarily used to update the parameters and obtain files related to the dataset.

Parameters
  • client (GWLandscape) – A reference to the GWLandscape object instance from which the Dataset was created

  • dataset_id (str) – The id of the Dataset, required to obtain the files associated with it

  • publication (Publication) – The publication with which the dataset is associated

  • model (Model) – The model with which the dataset is associated

FILE_LIST_FILTERS = {'data': <function data_filter>}
delete()

Remove this Dataset from the GWLandscape database

get_data_file_list()

Get information for the data files associated with this GWDCObjectMeta

Returns

Contains FileReference instances holding information on the data files

Return type

FileReferenceList

get_data_files()

Download the content of all the data files.

WARNING: As the file contents are stored in memory, we suggest being cautious about the size of files being downloaded. If the files are large or very numerous, it is suggested to save the files and read them as needed instead.

Returns

List containing tuples of the file path and associated file contents

Return type

list

save_data_files(root_path)

Download and save the data files.

Parameters

root_path (str or Path) – The base directory into which the files will be saved

update(publication=None, model=None)

Update a Dataset in the GWLandscape database

Parameters
  • publication (Publication, optional) – The new Publication, by default None

  • model (Model, optional) – The new Model, by default None

Returns

Updated Dataset

Return type

Dataset