SeedRateCalculator Object
- Trevor Puckett (Unlicensed)
Supported Councils
MCCC
NECCC
Constructor method
constructor({mix, council, userInput} = {})
This constructs a new instance of the calculator object.
For a more detailed example please visit the demo repo
Example:
// Please see detailed example
// for more information on how these variable can be acquired.
const userInput = {
acres: 50,
plantingDate: '11/27/2021',
soilDrainage: ["Well Drained", "Excessively Drained" ]
// this can also include any of the parameters needed for other functions.
};
const council = 'mccc';
const mix = [crop1, crop2, crop3];
const calculator = new SeedRateCalculator({mix, council, userInput});
Parameters
mix (Array|Object) : Required
The mix parameter should be an array of crops, or a crop object. The crop objects MUST either be an instantiated instance of a Crop Class, or an object containing a valid schema to create an instance of the Crop Class.
council (string) : Required
The council parameter is required, and must be in the list of Supported Councils above. The council is not case sensitive, but must be represented in the acronym format.
userInput (Object) : Optional
The userInput parameter is where you can pass in optional user input parameters to customize the mix.
Returns (Object)
SeedRateCalculator Instance
Planting Method Modifier
plantingMethodModifier(crop, {plantingMethod}={})
Calculates the planting method modifier for a given crop and planting method.
For a more detailed example please visit the demo repo
Example:
// get crop object from species selector service.
const crop = SPECIES_SELECTOR_SERVICE.get(`/v2/crops/{cropID}`,{params: {
regions: [{regionID1},{regionID2}],
context: 'seed_calc',
}});
const calculator = new SeedRateCalculator({mix:[crop],council:'mccc', userInput:{}});
const plantingMethod = 'Drilled';
const plantingMethodModifier = calculator.plantingMethodModifier(crop, {plantingMethod});
Parameters
crop (Object) : Required
The mix parameter should be an array of crops, or a crop object. The crop objects MUST either be an instantiated instance of a Crop Class, or an object containing a valid schema to create an instance of the Crop Class.
plantingMethod (string) : Optional
The planting method can be provided in the userInput in calculator instantiation, or provided to the function directly. If the plantingMethod is not in the userInput object, and also not provided on function call a default plantingMethodModifier will be returned.
Returns (number)
The planting method modifier for the given crop and planting method.