Skip to main content

DSSAT input and output file reader and writer

Project description

traDSSAT

TraDSSAT is a library to easily read and write DSSAT input and output files.

Status

Client Python codecov Documentation Status

Installation

poetry add tradssat or pip install tradssat

Full docs

Read the full thing here.

Citation

If you use traDSSAT, please consider citing this repository until we write a real publication about traDSSAT.

Quick examples

Parse and edit any DSSAT file directly:

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 PC0001

Read, edit and write experiments, with automatic access to referenced external soil, genetic and weather files:

from tradssat import DSSATRun

run = DSSATRun('path/to/my/experiment.EXP')
run.get_trt_val('INGENO', trt=1)  # Get cultivar for treatment 1
run.set_trt_factor_level(trt=1, factor='CULTIVARS', level=2)  # Change level of treatment factor
run.set_factor_level_val('INGENO', 'IB0067', level=1)  # Change value of a factor level (in this case cultivar type)

Access output from a run:

from tradssat import DSSATResults

out = DSSATResults('path/to/my/output/dir')
out.get_value('FWAD', trt=1)

# Get results at specific time (day of year, days after planting or days after start)
out.get_value('FWAD', trt=1, t=13, at='DAS')  # Get result at 13 days after start
out.get_value('FWAD', trt=1, t=13, at='DAP')  # Get result at 13 days after planting
out.get_value('FWAD', trt=1, t='1989 123', at='DOY')  # Get result at 123th day of year 1989

Contributing

Don't forget to add your name to the authors list in the docs/source/acknow.rst file!

Licensing

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tradssat-0.1.10.tar.gz (4.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tradssat-0.1.10-py3-none-any.whl (78.9 kB view details)

Uploaded Python 3

File details

Details for the file tradssat-0.1.10.tar.gz.

File metadata

  • Download URL: tradssat-0.1.10.tar.gz
  • Upload date:
  • Size: 4.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.11.2 CPython/3.10.3

File hashes

Hashes for tradssat-0.1.10.tar.gz
Algorithm Hash digest
SHA256 56b9ca49e591029699fc6db4337fbcbe70f66ebe3dc8c5d59d51452badde6cd3
MD5 16f46648deadd30d75e4929c3c67bbc5
BLAKE2b-256 73a431075903db40fa34044e74654ff336820e716d36da82adde7205e7da58f6

See more details on using hashes here.

File details

Details for the file tradssat-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: tradssat-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 78.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.11.2 CPython/3.10.3

File hashes

Hashes for tradssat-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 1f9046de3ef2a98e050fe4bedfa773a626b26158b842cad1737161a47407b7e8
MD5 594f156d9d1a3fc2037aff38330fe296
BLAKE2b-256 d034e6d3331cef112239986daa2b1f066d219ea69995fafbeea6e1b54a0b9695

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page