Documentation ¶
Index ¶
- func NASSCropMap() map[string]Crop
- func NewProductionFunction(mcfp []float64, mclp []float64, mfc []float64, cs CropSchedule, hc float64, ...) productionFunction
- type Crop
- func (c Crop) Compute(event hazards.HazardEvent) (consequences.Result, error)
- func (c Crop) GetCropID() byte
- func (c Crop) GetCropName() string
- func (c Crop) GetTotalMarketValue() float64
- func (c Crop) GetX() float64
- func (c Crop) GetY() float64
- func (c Crop) Location() geography.Location
- func (c *Crop) WithCropSchedule(cs CropSchedule) Crop
- func (c *Crop) WithLocation(xloc float64, yloc float64) Crop
- func (c *Crop) WithLossFunction(lf DamageFunction) Crop
- func (c *Crop) WithOutput(cropYeild float64, price float64) Crop
- func (c *Crop) WithProductionFunction(pf productionFunction) Crop
- type CropDamageCase
- type CropSchedule
- type CropType
- type DamageFunction
- type Substitute
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NASSCropMap ¶
NASSCropMap is a map of Crops to NASS Crop ID #s
func NewProductionFunction ¶
func NewProductionFunction(mcfp []float64, mclp []float64, mfc []float64, cs CropSchedule, hc float64, latePlantingLoss float64) productionFunction
NewProductionFunction is the constructor for the unexported productionFunction which represents the costs associated with producing a crop
Types ¶
type Crop ¶
type Crop struct { SubstituteCrop Substitute // contains filtered or unexported fields }
Crop describes a crop that can be used to compute agricultural consequences
func ReadFromXML ¶
ReadFromXML reads crop schedules loss functions and production functions from xml (HEC-FIA format)
func (Crop) Compute ¶
func (c Crop) Compute(event hazards.HazardEvent) (consequences.Result, error)
Compute implements concequence.Receptor on crop
func (Crop) GetCropName ¶
GetCropName fulfils the crops.CropType interface
func (Crop) GetTotalMarketValue ¶
GetTotalMarketValue returns crop.totalMarketValue
func (*Crop) WithCropSchedule ¶
func (c *Crop) WithCropSchedule(cs CropSchedule) Crop
WithCropSchedule allows the setting of the cropschedule
func (*Crop) WithLocation ¶
WithLocation allows the construction of a location on a crop
func (*Crop) WithLossFunction ¶
func (c *Crop) WithLossFunction(lf DamageFunction) Crop
WithLossFunction allows the setting of the loss function
func (*Crop) WithOutput ¶
WithOutput allows the setting of the yeild per acre and price per unit of output and resulting value per output
func (*Crop) WithProductionFunction ¶
WithProductionFunction allows the setting of the production function
type CropDamageCase ¶
type CropDamageCase byte
CropDamageCase provides a structured response for the possible outcomes from CropSchedule
const ( Unassigned CropDamageCase = 0 Impacted CropDamageCase = 1 NotImpactedDuringSeason CropDamageCase = 2 PlantingDelayed CropDamageCase = 4 NotPlanted CropDamageCase = 8 SubstituteCrop CropDamageCase = 16 )
CropDamageCases include Unassigned, Impacted, NotImpactedDuringSeason, PlantingDelayed, NotPlanted, or SubstituteCrop
func (CropDamageCase) String ¶
func (cdc CropDamageCase) String() string
type CropSchedule ¶
type CropSchedule struct { StartPlantingDate time.Time LastPlantingDate time.Time DaysToMaturity int }
CropSchedule stores the start and end of planting season, and time to maturity in days
func (CropSchedule) ComputeCropDamageCase ¶
func (cs CropSchedule) ComputeCropDamageCase(h hazards.ArrivalandDurationEvent) CropDamageCase
ComputeCropDamageCase evaluates a crop schedule against a hazard arrival and duration to determine impact on the crop season.
type CropType ¶
CropType describes the relationship of the byte value in a NASSCDL to the Crop name (crop category in their terminology)
type DamageFunction ¶
type DamageFunction struct {
DurationDamageCurves map[float64][]float64 //[days]][]damages by month in percents
}
DamageFunction manages the methodology for computing damages to crops based on a duration and seasonal damage curves
func (DamageFunction) ComputeDamagePercent ¶
func (df DamageFunction) ComputeDamagePercent(h hazards.ArrivalandDurationEvent) float64
ComputeDamagePercent takes an input Arrival time and duration based event and produces a duration damage based on the season of the start of the impact.
type Substitute ¶
type Substitute struct {
// contains filtered or unexported fields
}