datreant / datreant.data

convenient data storage and retrieval in HDF5 for Treants
http://datreant.org/
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Direct access to data file path #12

Open jbarnoud opened 8 years ago

jbarnoud commented 8 years ago

Data are stored in HDF5 or pickle files. As suggested in #11, it would be convenient to have a method to get the path to the file where a data is stored from the key of that data.

The method would be used in that way:

t = Treant('baobab')
t.data['mydata'] = np.arange(5)
path = t.filepath('mydata')

Having simple access to the path also give access to the file file system properties such as the date of last modification (see #11).

jbarnoud commented 8 years ago

I cannot assign myself, but I'll try to take care of this in a not to distant future.

dotsdl commented 8 years ago

No problem @jbarnoud. Thanks! Let me know if you want some guidance on how to go about this, but the best way forward is to probably dig around the codebase of datreant.data yourself and see how the data limb already identifies the data files inside a file tree.

dotsdl commented 8 years ago

Just had a quick look. Probably the best way to do this is to simply use Data._get_datafile internally inside Data.filepath. It will be a one-liner to get what you want in this way.