Démarrage rapide¶
Installation¶
- traDSSAT nécessite
numpy
etchardet
. Vous pouvez l’installer de pip avec: - pip install tradssat
- Vous pouvez aussi installer la version en développement la plus récente directement de GitHub avec :
- pip install git+git://github.com/julienmalard/tradssat.git@master
Vous aurez besoin d’une installation locale de DSSAT pour utiliser les gestionnaires de fichier de l’interface de haut niveau (parce que ceux-ci devront pouvoir localiser les fichiers de sol et météo, parmi autres, dans le dossier d’installation de DSSAT). TraDSSAT devrait pouvoir trouver votre installation de DSSAT par elle-même, mais si elle a besoin d’aide vous pouvez la spécifier avec :
from tradssat import set_dssat_dir
set_dssat_dir('C:/My/odd/path/to/DSSAT47')
Un exemple rapide¶
from tradssat import SoilFile, WTHFile, ExpFile, set_dssat_dir
from tradssat import GeneticMgr, CULFile, ECOFile
# Read, edit and write soil files
soil = SoilFile('path/to/my/file.SOL')
# Read and write weather files as well
wth = WTHFile('path/to/my/WTHR0001.WTH')
# ...and experiment files!
exp = ExpFile('path/to/my/experiment.EXP')
# Access genetic coefficients by cultivar file or ecotype file
cul = CULFile('path/to/my/MZIXM.CUL')
eco = ECOFile('path/to/my/MZIXM.ECO')
cul.get_value('P1') # returns array of all varieties' P1
eco.get_value('TOPT') # returns array of all ecotypes' TOPT
# ...or automagically!
set_dssat_dir('C:/DSSAT47')
gen = GeneticMgr(crop='MZIXM', cult='PC0001')
gen.get_value('P1') # Returns P1 for MZIXM cultivar PC0001
gen.get_value('TOPT') # Returns ecotype variable TOPT for cultivar PC001