Closed aidanheerdegen closed 4 years ago
To have a play with the default DB:
from cosima_cookbook import explore
dbx = explore.DatabaseExplorer()
dbx
You can pass a session
to DatabaseExplorer
if you want to test other databases.
This is great!!
OK, I loaded pbot_t
for example but then how can I plot something? Or use this loaded data array?
It says The loaded DataArray is accessible as the data attribute of the ExperimentExplorer object
but when I call
dbx.data
I get
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-13-e641cb6988d1> in <module>
----> 1 dbx.data
AttributeError: 'DatabaseExplorer' object has no attribute 'data'
Btw, this PR definitely it should be definitely accompanied by a Data Exploration Tutorial in cosima-recipes
The child ExperimentExplorer
object of the DatabaseExplorer
is accessible as the .ee
attribute. So in this case the data is accessible as dbx.ee.data
.
It needs documentation for sure, and yes a tutorial would be on the To-Do list.
There is a plan to have a VariableExplorer
which wraps hvplot
, but that might have to wait.
Turns out the issue with widgets popping up where they shouldn't is because I am storing them in a dict
.
https://github.com/jupyter-widgets/ipywidgets/issues/2944
Python is weird sometimes.
Ok, random widgets turning up in weird places is now fixed.
I would like to get this out so people can use it. It would be nice to have more elegant SQL queries to replace the DatabaseExplorer
functionality but I think it would take me too long to figure it out. If you're interested I'm happy to take suggestions @angus-g, or we can go with this and improve it later when more experiments are added the DB and it the length of time to loop over all the experiments becomes too large.
I'll have a quick play with getting the kind of data we want accessible at the ORM level, but I agree that it's better to have something usable rather than fuss over perfection!
I have some ideas of how to change things, but I'm going to merge this first. If they come to fruition, they can come in through a new PR.
ipywidgets for data exploration
Closes #199