Skip to main content

Cyclic crop rotations labeling for crop sequences

Project description

Cyclic Crop Rotation

Description

This package implements a method to calculate crop rotation labels from any given sequence.

Installation

pip install cyclic-crop-rotation

Simple usage

See example folder for more complex use cases.

from cyclic_crop_rotation import *

# Crop Sequence
seq = (1,  5,  1,  5,  5,  1,  5,  1)

# Valid words
words = get_valid_words(seq,repeat=False,max_syl=3)

# Select out of the valid words the ones to use
gr = post_selection(greedy_set_cover(words)) 
fo = post_selection(first_observed_cover(words)) 
lr = post_selection(longest_repetition_cover(words)) 

# Get rotation tokens
gr_tok = word2token(seq,gr)
fo_tok = word2token(seq,fo)
lr_tok = word2token(seq,lr)

print(seq)
# Print reordered tokens
print(f'Greedy:{[token2standardtoken(i) for i in gr_tok]}')
print(f'1st Obs:{[token2standardtoken(i) for i in fo_tok]}')
print(f'Long Rep:{[token2standardtoken(i) for i in lr_tok]}')

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

cyclic_crop_rotation-2025.0.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

cyclic_crop_rotation-2025.0.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file cyclic_crop_rotation-2025.0.0.tar.gz.

File metadata

  • Download URL: cyclic_crop_rotation-2025.0.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for cyclic_crop_rotation-2025.0.0.tar.gz
Algorithm Hash digest
SHA256 44aaa82dde620c121294251643ea7e9218a9d277f2e5096c809236a30d77ceb6
MD5 f2b31c7fa2c25d1e7d796aa428d84693
BLAKE2b-256 fb5309a304538e519bf5c9f43cf56d7bc74e51de465997780094949b3c8808d4

See more details on using hashes here.

File details

Details for the file cyclic_crop_rotation-2025.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cyclic_crop_rotation-2025.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c454740b7c81aadf3c98a939b6e2338f03f21ac0acc64a4eb80bea05b16a2d8
MD5 9283347935dabc65289f5b2b9d74ca20
BLAKE2b-256 eb15572a2b3076a66b78b0c9400caa5caa16ba9741d2f2ee8117336e95454b89

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