Home | Download/Install | Documentation | Packages | Screenshots | News | Forum/Mailing-lists | Contact | GForge

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

documentation:package:how_to_manage_data [2012/05/22 16:07]
user
documentation:package:how_to_manage_data [2012/06/25 18:18] (current)
user [Access to these data files from Python interpreter]
Line 9: Line 9:
 If you want to start directly with a real example, download the [[packages:template:starter:starter|starter]] package. If you want to start directly with a real example, download the [[packages:template:starter:starter|starter]] package.
  
-===== Add a data directory to your package  =====+===== How to manage data stored in shared data directory =====
  
-Create shared directory in the package layout: +==== Add data directory to your package  ====
-    # exemple: mkdir share/data+
  
-Move all the data in this directory +  - Create a shared directory in the package layout: ''mkdir -p share/data'' 
-    # mv or svn mv +  - Move all the data in this directory: ''mv my_data share/data/'' 
 +  - Modify the ''setup.py'': ''share_dirs = {'share':'share'}'' 
 +  - Install the package: ''python setup.py develop'' 
 +     
 +==== Access to these data files from Python interpreter ====
  
-Modify the setup.py+For example, to access the shared data file ''meri1.his'' of ''openalea.stat_tool'' package: 
 +<code python> 
 +import openalea.stat_tool 
 +from openalea.deploy.shared_data import shared_data 
 +data_filepath = shared_data(openalea.stat_tool, 'meri1.his') 
 +data_files = shared_data(openalea.stat_tool, pattern='*.his') # return a list 
 +</code> 
 +See ''openalea.deploy.shared_data.get_shared_data_path'' documentation for other possibilities
  
-    share_dirs {'share':'share'}+==== Access to these data files from Visualea  ====
  
-Install the package  +The node SharedDataBrowser is used to select a data file.
-    python setup.py develop +
-     +
-===== How to access to these data files  =====+
  
-<code python> from openalea.deploy import shared_data+{{:documentation:package:shareddatabrowser.png?300|}}
  
 +See ''openalea.misc_wralea.shared_data'' documentation for more details. 
 +
 +Here is a dataflow example using this node:
 +
 +{{:documentation:package:shareddatabrowser_test.png?300|}}
 +
 +This dataflow can be found at ''openalea.misc.test.shared_data_browser''
 +
 +===== How to manage data stored as a Visualea Data File node =====
 +
 +==== Import data from file ====
 +
 +  - Select **Package Manager** => **Add** => **Data File**
 +  - Fill the form: 
 +    * **Package** : the package where the Data File node is stored ; e.g. alinea.adel.data
 +    * **File** : path to your data file ; e.g. /home/user/openaleapkg/adel/adel/data/adel_input.csv
 +    * **Decription** : the description displayed in the help view when the Data File node is selected ; e.g. adel input data example
 +  - Click "OK"
 +{{:documentation:package:importadeldata.png?300|}}
 +
 +==== Access to these data files from Python interpreter ====
 +
 +For example, to access the shared data file ''filterT.can'' of ''alinea.caribu.data'' package:
 +<code python>
 +from openalea.core.system import systemnodes
 +data = systemnodes.get_data('filterT.can', 'alinea.caribu.data')
 +data_filepath = data.get('filterT.can')
 </code> </code>
 +See ''openalea.core.system.systemnodes.get_data'' documentation for other possibilities. 
 +
 +==== Access to these data files from Visualea  ====
 +
 +The node ''get_data'' is used to select a data file.
 +
 +{{:documentation:package:get_data.png?300|}}
 +
 +See ''openalea.datafile.datafile.GetData'' documentation for more details. 
  
-===== How to access to these data files in Visualea  =====+For example, the previous state of the ''Tutorial'' composite node of the alinea.caribu package was:
  
-The node SharedDataBrowser is used to select....+{{:documentation:package:caribu_tutorial_previous.png?|}}
  
-# image of the node +Using the ''get_data'' node makes the selection of a data file easier:
  
-Dataflow example using this node+{{:documentation:package:caribu_tutorial_new.png?|}}
  
  
 
documentation/package/how_to_manage_data.1337695664.txt.gz · Last modified: 2012/05/22 16:07 by user   Back to top
INRIA   INRA     CIRAD     AGROPOLIS
INRIA GForge RSS feed Valid XHTML 1.0 Valid CSS Driven by DokuWiki