fsdb_tools
plantdb.commons.fsdb.fsdb_tools Link
add_metadata_to_scan Link
add_metadata_to_scan(db, scan_id, metadata)
Add metadata to a scan dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
db
|
FSDB
|
A local database instance hosting the |
required |
scan_id
|
str
|
The identifier of the |
required |
metadata
|
dict
|
The metadata dictionary to assign to the |
required |
Returns:
Type | Description |
---|---|
Scan
|
The updated |
Examples:
>>> from plantdb.commons.fsdb import dummy_db
>>> from plantdb.commons.fsdb.fsdb_tools import add_metadata_to_scan
>>> db = dummy_db(with_scan=True)
>>> scan = db.get_scan("myscan_001")
>>> print(scan.metadata)
{'test': 1}
>>> scan = add_metadata_to_scan(db, "myscan_001", {"Name": "Example Scan"})
>>> print(scan.metadata)
{'test': 1, 'Name': 'Example Scan'}
>>> db.disconnect() # clean up (delete) the temporary dummy database
Source code in plantdb/commons/fsdb/fsdb_tools.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|