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 blocks
blocks = get_valid_blocks(seq,repeat=False,max_rot_size=3)

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

# Get rotation tokens
gr_tok = block2token(seq,gr)
fo_tok = block2token(seq,fo)
lr_tok = block2token(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.1.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.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cyclic_crop_rotation-2025.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 39b526a3f87d2b154d05b2743af882eeb22cd41a9488ff5725bac1b3c67122c3
MD5 b7522688f72b2a2998a8020d8cf051f7
BLAKE2b-256 733c531495ab59f30517d51c3cbb84d9876d823ec422b4a9757df76ecdb7f657

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cyclic_crop_rotation-2025.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 df1dd079e1f0b9e0d898319b3b41add745d8b10dbcc05d94aba3b9ce2acfbfb6
MD5 6914ef792d38c47f16001ae194896a2a
BLAKE2b-256 3f104050f4edaf6e506fe22bd567ddcb422f140d42656f48e7b2db423a8abd23

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