Skip to content

tcztzy/cotton2k

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cotton2K Simulation Model

Rust Python License

Cotton2K is a cotton simulation model specially adapted for irrigated cotton production in arid regions. It was originally written by Prof. Avishalom Marani and has been rewritten in Rust with Python bindings.

Features

  • High-performance cotton growth simulation
  • Native Rust implementation with Python bindings
  • TOML/JSON configuration format
  • CSV output format
  • Cross-platform support

Usage

As a Rust Library

Add to your Cargo.toml:

[dependencies]
cotton2k = { git = "https://github.com/tcztzy/cotton2k" }

As a Python Package

Install from PyPI:

pip install cotton2k

Or install locally:

cd bindings/python
pip install .

Example usage:

import cotton2k as c2k

# Run simulation with profile file
c2k.run("path/to/profile.toml")

Requirements

  • Rust 1.70+ (for Rust usage)
  • Python 3.8+ (for Python bindings)
  • C++ compiler (temporary, during transition from C++ to Rust)

Building

Build Rust library:

cargo build --release

Build and install Python bindings:

cd bindings/python
maturin develop --release

Roadmap

  • Complete Rust migration
  • GUI interface
  • Improved documentation
  • SWAP model integration

License

This project is licensed under:

  • MIT License for the Rust implementation
  • Original Cotton2K by Marani remains under GPLv2

Contributing

Contributions are welcome! Please open an issue or submit a pull request.