geowatch.utils.reverse_hashid module

Utilities for saving the data that gave rise to particular hash values.

class geowatch.utils.reverse_hashid.ReverseHashTable(type='global')[source]

Bases: object

Make a lookup table of hashes we’ve made, so we can refer to what the heck those directory names mean!

/home/joncrall/data/dvc-repos/smart_expt_dvc/models/fusion/Aligned-Drop4-2022-08-08-TA1-S2-L8-ACC/pred/Drop4_BAS_Continue_10GSD_BGR_V003/Drop4_BAS_Continue_10GSD_BGR_V003_epoch=93-step=48128.pt.pt/Aligned-Drop4-2022-08-08-TA1-S2-L8-ACC_data_vali.kwcoco/predcfg_1c530993/pred.kwcoco.json

Example

>>> from geowatch.utils.reverse_hashid import *  # NOQA
>>> data = {'test': 'data'}
>>> key = ub.hash_data(data)[0:8]
>>> self = ReverseHashTable(type='test-rhash')
>>> self.register(key, data)
>>> self.register('conflict-hash', 'conflict-data1')
>>> self.register('conflict-hash', 'conflict-data2')
>>> full_shelf = self.load()
>>> print('full_shelf = {}'.format(ub.urepr(full_shelf, nl=2)))
load()[source]
register(key, data)[source]
Parameters:
  • key (str) – the hash

  • data (Any) – the hashed data (must be serializable)

classmethod query(key=None, verbose=1)[source]

If the type of the hash is unknown, we can search in a few different locations for it.

geowatch.utils.reverse_hashid.condense_config(params, type, human_opts=None, register=True)[source]

Given a dictionary of parameters and a type, makes a hash of the params prefixes it with a type and ensures it is registered in the global system reverse hash lookup table. Some config parts can be given human readable descriptions.