hermes

package module
v0.0.0-...-4371edf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: MPL-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const Modfil = "modinp.txt"

Modfil default module filename

Variables

This section is empty.

Functions

func AskDirectory

func AskDirectory() string

AskDirectory returns the current directory

func CalculateDayLenght

func CalculateDayLenght(tag float64, lat float64) (DL, DLE, DLP, EXT, RDN, DRC, DEC float64)

CalculateDayLenght calculate day lenght, effective day lenght(DLE, DLP), extra terrestial Radiation DL - day lenght (h) DLE - effective day lenght (h) DLP - effective day lenght (h) EXT - extra terrestrial radiation (MJ m-2) RDN - average photosynthetic active radiation (J m-2) DRC - radiation on a clear day (J m-2) DEC - declination

func CalculatePoreSpace

func CalculatePoreSpace(bulkDensity float64) float64

CalculatePoreSpace calculate pore volume from bulk density

func CalculatePoreSpacePTF1

func CalculatePoreSpacePTF1(CGehalt, Ton, Sluf, BD, tsRat float64) float64

func CalulateDevelopmentStages

func CalulateDevelopmentStages(zeit int, FV, FP float64, g *GlobalVarsMain)

CalulateDevelopmentStages for wheat

func DateConverter

func DateConverter(splitCenturyAt int, dateformat DateFormat) func(string) (ztDat, masDat int)

DateConverter get a function that calculates (ztDat = day of the year) and (masDat = total days since 01.01.1901)

func Denitmo

func Denitmo(g *GlobalVarsMain)

Denitmo Denitrification for marsh land soils

func Denitr

func Denitr(g *GlobalVarsMain, thetasatFromPorges bool)

Denitr Denitrification

func DumpStructToFile

func DumpStructToFile(filename string, global interface{})

DumpStructToFile debug dump global variables to a file

func DumpWeatherDataToFile

func DumpWeatherDataToFile(filename string, s *WeatherDataShared)

func Evatra

func Evatra(l *WaterSharedVars, g *GlobalVarsMain, hPath *HFilePath, zeit int)

Evatra handles evapotansiration and hydrological processes in soil

func Explode

func Explode(str string, seperator []rune) (result []string)

Explode splits a string by a set of seperator runes

func ExtractMeasuredDataCSV

func ExtractMeasuredDataCSV(scannerObserv *bufio.Scanner, g *GlobalVarsMain, Fident string, obs string)

func ExtractMeasuredDataTxt

func ExtractMeasuredDataTxt(scannerObserv *bufio.Scanner, g *GlobalVarsMain, Fident string, obs string)

func FinalDungPrognose

func FinalDungPrognose(g *GlobalVarsMain) (NAPP int)

FinalDungPrognose last step for fertilization recommendation

func FindTextureInHypar

func FindTextureInHypar(textureIn, hyparName string) string

func FindTextureInPARCAP

func FindTextureInPARCAP(textureIn, filepath string) string

func GetGroundWaterLevel

func GetGroundWaterLevel(g *GlobalVarsMain, date int) (float64, error)

GetGroundWaterLevel returns ground water level for a given date if no ground water level is found, a ground water level is calculated from the previous and next date

func HasPrefixWithSeperator

func HasPrefixWithSeperator(s, prefix string) bool

func Hydro

func Hydro(las1 int, g *GlobalVarsMain, local *InputSharedVars, hPath *HFilePath)

Hydro reads hydro parameter

func Init

func Init(g *GlobalVarsMain)

Init adopts the start conditions

func Input

func Input(l *InputSharedVars, g *GlobalVarsMain, hPath *HFilePath, driConfig *Config, soilID, gwId string) error

Input modul for reading soil data, crop rotation, cultivation data (Fertilization, tillage) of fields and ploygon units

func KalenderConverter

func KalenderConverter(dateformat DateFormat, seperator string) func(int) string

KalenderConverter function to convert internal date format into string

func KalenderDate

func KalenderDate(MASDAT int) (year, month, day int)

KalenderDate get year, month, day from MASDAT( = total days since 1900)

func LangTagConverter

func LangTagConverter(century int, dateFormat DateFormat) func(float64, string, int) (int, int, int)

LangTagConverter get function to get 14h and 16h Day in respect to latitude

func Limit

func Limit(val, upper, lower float64) float64

Limit a value to upper and lower bounds(inclusive)

func LineInut

func LineInut(scanner *bufio.Scanner) (line string)

LineInut read next line from bufio.Scanner

func LoadYear

func LoadYear(g *GlobalVarsMain, s *WeatherDataShared, year int) error

LoadYear loads weather data from WeatherDataShared of a given year into global GlobalVarsMain

func MakeDir

func MakeDir(outPath string)

create directory if file does not exist

func NextLineInut

func NextLineInut(idIdx int, scanner *bufio.Scanner, splitFunc func(string) []string) (id string, tokens []string, valid bool)

func Nitro

func Nitro(wdt float64, subd int, zeit int, g *GlobalVarsMain, l *NitroSharedVars, ln *NitroBBBSharedVars, hPath *HFilePath, output *CropOutputVars) (finishedCycle bool, runErr error)

Nitro ...

func OnDoubleRidgeStateNotReached

func OnDoubleRidgeStateNotReached(zeit int, g *GlobalVarsMain)

OnDoubleRidgeStateNotReached force DoubleRidgeState, move P1 date

func Open

func Open(fd *FileDescriptior) (*os.File, *bufio.Scanner, error)

Open will Open a file and create a scanner, to iterate through the file

func PTF1

func PTF1(CGEHALT, TON, SLUF float64) (fc, wmin float64)

PTF by Toth 2015

func PTF2

func PTF2(CGEHALT, TON, SLUF float64) (fc float64, wmin float64)

PTF by Batjes for pF 2.5

func PTF3

func PTF3(CGEHALT, TON, SLUF float64) (fc, wmin float64)

PTF by Batjes for pF 1.7

func PTF4

func PTF4(CGEHALT, TON, SSAND float64) (fc float64, wmin float64)

PTF by Rawls et al. 2003 for pF 2.5

func PhytoOut

func PhytoOut(g *GlobalVarsMain, l *CropSharedVars, hPath *HFilePath, zeit int, driConfig *Config, output *CropOutputVars)

PhytoOut calculates plant mass, creates output

func PrintTo

func PrintTo(file *Fout, text string)

PrintTo prints a string into a file

func PrognoseTime

func PrognoseTime(ZEIT int, g *GlobalVarsMain, herPath *HFilePath, driConfig *Config)

PrognoseTime triggers loading of weather prognose Data and prepares prognose

func ReadCropParamClassic

func ReadCropParamClassic(PARANAM string, l *CropSharedVars, g *GlobalVarsMain)

ReadCropParamClassic reads the crop parameters from an hermes crop file (classic format)

func ReadCropParamYml

func ReadCropParamYml(PARANAM string, l *CropSharedVars, g *GlobalVarsMain)

func ReadFile

func ReadFile(fd *FileDescriptior) ([]byte, error)

func ReadGroundWaterTimeSeries

func ReadGroundWaterTimeSeries(g *GlobalVarsMain, hPath *HFilePath, sid string) error

ReadGroundWaterTimeSeries read ground water time series from csv file, for a given soilID (sid)

func ReadPreco

func ReadPreco(g *GlobalVarsMain, hPath *HFilePath) ([12]float64, error)

ReadPreco reads the pre correction file for precipitaion

func ReadWeatherCSV

func ReadWeatherCSV(VWDAT string, startyear int, g *GlobalVarsMain, s *WeatherDataShared, hPath *HFilePath, driConfig *Config) error

ReadWeatherCSV read a weather file

func ReadWeatherCZ

func ReadWeatherCZ(VWDAT string, startyear int, g *GlobalVarsMain, s *WeatherDataShared, hPath *HFilePath, driConfig *Config) error

ReadWeatherCZ read weather file (cz format)

func ResetStages

func ResetStages(g *GlobalVarsMain)

ResetStages for wheat

func Run

func Run(workingDir string, args []string, logID string, out, logout chan<- string)

Run a hermes simulation setup

func SandAndClayToHa5Texture

func SandAndClayToHa5Texture(sand, clay float64) string

SandAndClayToHa5Texture get a rough KA5 soil texture class from given sand and soil content

func SandAndClayToKa5Texture

func SandAndClayToKa5Texture(sand, clay int) string

SandAndClayToHa5Texture with percent sand and clay as integer

func SetPrognoseDate

func SetPrognoseDate(prog string, g *GlobalVarsMain) (PR bool)

SetPrognoseDate set prognose date, if value was valid

func SimulateFertilizationAfterPrognose

func SimulateFertilizationAfterPrognose(zeit int, DTGESN, SUMDIFF, TRNSUM float64, g *GlobalVarsMain)

SimulateFertilizationAfterPrognose simulates fertilization as required and calcules new dates

func Soiltemp

func Soiltemp(g *GlobalVarsMain)

Soiltemp calculates and write the soil temperature data

func TryValAsFloat

func TryValAsFloat(toParse string) (float64, error)

TryValAsFloat parse text into float

func ValAsBool

func ValAsBool(toParse, filename, line string) bool

ValAsBool parse text into bool

func ValAsFloat

func ValAsFloat(toParse, filename, line string) float64

ValAsFloat parse text into float

func ValAsInt

func ValAsInt(toParse, filename, line string) int64

ValAsInt parse text into int

func Water

func Water(wdt float64, subd int, zeit int, g *GlobalVarsMain, l *WaterSharedVars)

Water model

func WetterK

func WetterK(VWDAT string, year int, g *GlobalVarsMain, s *WeatherDataShared, hPath *HFilePath, driConfig *Config) error

WetterK reads a climate file Format: Tp_av;Tpmin;Tpmax;ET0;rH;vappd14;wind;sundu;radia pr;prec;jday C_deg;C_deg;C_deg;mm;%;mm_Hg;m/sec;hours;MJ/m^2;mm ; 50;02;-----;-----;-----;-----;-----;-----;------;-- -;- 4.1;1;5.6;-99;90;0.2;3.1;0;64;1;1 4.8;3.9;6.3;-99;86;1.4;3.6;1.6;170;0;2 ... seperator can be ',' or ';' character for decimal point is '.' the naming of the colums is irrelevant column content should be in following order: Temperature average;Temperature min;Temperture max;ET0;relative humidity; water vapour saturation deficit;wind;sun hours;global radiation;prepitation;year day

func WriteCropParam

func WriteCropParam(filename string, cropParam CropParam) error

WriteCropParam writes the crop parameters to a yml file (with comments?)

func WriteYamlConfig

func WriteYamlConfig(filename string, structIn interface{})

WriteYamlConfig write a default config file

Types

type Alignment

type Alignment int

Alignment for column texts

func (Alignment) MarshalYAML

func (s Alignment) MarshalYAML() (interface{}, error)

MarshalYAML implement YAML Marshaler

func (*Alignment) UnmarshalYAML

func (s *Alignment) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implement YAML Unmarshaler interface

type Config

type Config struct {

	//***** Formats *****
	// DateDEshort ddmmyy <- default format(old)
	// DateDElong ddmmyyyy
	// DateENshort mmddyy
	// DateENlong mmddyyyy
	// short format "ddmmyy", e.g. 24.01.95 -> "ddmmyy" requires input as 240195, you need to set the century devision year "DivideCentury", e.g. 1950 -> 50
	// long format "ddmmyyyy", e.g. 24.01.2066  requires input as 24012066
	Dateformat    DateFormat `yaml:"Dateformat"`
	DivideCentury int        `yaml:"DivideCentury,omitempty"` // (depends on Date format) Year to divide 20. and 21. Century (YY)

	GroundWaterFrom       GroundWaterFrom `yaml:"GroundWaterFrom"`            // ground water from 'soilfile'=static, 'polygonfile'=dynamic High/Low, 'gwTimeSeries'= measured time series
	ResultFileFormat      int             `yaml:"ResultFileFormat,omitempty"` // result file format (0= hermes default, 1 = csv)
	ResultFileExt         string          `yaml:"ResultFileExt,omitempty"`    // result file extensions (default RES, csv)
	OutputIntervall       int             `yaml:"OutputIntervall"`            // Output intervall (days) (0=no time serie)
	ManagementEvents      int             `yaml:"ManagementEvents"`           // Management events (0=no management events)
	InitSelection         int             `yaml:"InitSelection"`              // Init.values all(1),Field_ID(2), Polyg(3) SoilID(4)-> POLY_XXX.txt, Uses: 1= all (if the word ALLE is written in the file), 2= Field_ID, 3= Polyg 4= SoilID
	SoilFile              string          `yaml:"SoilFile"`                   // soil profile file name (without projectname)
	SoilFileExtension     string          `yaml:"SoilFileExtension"`          // soil file extension (txt = hermes soil, csv = csv table format)
	CropFileFormat        string          `yaml:"CropFileFormat"`             // crop file format (txt = hermes crop, csv = csv table format)
	CropParameterFormat   string          `yaml:"CropParameterFormat"`        // crop parameter file format (txt = hermes crop, yaml = yaml format)
	MeasurementFileFormat string          `yaml:"MeasurementFileFormat"`      // Measurement file (endit_*.) format (txt = old Hermes, csv = csv table format)
	PolygonGridFileName   string          `yaml:"PolygonGridFileName"`        // Name of Polygon resp. grid file

	//***** Weather *****
	WeatherFile              string        `yaml:"WeatherFile"`              // weather file name template (without projectname)
	WeatherFileFormat        int           `yaml:"WeatherFileFormat"`        // Weather file format (0=separator(, ; \t), 1 year per file ) (1=separator(, ; \t), multiple years per file, (1=separator(, ; \t ' '), cz format, multiple years per file)
	WeatherFolder            string        `yaml:"WeatherFolder"`            // Weather scenario folder
	WeatherRootFolder        string        `yaml:"WeatherRootFolder"`        // weather root directory without scenario folder or filename
	WeatherNoneValue         float64       `yaml:"WeatherNoneValue"`         // weather none value, default -99.9
	WeatherNumHeader         int           `yaml:"WeatherNumHeader"`         // number of header lines (min = 1, with column names)
	CorrectionPrecipitation  FeatureSwitch `yaml:"CorrectionPrecipitation"`  // correction precipitation (0= no, 1 = yes)
	AnnualAverageTemperature float64       `yaml:"AnnualAverageTemperature"` // annual average temperature (Celsius)

	//***** Atmosphere *****
	ETpot               int           `yaml:"ETpot"`               // ETpot method(1=Haude,2=Turc-Wendling,3 Penman-Monteith)
	CO2method           int           `yaml:"CO2method"`           // CO2method(1=Nonhebel,2=Hoffmann,3=Mitchell)
	CO2concentration    float64       `yaml:"CO2concentration"`    // CO2 concentration (ppm)
	CO2StomataInfluence FeatureSwitch `yaml:"CO2StomataInfluence"` // CO2 Stomata influence (1=on/0= off)
	NDeposition         float64       `yaml:"NDeposition"`         // N-Deposition (annual kg/ha)

	//***** Time *****
	StartYear                       int    `yaml:"StartYear"`                       // Starting year of simulation (YYYY)
	EndDate                         string `yaml:"EndDate"`                         // End date of simulation (DDMMYYYY)
	AnnualOutputDate                string `yaml:"AnnualOutputDate"`                // Date for annual output
	VirtualDateFertilizerPrediction string `yaml:"VirtualDateFertilizerPrediction"` // Virtual date for fertilizer prediction; '------' for no prediction

	//***** Geoography *****
	Latitude      float64 `yaml:"Latitude"`      // Latitude
	Altitude      float64 `yaml:"Altitude"`      // Altitude - height (can be overwritten weather file)
	CoastDistance float64 `yaml:"CoastDistance"` // Distance to coast (km)

	//***** Soil *****
	PTF                            int     `yaml:"PTF"`                            // PTF pedo transfer function (0 = none (from file), 1 = Toth 2015, 2 = Batjes for pF 2.5, 3 = Batjes for pF 1.7, 4 = Rawls et al. 2003 for pF 2.5 )
	LeachingDepth                  int     `yaml:"LeachingDepth"`                  // Depth for leaching/seepage calculation (dm)
	OrganicMatterMineralProportion float64 `yaml:"OrganicMatterMineralProportion"` // Mineralisable proportion of organic matter
	KcFactorBareSoil               float64 `yaml:"KcFactorBareSoil"`               // kc factor for bare soil
	PotMineralisation              int     `yaml:"PotMineralisation,omitempty"`    // Potential mineralisation method (0= standard, 1 = considers bulk density, 2 = considers bulk density)
	GroundWaterPhase               int     `yaml:"GroundWaterPhase,omitempty"`     // Ground water phase in days (80= standard)

	//***** Management *****
	Fertilization     float64       `yaml:"Fertilization"`     // fertilization scenario (fertilization in %)
	AutoSowingHarvest FeatureSwitch `yaml:"AutoSowingHarvest"` // automatic sowing/harvest (0=no, 1 = yes)
	AutoFertilization FeatureSwitch `yaml:"AutoFertilization"` // automatic fertilization (0=no, 1=on demand)
	AutoIrrigation    FeatureSwitch `yaml:"AutoIrrigation"`    // automatic irrigation (0=no, 1= on demand)
	AutoHarvest       FeatureSwitch `yaml:"AutoHarvest"`       // automatic harvest (0=no, 1= on demand)
}

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig creates a config file with default setup

type CropDevelopmentStage

type CropDevelopmentStage struct {
	DevelopmentStageName string    `yaml:"DevelopmentStageName" comment:"name of the development stage/phase"`     // name of the development stage/phase
	ENDBBCH              int       `yaml:"ENDBBCH,omitempty" comment:"end on BBCH-scale"`                          // end on BBCH-scale
	TSUM                 float64   `yaml:"TSUM" comment:"development phase temperature sum (°C days)"`             // development phase temperatur sum (°C days)
	BAS                  float64   `yaml:"BAS" comment:"base temperature in phase (°C)"`                           // base temperature in phase (°C)
	VSCHWELL             float64   `yaml:"VSCHWELL" comment:"vernalisation requirements (days)"`                   // vernalisation requirements (days)
	DAYL                 float64   `yaml:"DAYL" comment:"day length requirements (hours)"`                         // day length requirements (hours)
	DLBAS                float64   `yaml:"DLBAS" comment:"base day length in phase (hours)"`                       // base day length in phase (hours)
	DRYSWELL             float64   `yaml:"DRYSWELL" comment:"drought stress below ETA/ETP-quotient"`               // drought stress below ETA/ETP-quotient
	LUKRIT               float64   `yaml:"LUKRIT" comment:"critical aircontent in topsoil (cm^3/cm^3)"`            // critical aircontent in topsoil (cm^3/cm^3)
	LAIFKT               float64   `yaml:"LAIFKT" comment:"specific leave area (LAI per mass) (ha/kg TM)"`         // specific leave area (area per mass) (m2/m2/kg TM)
	WGMAX                float64   `yaml:"WGMAX" comment:"N-content root at the end of phase (fraction)"`          // N-content root end at the of phase
	PRO                  []float64 `yaml:"PRO" comment:"Partitioning at end of phase (fraction, sum should be 1)"` // Partitioning at end of phase (fraction)
	DEAD                 []float64 `yaml:"DEAD" comment:"death rate at end of phase (coefficient, 1/day)"`         // death rate at end of phase (coefficient)
	Kc                   float64   `yaml:"Kc" comment:"kc factor for evapotranspiration at end of phase"`          // kc factor for evapotranspiration at end of phase

}

type CropOutputVars

type CropOutputVars struct {
	SowDate      string
	SowDOY       int
	EmergDOY     int
	AnthDOY      int
	MatDOY       int
	HarvestDOY   int
	BBCH_DOY     [100]int
	BBCH_DATE    [100]string
	HarvestYear  int
	Crop         string
	Yield        float64
	Biomass      float64
	Roots        float64
	LAImax       float64
	Nfertil      float64
	Irrig        float64
	Nuptake      float64
	Nagb         float64
	ETcG         float64
	ETaG         float64
	TraG         float64
	PerG         float64
	SWCS1        float64
	SWCS2        float64
	SWCA1        float64
	SWCA2        float64
	SWCM1        float64
	SWCM2        float64
	SoilN1       float64
	Nmin1        float64
	Nmin2        float64
	NLeaG        float64
	TRRel        float64
	Reduk        float64
	DryD1        float64
	DryD2        float64
	Nresid       float64
	Orgdat       string
	Type         string
	OrgN         float64
	NDat1        string
	N1           float64
	Ndat2        string
	N2           float64
	Ndat3        string
	N3           float64
	Tdat         string
	Code         string
	NotStableErr string
	PARSUM       float64
}

CropOutputVars at harvest

type CropOverwrite

type CropOverwrite struct {
	CropFile                   string
	BaseFloatParameters        map[string]float64
	DevelopmentStageParameters map[string]map[int]float64
	PartitioningParameters     map[string]map[PartPair]float64
}

func ParseCropOverwrites

func ParseCropOverwrites(args map[string]string) (*CropOverwrite, error)

crop overwrite parameters from command line

func (*CropOverwrite) OverwriteCropParameters

func (cropOW *CropOverwrite) OverwriteCropParameters(cropFile string, g *GlobalVarsMain, l *CropSharedVars)

overwrite crop parameters in global vars

type CropParam

type CropParam struct {
	// CropParam is a struct to hold the crop parameters
	CropName string `yaml:"CropName" comment:"name of the crop"`
	ABBr     string `yaml:"CropAbbreviation" comment:"crop no./ abbreviation"` // Abbreviation of the crop
	Variety  string `yaml:"Variaty" comment:"variaty of the crop"`             // Variaty of the crop

	MAXAMAX           float64       `yaml:"MAXAMAX" comment:"AMAX Max. CO2 assimilation rate (kg CO2/ha leave/h)"`                               // AMAX Max. CO2 assimilation rate (kg CO2/ha leave/h)
	TempTyp           int           `yaml:"TempTyp" comment:"type of temperature dependency (C3 = 1/ C4 = 2)"`                                   // type of temperature dependency (C3 = 1/ C4 = 2)
	MINTMP            float64       `yaml:"MINTMP" comment:"minimum temperature crop growth (in C°)"`                                            // minimum temperature crop growth (in C°)
	WUMAXPF           float64       `yaml:"WUMAXPF" comment:"crop specific maximum effective rooting depth(dm)"`                                 // crop specific maximum effective rooting depth(dm)
	VELOC             float64       `yaml:"VELOC" comment:"root depth increase in mm/C°"`                                                        // root depth increase in mm/C°
	NGEFKT            int           `yaml:"NGEFKT" comment:"crop N-content function number for critical and max. N-contents"`                    // crop N-content function number for critical and max. N-contents
	RGA               float64       `yaml:"RGA,omitempty" comment:" RGA parameter for crop N-content function number 5"`                         // RGA parameter for crop N-content function number 5
	RGB               float64       `yaml:"RGB,omitempty" comment:"RGB parameter for crop N-content function number 5"`                          // RGB parameter for crop N-content function number 5
	SubOrgan          int           `yaml:"SubOrgan,omitempty" comment:"SubOrgan parameter for crop N-content function number"`                  // SubOrgan parameter for crop N-content function number 5
	AboveGroundOrgans []int         `yaml:"AboveGroundOrgans" comment:"list of above ground organs (numbers of compartiments increasing order)"` // SubOrgan parameter for crop N-content function number
	YORGAN            int           `yaml:"YORGAN" comment:"organ number for yield"`                                                             // organ number for yield
	YIFAK             float64       `yaml:"YIFAK" comment:"fraction of yield organ (90% = 0.90)"`                                                // fraction of yield organ (90% = 0.90)
	INITCONCNBIOM     float64       `yaml:"INITCONCNBIOM" comment:"start concentration N in above ground biomass (% i. d.m.)"`                   // start conzentration N in above ground biomass (% i. d.m.)
	INITCONCNROOT     float64       `yaml:"INITCONCNROOT" comment:"start concentration N in roots (% i. d.m.)"`                                  // start concentration N in roots (% i. d.m.)
	NRKOM             int           `yaml:"NRKOM" comment:"Number of crop compartiments"`                                                        // Number of crop compartiments
	CompartimentNames []string      `yaml:"CompartimentNames" comment:"list of compartiment names"`                                              // list of compartiment names
	DAUERKULT         FeatureSwitch `yaml:"DAUERKULT" comment:"Dauerkultur - Is Permaculture true/false 1/0"`                                    // Dauerkultur - Permaculture D / Non Permaculture 0
	LEGUM             FeatureSwitch `yaml:"LEGUM" comment:"Legume - Is Legume true/false 1/0"`                                                   // Legume L / Non Legume 0
	WORG              []float64     `yaml:"WORG" comment:"initial weight kg d.m./ha of organ I"`                                                 // initial weight kg d.m./ha of organ I
	MAIRT             []float64     `yaml:"MAIRT" comment:"maintainance rates of organ I (1/day)"`                                               // Maintainance rates of organ I
	KcIni             float64       `yaml:"KcIni" comment:"initial kc factor for evapotranspiration (uncovered soil)"`                           // initial kc factor for evapotranspiration (uncovered soil)

	NRENTW                int                    `yaml:"NRENTW" comment:"number of development phases(max 10)"`   // number of development phases(max 10)
	CropDevelopmentStages []CropDevelopmentStage `yaml:"CropDevelopmentStages" comment:"development stage/phase"` // development stage/phase
}

func ConvertCropParamClassicToYml

func ConvertCropParamClassicToYml(PARANAM string) (CropParam, error)

func ReadCropParamFromFile

func ReadCropParamFromFile(filename string) (CropParam, error)

ReadCropParam reads the crop parameters from a yml file

type CropSharedVars

type CropSharedVars struct {
	DGORG             [10]float64
	GORG              [10]float64
	FV                float64 // Vernalisation factor to multiply SUM(INTWICK)
	FP                float64 // Daylength factor to multiply SUM(INTWICK)
	NRENTW            int     // Number of development stages
	AboveGroundOrgans []int   // Above ground organs

	EZIEL   float64
	PROZIEL float64
	MANT    [5]float64
	ENDBBCH [10]float64 // End BBCH for each stage
	// contains filtered or unexported fields
}

CropSharedVars includes the shared variables for this module

type CropType

type CropType int
const (
	AB  CropType = iota // field bean / Ackerbohne
	CCM                 // Corn-Cob-Mix / Kolben + Körner
	GR                  // grass land cut / Grünland Schnittnutzung
	GRE                 // grass land pasture / Gras. Futter Grünmasse
	H                   // oat / Hafer
	OA                  // oat / Hafer
	K                   // potato / Kartoffeln
	LUP                 // lupine / Lupinen
	ORH                 // oil radish / Ölrettich
	SE                  // mustard catch crop / Senf Zwischenfrucht
	SG                  // spring barley / Sommergerste
	SM                  // silage maize / Silomais
	M                   // maize /Mais
	SW                  // summer wheat / Sommerweizen
	TR                  // triticale / Triticale Korn
	WG                  // winter barley / Wintergerste
	WR                  // winter rye / Winterroggen
	WRA                 // winter rapeseed / Winterraps
	WRC                 // winter rapeseed catch crop / Winterraps Zwischenfrucht
	WW                  // winter wheat / Winter Weizen
	ZR                  // sugar beet / Zuckerrüben
	AA                  // alfalfa / Luzerne
	OEL                 // oil linseed catch crop / Öllein Zwischenfrucht
	ERB                 // pea / Felderbse
	PH                  // phacelia / Phazelie
	SOY                 // soybean / Soyabohne
	LET                 // Lettuce / Salat
	WCA                 // White cabbage / Weißkohl
	ONI                 // Onions / Zwiebeln
	CEL                 // Celery / Sellerie
	GAR                 // Garlic / Knoblauch
	CAR                 // Carrots / Möhren
	PMK                 // Pumpkins / Kürbis

)

type DateConverterFunc

type DateConverterFunc func(string) (int, int)

DateConverterFunc type of DateConverter

type DateFormat

type DateFormat int

DateFormat - default date format for all hermes input

const (
	// DateDEshort ddmmyy
	DateDEshort DateFormat = iota
	// DateDElong ddmmyyyy
	DateDElong
	// DateENshort mmddyy
	DateENshort
	// DateENlong mmddyyyy
	DateENlong
)

func (DateFormat) MarshalYAML

func (s DateFormat) MarshalYAML() (interface{}, error)

MarshalYAML implement YAML Marshaler

func (DateFormat) String

func (s DateFormat) String() string

func (*DateFormat) UnmarshalYAML

func (s *DateFormat) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implement YAML Unmarshaler interface

type DevelopmentStage

type DevelopmentStage int

DevelopmentStage for wheat

func (DevelopmentStage) String

func (s DevelopmentStage) String() string

type DualType

type DualType struct {
	Index  int
	Num    float64
	Offset int
}

DualType for values that have been used as int index and float for calculations

func NewDualType

func NewDualType(baseIndex int, offset int) DualType

NewDualType create a new DualType

func (*DualType) Add

func (d *DualType) Add(val int)

Add add to DualType

func (*DualType) Inc

func (d *DualType) Inc()

Inc increments DualType

func (*DualType) SetByIndex

func (d *DualType) SetByIndex(val int)

SetByIndex DualType to specific value

type FeatureSwitch

type FeatureSwitch bool

FeatureSwitch to convert 1/0 on/off to true/false

func (FeatureSwitch) MarshalYAML

func (s FeatureSwitch) MarshalYAML() (interface{}, error)

MarshalYAML implement YAML Marshaler

func (*FeatureSwitch) UnmarshalYAML

func (s *FeatureSwitch) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implement YAML Unmarshaler interface

type FileDescriptior

type FileDescriptior struct {
	FilePath        string // absolute file path
	FileDescription string // file useage/description (optional)
	UseFilePool     bool   // store file content, load file only once (optional, default false)

	ContinueOnError bool // terminate the programm on error or continue (optional, default false)
	// contains filtered or unexported fields
}

FileDescriptior describes a file with name, usage description and debug log output channel

type FilePool

type FilePool struct {
	// contains filtered or unexported fields
}

FilePool to store filepointer by path

var HermesFilePool FilePool

HermesFilePool file pool for shared files

func (*FilePool) Close

func (fp *FilePool) Close()

Close clears the filepool

func (*FilePool) Get

func (fp *FilePool) Get(fd *FileDescriptior) []byte

Get file content from the filepool

type Fout

type Fout struct {
	// contains filtered or unexported fields
}

Fout bufferd file writer

func OpenResultFile

func OpenResultFile(filePath string, append bool) *Fout

OpenResultFile opens a file for writing - options append, if append is false, it will truncate the file and override

func (*Fout) Close

func (f *Fout) Close()

Close file writer

func (*Fout) Write

func (f *Fout) Write(s string) (int, error)

Write string to bufferd file

func (*Fout) WriteBytes

func (f *Fout) WriteBytes(s []byte) (int, error)

WriteBytes writes a bufferd byte array

func (*Fout) WriteRune

func (f *Fout) WriteRune(s rune) (int, error)

WriteRune writes a bufferd rune

type GlobalVarsMain

type GlobalVarsMain struct {
	IZM     int
	DT      DualType // time step (Zeitschritt)
	DZ      DualType //= 10 (cm to mm)
	N       int      // max number of layer (changed by soil file)
	DV      float64
	ALPH    float64
	SATBETA float64
	AKF     DualType // current crop index (aktuelle frucht)

	NFOS               [21]float64 // Nitrogen in fast decomposable fraction (kg N ha-1)
	W                  [21]float64 // Field capacity (Feldkapazität pro Schicht ((cm^3/cm^3) (inkl. Stauwasser))
	WMIN               [21]float64 // Permanent Wilting point (Wassergehalt PWP (cm^3/cm^3) aus Bodenprofildatei 1. Schicht)
	PORGES             [21]float64 // Pore volume  (Gesamtporenvolumen Schicht I (cm3/cm3))
	NAKT               float64
	ETMETH             int // evapo transpiration methode selection
	PTF                int // pedotransfer function methode selection
	INIWAHL            int // initial field values setup selection
	DUNGSZEN           float64
	AZHO               int         // number of layer in soil profile (Anzahl Horizonte des Bodenprofils)
	WURZMAX            int         // effective root depth in profile (effektive Wurzeltiefe des Profils)
	DRAIDEP            int         // drainage depth (Tiefe der Drainung)
	DRAIFAK            float64     // part of drainage water in soakage (Anteil des Drainwassers am Sickerwasseranfakk (fraction))
	UKT                [11]int     //(0:10) layer depth (in dm)
	BART               [10]string  // soil type by KA5(Bodenkundlichen Kartieranleitung 5. Auflage) (special spelling convertions)
	LD                 [10]int     // bulk density KA5 (1-5) (Lagerungsdichtestufe nach KA5 (1-5))
	BULK               [10]float64 // avarage bulk density (Zuweisung mittlere Lagerungsdichte von LD(I) (g/cm^3))
	CGEHALT            [10]float64 // C organic content in soil layer (Corg-Gehalt in Horizont I (Gew.%))
	HUMUS              [21]float64 // humus content in soil layer (Humusgehalt in Hor. I (Gew.%))
	STEIN              [10]float64 // stone content in soil layer (%)
	FKA                [10]float64 // water content at field capacity (Wassergehalt bei Feldkapazität) (Vol. %)
	WP                 [10]float64
	GPV                [10]float64 // total interstice percentage (Gesamtporenvolumen) (Vol%)
	CAPS               [21]float64
	LIM                [10]float64
	PRGES              [10]float64
	WUMAX              [10]float64 // obsolete
	AD                 float64
	GRLO               int
	GRHI               int
	GRW                float64
	GW                 float64
	AMPL               float64
	GWTimeSeriesValues map[int]float64
	GWTimestamps       []int
	GWPhase            int
	W_Backup           [21]float64
	WMIN_Backup        [21]float64
	PORGES_Backup      [21]float64
	WNOR_Backup        [21]float64
	PKT                string
	WRED               float64 // top layer reduced field capacity (Feldkapazität) depending on soil type (cm^3/cm^3)
	PROP               float64
	NORMFK             [10]float64
	FELDW              [10]float64 // water content at field capacity (cm^3/cm^3)
	CAPPAR             int         // used to check if hydrological parameters need to be recalulated on changing ground water
	BD                 [21]float64 // bulk density
	WNOR               [21]float64 // water content at field capacity uncorrected (cm^3/cm^3)
	NALTOS             float64
	BREG               []float64 // irrigation amount (in mm)
	BRKZ               []float64 // N-Concentration in irrigation water (in ppm)
	ZTBR               []int     // irrigation time (timestamp since 1900)
	BEGINN             int
	ENDE               int
	FRUCHT             [300]CropType
	CVARIETY           [300]string
	SAAT               [300]int
	JN                 [300]float64
	ERNTE              [300]int
	ERTR               [300]float64
	ITAG               int
	TAG                DualType // current day
	JTAG               int      // number of days in current year
	ZTDG               [300]int
	FKU                [12]float64
	CN                 [2][21]float64 // (0:1,21) all 21 slots used!
	WG                 [3][21]float64 // Water content in layer I 0 = current day, 1 = prev. day, 2 = measurement // (0:2,21) all 21 slots used!
	NMESS              int
	MES                [100]string // Should be a local array
	MESS               [100]int
	WNZ                [100]float64
	KNZ1               [100]float64
	KNZ2               [100]float64
	KNZ3               [100]float64
	TILDAT             [200]string
	EINT               [300]float64
	TILART             [200]int
	EINTE              [201]int //(0:200)
	DGART              [300]string
	NDIR               [300]float64
	NH4N               [300]float64 // not NH4 fertilizer ( nicht Nitrat-N in Dünger)
	NSAS               [300]float64
	NLAS               [300]float64
	TSOIL              [2][22]float64 //(0:1,0:21)
	TMIN               [367]float64
	TMAX               [367]float64
	TBASE              float64 // annual base temperature (°C) for current location (used to initialize soil temperature)
	ETNULL             [367]float64
	TEMP               [367]float64 // average temperature (°C) of DOY
	//TEMPBO1, TEMPBO2 [367]float64 // not initialized, obsolete?
	RH                      [367]float64 // relative humidity
	VERD                    [367]float64 // Verdunstung, Evaporation, required for ETMETH = 1
	WIND                    [367]float64 // wind
	REGEN                   [368]float64 // TODO: set to 368 for irrigation calculation (FIXME: last value is 0, load data from next year)
	SUND                    [367]float64 // Sun shine hours, required if RAD is 0
	RAD                     [367]float64 // photosynthetic active radiation
	ALBEDO                  float64
	FEU                     int
	C1                      [21]float64 // Nitrogen content N-min
	NAOS                    [21]float64 // Nitrogen in slowly decomposable pool (kg N ha-1)
	MINAOS                  [4]float64  //  should be size of N
	MINFOS                  [4]float64  // should be size of N
	CA                      [21]float64
	NDG                     DualType
	MZ                      int
	NBR                     int
	NTIL                    DualType
	REGENSUM                float64 // precipitation sum
	MINSUM                  float64
	RADSUM                  float64
	BLATTSUM                float64
	DSUMM                   float64 // Dünger summe / fertilizer sum
	UMS                     float64 // aufgelöster Dünger / dissolved fertilizer
	OUTSUM                  float64
	NFIXSUM                 float64
	DRAISUM                 float64
	DRAINLOSS               float64
	NFIX                    float64
	SCHNORR                 float64
	PRECO                   bool // enable/disable correction factor of rain fall data
	KCOA                    float64
	CO2KONZ                 float64
	CO2METH                 int
	CTRANS                  bool
	OUTN                    int
	DEPOS                   float64
	PROGNOS                 int
	FKB                     float64
	PotMineralisationMethod int // pot. mineralisation method
	ANJAHR                  int
	J                       int
	WINDHI                  float64
	ALTI                    float64
	SICKER                  float64
	CAPSUM                  float64
	Q1                      [22]float64 //(0:21)
	INTWICK                 DualType    // crop development state
	FKF                     [12]float64
	FKC                     float64
	BBCH                    int     // BBCH code for crop development
	LAT                     float64 // latitude
	MINTMP                  float64 // minimum temperature for crop growth
	RSTOM                   float64
	LAI                     float64     // Leaf area index
	WURZ                    int         // root in max soil layer
	WUANT                   [20]float64 // share of total root mass in layer I (for residue distribution)
	POTROOTINGDEPTH         float64     // potential rooting depth (real rooting depth will be limited by soil parameter WURMAX)
	VERDUNST                float64
	FLUSS0                  float64
	WUDICH                  [21]float64 // root density in soil layer Z
	LUKRIT                  [10]float64 // kritischer Luftanteil im Boden / critical air content in soil
	LUMDAY                  int         // Tage mit Luftmangel / days with air shortage
	TP                      [21]float64 // Wasseraufnahme in Schicht I / water uptake in layer I
	TRREL                   float64     // Water stress factor (1 = no stress, 0 = full stress)
	REDUK                   float64     // Nitrogen stress factor (1 = no stress, 0 = full stress)
	ETA                     float64     // Potential/actual Evapotranspiration (mm)
	HEATCOND                [21]float64
	HEATCAP                 [21]float64
	TDSUM                   [20]float64
	TD                      [22]float64 // starts with 0 BBB
	QDRAIN                  float64
	TP3, TP6, TP9           float64
	PFTRANS                 float64
	INFILT                  float64
	ET0                     float64
	PE                      [21]float64 // N-uptake of crop in soil layer Z (kg N/ha)
	MAXAMAX                 float64
	WUMAXPF                 float64 // crop specific rooting depth
	VELOC                   float64 // root depth increase in mm/C°
	NGEFKT                  int     // N content funktion Nr.
	RGA                     float64 // value for NGEFKT = 5
	RGB                     float64 // value for NGEFKT = 5
	SubOrgan                int     // organ number for WORG in NGEFKT = 5
	YORGAN                  int     // yield organ number (WORG 1-5)
	YIFAK                   float64 // yield factor
	NRKOM                   int     // number of N-uptake compartments
	DAUERKULT               bool    // permanent crop
	LEGUM                   bool    // leguminous crop
	DOUBLE                  int     //day of  double ridge stage / Doppelringstadium
	ASIP                    int
	BLUET                   int
	REIF                    int
	ENDPRO                  int     // TODO: obsolete?
	PHYLLO                  float64 // culmulative development relevant temperature sum (°C days)
	VERNTAGE                float64
	SUM                     [10]float64 //development relevant temperature sum in state INTWICK
	PRO                     [10][5]float64
	DEAD                    [10][5]float64
	TROOTSUM                float64
	GEHOB                   float64     //N content in above ground Biomass (kg N/kg OBMAS)
	WUGEH                   float64     // N content in root Biomass (kg N/kg WUMAS)
	WORG                    [5]float64  // dry mass of organ (kg/ha)
	WDORG                   [10]float64 // dead dry mass of organ (kg/ha)
	MAIRT                   [10]float64 // maintainance rates of organ I
	TSUM                    [10]float64 //Temperature sum for development stage I (°C days)
	BAS                     [10]float64 //Base temperature for development stage I (°C)
	VSCHWELL                [10]float64 // vernalisation threshold (in days)
	DAYL                    [10]float64
	DLBAS                   [10]float64
	DRYSWELL                [10]float64
	LAIFKT                  [10]float64
	WGMAX                   [10]float64
	OBMAS                   float64 // biomass of crop above ground (kg/ha)
	ASPOO                   float64 // Assimilation pool in crops
	WUMAS                   float64
	PESUM                   float64 // sum of N-uptake of crop (aufgenommene N-Menge der Pflanze) (kg N/ha)
	LURED                   float64
	DOPP                    string // obsolete? Kalender date of double ridge stage / Doppelringstadium
	P1, P2                  int
	SUMAE                   float64
	AEHR                    string
	BLUEH                   string
	REIFE                   string
	GEHMAX                  float64 // maximal possible N-content in biomass (driver for N-uptake) (kg N/kg Biomass)
	GEHMIN                  float64 // critical N-content in biomass (start of N-stress) (kg N/kg Biomass)
	DUNGBED                 float64
	DEFDAT                  int
	ENDSTADIUM              DevelopmentStage
	DIFFSUM                 float64
	MASSUM                  float64
	DN                      [21]float64
	YIELD                   float64 //?? Grain yield (only for cereals) (kg ha-1)
	AUFNASUM                float64
	NDRAINTAG               float64
	CUMDENIT                float64 // cumulative denitrification

	N2Odencum   float64
	N2OdenDaily float64

	AUFNA   [131]float64 //(0:130)
	SIC     [131]float64 //(0:130)
	AUS     [131]float64 // (0:130)
	MINA    float64      // TODO: obsolete
	PLANA   float64
	OUTA    float64 // TODO: obsolete?
	NAPPDAT string
	PROGDAT string
	SLNAM   string // not assigned
	// new
	TJBAS       [300]float64
	IRRST1      [300]float64
	IRRST2      [300]float64
	IRRDEP      [300]float64
	IRRLOW      [300]float64
	IRRMAX      [300]float64
	IRRISIM     float64
	TSLWINDOW   [300]float64
	TSLMIN      [300]float64
	TSLMAX      [300]float64
	SAAT1       [300]int
	SAAT2       [300]int
	TJAHRSUM    float64
	TJAHR       [300]float64
	MAXMOI      [300]float64
	MINMOI      [300]float64
	ETAG        float64
	SWCS1       float64 // sum of water content for upper 3 layers on sowing date
	SWCS2       float64 // sum of water content for upper 15 layers on sowing date
	SWCA1       float64 // sum of water content for upper 3 layers start of fruit growing
	SWCA2       float64 // sum of water content for upper 15 layers start of fruit growing
	SWCM1       float64 // sum of water content for upper 3 layers on maturity
	SWCM2       float64 // sum of water content for upper 15 layers on maturity
	DRYD1       float64
	DRYD2       float64
	ERNTE2      [300]int
	ETC0        float64
	RDTSUM      float64
	REDSUM      float64
	TRAG        float64
	TRAY        float64
	AUTOMAN     bool // automatic management
	AUTOFERT    bool // automatic fertilization
	AUTOIRRI    bool // automatic irrigation
	AUTOHAR     bool // automatic harvest
	CNRAT1      float64
	PERG        float64
	ETREL       float64
	MAXHMOI     [300]float64
	MINHMOI     [300]float64
	RAINLIM     [300]float64
	RAINACT     [300]float64
	DEV         [10]int  // day of year (like sowing, maturity, harvest)
	BBCH_DOY    [100]int // day of year in which BBCH stage was reached
	BBCH_TIME   [100]int
	REDUKSUM    float64
	TRRELSUM    float64
	LAIMAX      float64
	ODU         [300]float64
	NDEM1       [300]float64
	NDEM2       [300]float64
	NDEM3       [300]float64
	ORGDOY      [300]int
	ORGTIME     [300]string
	NDOY1       [300]float64
	NDOY2       [300]float64
	NDOY3       [300]float64
	KNZ4        [100]float64
	KNZ5        [100]float64
	KNZ6        [100]float64
	NLEAG       float64
	NFERTSIM    float64
	NH4Sum      float64
	NH4UMS      float64
	N2onitsum   float64
	N2onitDaily float64
	AKTUELL     string // current Date string
	SoilID      string
	PARi        float64 // daily PAR
	PARSUM      float64 // sum of daily PAR

	// output parameters
	PerY            float64 // accumulated output
	SWCY1           float64 // accumulated output
	SWCY2           float64 // accumulated output
	SOC1            float64 // accumulated output
	Nmin9to20       float64 // sum of C1 from layer 9 to 20
	SickerDaily     float64 // sicker - capsum daily update
	SickerDailyDiff float64 // sicker - capsum daily difference
	HARVEST         float64 // potential harvest daily
	NAOSAKT         float64 // sum NAOS
	NFOSAKT         float64 // sum NFOS
	SumMINAOS       float64 // sum MINAOS
	SumMINFOS       float64 // sum MINFOS
	AvgTSoil        float64 // average TD soil temperature upper 2 layers

	TEMPdaily      float64 // temperatur avg at current day
	TMINdaily      float64 // temperatur min at current day
	TMAXdaily      float64 // temperatur max at current day
	RHdaily        float64 // relative humidity at current day
	RADdaily       float64 // GlobalRadiation at current day (from input)
	WINDdaily      float64 // WIND at current day
	REGENdaily     float64 // REGEN at current day without irrigation
	EffectiveIRRIG float64 // irrigation that is added to general precipitation REGEN

	DRflowsum    float64
	Ndrflow      float64
	Nleach       float64
	Percsum      float64
	NfixP        float64
	NAbgbio      float64
	Crop         string
	DevStateDate [10]string

	SNAM            string // plot number, PlotID SLAG NR. (used for output filenames)
	SLNR            int    // plot number, PlotID SLAG NR. as int
	POLYD           string // identifier for naming output files- just for output
	FCODE           string // weather station code
	C1NotStable     string
	C1NotStableErr  string
	C1stabilityVal  float64
	GROUNDWATERFROM GroundWaterFrom        `yaml:"-"`
	DATEFORMAT      DateFormat             `yaml:"-"`
	DEBUGOUT        func(int, interface{}) `yaml:"-"`
	DEBUGCHANNEL    chan<- string          `yaml:"-"`
	LOGID           string                 `yaml:"-"`
	Datum           DateConverterFunc      `yaml:"-"` // calculates (ztDat = day of the year) and (masDat = total days since 01.01.1901)
	Kalender        KalenderConverterFunc  `yaml:"-"`
	LangTag         LangTagConverterFunc   `yaml:"-"`
	CropTypeLookup  map[string]CropType    `yaml:"-"`

	CropOverwrite *CropOverwrite `yaml:"-"`
	// contains filtered or unexported fields
}

GlobalVarsMain contains all variables that are use by multiple sub modules

func NewGlobalVarsMain

func NewGlobalVarsMain() GlobalVarsMain

NewGlobalVarsMain create GlobalVarsMain

func (*GlobalVarsMain) CropTypeToString

func (g *GlobalVarsMain) CropTypeToString(c CropType, withSpaces bool) string

func (*GlobalVarsMain) ToCropType

func (g *GlobalVarsMain) ToCropType(s string) CropType

type GroundWaterFrom

type GroundWaterFrom int

GroundWaterFrom enum from where to load ground water data

const (
	// Polygonfile load from polygon file
	Polygonfile GroundWaterFrom = iota
	// Soilfile load from soil file
	Soilfile
	// Ground water time series file
	GWTimeSeries
)

func (GroundWaterFrom) MarshalYAML

func (s GroundWaterFrom) MarshalYAML() (interface{}, error)

MarshalYAML implement YAML Marshaler

func (GroundWaterFrom) String

func (s GroundWaterFrom) String() string

func (*GroundWaterFrom) UnmarshalYAML

func (s *GroundWaterFrom) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implement YAML Unmarshaler interface

type HFilePath

type HFilePath struct {
	// contains filtered or unexported fields
}

HFilePath list of hermes file pathes and path template

func NewHermesFilePath

func NewHermesFilePath(root, locid, snam, parameterOverride, resultOverride string) HFilePath

NewHermesFilePath create an initialized HermesFilePath struct

func (*HFilePath) GetParanam

func (hp *HFilePath) GetParanam(fruit, variety string, yml bool) string

GetParanam returns the full filename for the choosen fruit

func (*HFilePath) OverrideBofile

func (hp *HFilePath) OverrideBofile(newPath string)

OverrideBofile overrides the complete bofile filename

func (*HFilePath) SetBofile

func (hp *HFilePath) SetBofile(prefix, extension string)

SetBofile completes bofile filename

func (*HFilePath) SetPnam

func (hp *HFilePath) SetPnam(ins, ext string)

SetPnam completes pnam filename

func (*HFilePath) SetPolnam

func (hp *HFilePath) SetPolnam(ins string)

SetPolnam completes polnam filename

func (*HFilePath) SetPreCorrFolder

func (hp *HFilePath) SetPreCorrFolder(folder string)

func (*HFilePath) SetVwdatNoExt

func (hp *HFilePath) SetVwdatNoExt(ins string)

SetVwdatNoExt completes weather data filename, without extension

func (*HFilePath) VWdat

func (hp *HFilePath) VWdat(year int) string

VWdat returns weather data file with the correct extension for a year

type Header int

Header for csv weather files

type InputSharedVars

type InputSharedVars struct {
	NORG    [300]float64
	DGMG    [300]float64
	NGEHALT [10]float64
	//Jstr    string
	//MK [70]string
	FK [10]float64
	// KONZ1   float64
	// KONZ3   float64
	// KONZ4   float64
	// KONZ5   float64
	// KONZ6   float64
	// KONZ7   float64
	IRRIGAT bool
	ANZBREG int
	FLAEID  string
	SSAND   [10]float64 // sand in %
	SLUF    [10]float64 // silt(schluf) in %
	TON     [10]float64 // clay(ton) in %
}

InputSharedVars is a struct of shared variables for this module

type KalenderConverterFunc

type KalenderConverterFunc func(int) string

KalenderConverterFunc KalenderConverter type

type LangTagConverterFunc

type LangTagConverterFunc func(float64, string, int) (int, int, int)

LangTagConverterFunc get LangTagConverter

type ManagementConfig

type ManagementConfig struct {
	// Management output configuration
	EventFormats  map[ManagementEventType]*ManagementEventConfig
	SeperatorRune rune
	// contains filtered or unexported fields
}

func LoadManagementConfig

func LoadManagementConfig(hp *HFilePath) (*ManagementConfig, error)

func NewManagentConfig

func NewManagentConfig() *ManagementConfig

func (*ManagementConfig) AnyOutputEnabled

func (s *ManagementConfig) AnyOutputEnabled() bool

func (*ManagementConfig) Close

func (c *ManagementConfig) Close()

func (*ManagementConfig) WriteManagementEvent

func (c *ManagementConfig) WriteManagementEvent(event *ManagementEvent) error

type ManagementEvent

type ManagementEvent struct {
	// contains filtered or unexported fields
}

func NewManagementEvent

func NewManagementEvent(eventType ManagementEventType, zeit int, additionalFields map[string]interface{}, g *GlobalVarsMain) *ManagementEvent

type ManagementEventConfig

type ManagementEventConfig struct {
	EventName        ManagementEventType
	Enabled          bool
	AdditionalFields map[string]string
	// contains filtered or unexported fields
}

type ManagementEventType

type ManagementEventType int
const (
	Tillage ManagementEventType = iota
	Irrigation
	Sowing
	Harvest
	Fertilization
)

func (ManagementEventType) MarshalYAML

func (s ManagementEventType) MarshalYAML() (interface{}, error)

MarshalYAML implement YAML Marshaler

func (ManagementEventType) String

func (s ManagementEventType) String() string

func (*ManagementEventType) UnmarshalYAML

func (s *ManagementEventType) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implement YAML Unmarshaler interface

type NitroBBBSharedVars

type NitroBBBSharedVars struct {
	DDAT1   string
	DDAT2   string
	DDAT3   string
	DODAT   string
	DUNGART string
	DMENG1  float64
	DMENG2  float64
	DMENG3  float64
	DOMENG1 float64
	NRESID  float64
	NAGB    float64
	NUPTAKE float64
}

NitroBBBSharedVars shared variables for this module

type NitroSharedVars

type NitroSharedVars struct {
	DUMS    [4]float64
	D       [21]float64
	V       [21]float64
	KONV    [21]float64
	DISP    [21]float64
	DB      [21]float64
	DM      [21]float64
	DNH4UMS [4]float64
}

NitroSharedVars shared variables for this module

type OutHeaderColum

type OutHeaderColum struct {
	Text            string    `yaml:"ColumnName"`
	ColumnAlignment Alignment `yaml:"TextAlignment"`
	ColStart        int       `yaml:"StartColumn,omitempty"`
	ColEnd          int       `yaml:"EndColumn,omitempty"`

	FillWithCharacter string `yaml:"FillCharacter,omitempty"`
	// contains filtered or unexported fields
}

OutHeaderColum describes header text, format and position

type OutputConfig

type OutputConfig struct {
	FillCharacter string `yaml:"FillCharacter"`

	SeperatorCharacter string `yaml:"SeperatorCharacter"`

	NotAvailableValue string                   `yaml:"NaValue"`
	DataColumns       []OutputDataColum        `yaml:"DataColumns"`
	Headlines         map[int][]OutHeaderColum `yaml:"Headlines"`
	// contains filtered or unexported fields
}

OutputConfig defines output parameters in form of a csv file

func LoadHermesOutputConfig

func LoadHermesOutputConfig(path string, g interface{}) (OutputConfig, error)

LoadHermesOutputConfig loads a output file and reflects to programm variables

func NewDefaultCropOutputConfig

func NewDefaultCropOutputConfig(c *CropOutputVars) OutputConfig

NewDefaultCropOutputConfig create crop output configuration

func NewDefaultDailyOutputConfig

func NewDefaultDailyOutputConfig(g *GlobalVarsMain) OutputConfig

NewDefaultDailyOutputConfig create daily output configuration

func NewDefaultOutputConfigYearly

func NewDefaultOutputConfigYearly(g *GlobalVarsMain) OutputConfig

NewDefaultOutputConfigYearly create yearly hermes output configuration

func (*OutputConfig) WriteHeader

func (c *OutputConfig) WriteHeader(file *Fout) error

WriteHeader of an output file

func (*OutputConfig) WriteLine

func (c *OutputConfig) WriteLine(file *Fout) error

WriteLine to outputfile

type OutputDataColum

type OutputDataColum struct {
	FormatStr     string    `yaml:"Format"`
	DataAlignment Alignment `yaml:"DataAlignment"`
	Width         int       `yaml:"Width"`
	Modifier      float64   `yaml:"Modifier,omitempty"`
	VarName       string    `yaml:"VariableName"`
	VarIndex1     int       `yaml:"VarIndex1,omitempty"`
	VarIndex2     int       `yaml:"VarIndex2,omitempty"`
	// contains filtered or unexported fields
}

OutputDataColum describes data format and reference variable

type OutputFileFormat

type OutputFileFormat int

OutputFileFormat to determine in which style the output is formated

type OutputLine

type OutputLine struct {
	// contains filtered or unexported fields
}

OutputLine for tupels of value and format into one line of output

func NewOutputLine

func NewOutputLine(num int) OutputLine

NewOutputLine create a OutputLine with max number of elements

func (*OutputLine) Add

func (l *OutputLine) Add(format string, v interface{})

Add value to OutputLine

func (*OutputLine) AddDate

func (l *OutputLine) AddDate(format string, date string, size int)

AddDate string to OutputLine

func (*OutputLine) String

func (l *OutputLine) String() string

type PartPair

type PartPair struct {
	Stage int
	Part  int
}

type RPCService

type RPCService struct {
	// contains filtered or unexported fields
}
var HermesRPCService RPCService

func NewRPCService

func NewRPCService(address string) (RPCService, error)

func (*RPCService) SendGV

func (rs *RPCService) SendGV(g *GlobalVarsMain, zeit int, wdt float64, step int) error

func (*RPCService) SendNV

func (rs *RPCService) SendNV(n *NitroSharedVars, zeit int, wdt float64, step int) error

func (*RPCService) SendWdt

func (rs *RPCService) SendWdt(g *GlobalVarsMain, zeit int, wdt float64) error

type SoilFileData

type SoilFileData struct {
	SoilID  string
	N       int
	AZHO    int
	WURZMAX int

	GRHI    int
	GRLO    int
	GRW     float64
	GW      float64
	DRAIDEP int
	DRAIFAK float64
	UKT     [11]int
	BART    [10]string  // soil texture (Bodenart)
	LD      [10]int     // bulk density class (Lagerungsdichteklasse)
	BULK    [10]float64 // bulk density (g/cm^3)
	CGEHALT [10]float64 // C-content soil class specific in %
	CNRATIO [10]float64 // C/N ratio
	CNRAT1  float64     // C/N ratio in top layer
	NGEHALT [10]float64
	HUMUS   [21]float64
	STEIN   [10]float64 // stone content
	FKA     [10]float64 // Field capacity
	WP      [10]float64 // wilting point
	GPV     [10]float64 // general pore volume
	SSAND   [10]float64 // sand in %
	SLUF    [10]float64 // silt in %
	TON     [10]float64 // clay in %
	// contains filtered or unexported fields
}

func LoadSoil

func LoadSoil(withGroundwater bool, LOGID string, hPath *HFilePath, soilID string) (SoilFileData, error)

func LoadSoilCSV

func LoadSoilCSV(withGroundwater bool, LOGID string, hPath *HFilePath, soilID string) (SoilFileData, error)

func NewSoilFileData

func NewSoilFileData(soilID string) SoilFileData

func (*SoilFileData) BulkDensityClassToDensity

func (soildata *SoilFileData) BulkDensityClassToDensity(i int)

BulkDensityClassToDensity set bulk density from class (Lagerungsdichtestufe nach KA5 (1-5))

func (*SoilFileData) BulkDensityToClass

func (soildata *SoilFileData) BulkDensityToClass(bulkDensity float64) (bulkDensityClass int)

BulkDensityToClass get bulk density class from bulk density

type SoilHeader

type SoilHeader int

Header for csv weather files

type TransferEnvGlobal

type TransferEnvGlobal struct {
	Global GlobalVarsMain
	Zeit   int
	Wdt    float64
	Step   int
}

type TransferEnvNitro

type TransferEnvNitro struct {
	Nitro NitroSharedVars
	Zeit  int
	Wdt   float64
	Step  int
}

type TransferEnvWdt

type TransferEnvWdt struct {
	Zeit  int
	WDT   float64
	N     int
	WG    [3][21]float64
	W     [21]float64
	DZ    float64
	REGEN float64
}

type WaterSharedVars

type WaterSharedVars struct {
	LIMIT  [21]float64
	EVA    [366]float64
	NFK    [21]float64
	GWAUF  float64
	EV     [21]float64
	SATDEF float64
}

WaterSharedVars is a struct of shared variables for this module

type WeatherDataShared

type WeatherDataShared struct {
	JAR      []int
	TMP      [][366]float64 // temperature avarage 						°C
	TMI      [][366]float64 // temperature minimum 						°C
	TMA      [][366]float64 // temperature maximum 						°C
	RADI     [][366]float64 // photosynthetic active radiation 			MJ m-2
	REG      [][366]float64 // preciptation (optional on ground level) 	cm
	RELF     [][366]float64 // relative humidity 						%
	WIN      [][366]float64 // wind (capped to minimum 0.5)				m s-1
	VERD     [][366]float64 // water vapour saturation deficit			mmHg (Torr)
	SUND     [][366]float64 // sun shine hours 							h
	ETNULL   [][366]float64 // evapo transpiration ET0					mm
	WINDHI   float64        // measurment height for wind				m
	ALTITUDE float64        // altidude 								m
	CO2KONZ  []float64      // CO2 concentration 						ppm

	MaxYearDays []int // days in each year (365 or 366)
	// contains filtered or unexported fields
}

WeatherDataShared all weather split in years

func NewWeatherDataShared

func NewWeatherDataShared(years int, baseCO2 float64) WeatherDataShared

NewWeatherDataShared returns a new WeatherDataShared struct

func (*WeatherDataShared) HasSunHours

func (s *WeatherDataShared) HasSunHours() bool

check if sunhours are given

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL