APSIM-Wheat module

wheatPhenology(
  sim,
  stages = 6,
  stageNames = "flow",
  model = "APSIM",
  met = NULL,
  daily = FALSE,
  ...
)

Arguments

sim

The path to sim file.

stages

The stages of outputs

stageNames

The stage names of outputs

model

The model of Phenology. APSIM for default method in APSIM, V1 and V2 change the minimum function to multiple. V2 extend photoperiod effect of flowering

met

The weather data with weaana class.

daily

whether output daily stages

...

Other arguments

Examples

met <- system.file("extdata/weather.met", package = "APSIMWheatPhenology")
sim <- system.file("extdata/example.sim", package = "APSIMWheatPhenology")
# Flowering time using parameter in the sim file
df <- wheatPhenology(sim, stages = 6, stageNames = 'flow', model = 'APSIM',
                     met = met, daily = FALSE)
head(df)
#>                  Name  Number Latitude Longitude year sow_doy flow_doy flow_das
#> 1 DEMO Weather Site 2 0000002      -25       130 1981     105      189       84
#> 2 DEMO Weather Site 2 0000002      -25       130 1982     105      197       92
#> 3 DEMO Weather Site 2 0000002      -25       130 1983     105      192       87
#> 4 DEMO Weather Site 2 0000002      -25       130 1984     106      190       84
#> 5 DEMO Weather Site 2 0000002      -25       130 1985     105      191       86
#> 6 DEMO Weather Site 2 0000002      -25       130 1986     105      182       77

# Models V1 or V2 can be used
df <- wheatPhenology(sim, stages = 6, stageNames = 'flow', model = 'V1',
                     met = met, daily = FALSE)
head(df)
#>                  Name  Number Latitude Longitude year sow_doy flow_doy flow_das
#> 1 DEMO Weather Site 2 0000002      -25       130 1981     105      219      114
#> 2 DEMO Weather Site 2 0000002      -25       130 1982     105      227      122
#> 3 DEMO Weather Site 2 0000002      -25       130 1983     105      222      117
#> 4 DEMO Weather Site 2 0000002      -25       130 1984     106      222      116
#> 5 DEMO Weather Site 2 0000002      -25       130 1985     105      226      121
#> 6 DEMO Weather Site 2 0000002      -25       130 1986     105      213      108

# Weather can be passed as a weaana object
met_data <- weaana::readWeatherRecords(met)
df <- wheatPhenology(sim, stages = 6, stageNames = 'flow', model = 'APSIM',
                     met = met_data, daily = FALSE)
head(df)
#>                  Name  Number Latitude Longitude year sow_doy flow_doy flow_das
#> 1 DEMO Weather Site 2 0000002      -25       130 1981     105      189       84
#> 2 DEMO Weather Site 2 0000002      -25       130 1982     105      197       92
#> 3 DEMO Weather Site 2 0000002      -25       130 1983     105      192       87
#> 4 DEMO Weather Site 2 0000002      -25       130 1984     106      190       84
#> 5 DEMO Weather Site 2 0000002      -25       130 1985     105      191       86
#> 6 DEMO Weather Site 2 0000002      -25       130 1986     105      182       77

# Multiple stages can be calculated
df <- wheatPhenology(sim, stages = c(5.74, 6), stageNames = c("head", 'flow'),
                     model = 'APSIM',
                     met = met_data, daily = FALSE)
#> Warning: photoperiod existed, overwriting.
#> Warning: tempcr existed, overwriting.
#> Warning: dlt_tt existed, overwriting.
#> Warning: dlt_cumvd existed, overwriting.
head(df)
#>                  Name  Number Latitude Longitude year sow_doy head_doy head_das
#> 1 DEMO Weather Site 2 0000002      -25       130 1981     105      179       74
#> 2 DEMO Weather Site 2 0000002      -25       130 1982     105      186       81
#> 3 DEMO Weather Site 2 0000002      -25       130 1983     105      180       75
#> 4 DEMO Weather Site 2 0000002      -25       130 1984     106      178       72
#> 5 DEMO Weather Site 2 0000002      -25       130 1985     105      181       76
#> 6 DEMO Weather Site 2 0000002      -25       130 1986     105      171       66
#>   flow_doy flow_das
#> 1      189       84
#> 2      197       92
#> 3      192       87
#> 4      190       84
#> 5      191       86
#> 6      182       77

# Daily output can be exported
df <- wheatPhenology(sim, stages = c(5.74, 6), stageNames = c("head", 'flow'),
                     model = 'APSIM',
                     met = met_data, daily = TRUE)
#> Warning: photoperiod existed, overwriting.
#> Warning: tempcr existed, overwriting.
#> Warning: dlt_tt existed, overwriting.
#> Warning: dlt_cumvd existed, overwriting.
head(df)
#>                  Name  Number Latitude Longitude year sow_doy das    stage
#> 1 DEMO Weather Site 2 0000002      -25       130 1981     105   1 1.999000
#> 2 DEMO Weather Site 2 0000002      -25       130 1981     105   2 2.000000
#> 3 DEMO Weather Site 2 0000002      -25       130 1981     105   3 2.369374
#> 4 DEMO Weather Site 2 0000002      -25       130 1981     105   4 2.532852
#> 5 DEMO Weather Site 2 0000002      -25       130 1981     105   5 2.724591
#> 6 DEMO Weather Site 2 0000002      -25       130 1981     105   6 2.906765

# Multiple simulations can be specified in a factor
# Any parameters related with plant can be used
factors <- expand.grid(list(vern_sens = seq(1, 5), photop_sens = seq(1, 5)))
df <- wheatPhenology(sim, stages = c(5.74, 6), stageNames = c("head", 'flow'),
                     model = 'APSIM',
                     met = met_data, daily = FALSE,
                     factors = factors)
#> Warning: photoperiod existed, overwriting.
#> Warning: tempcr existed, overwriting.
#> Warning: dlt_tt existed, overwriting.
#> Warning: dlt_cumvd existed, overwriting.
head(df)
#>                  Name  Number Latitude Longitude vern_sens photop_sens year
#> 1 DEMO Weather Site 2 0000002      -25       130         1           1 1981
#> 2 DEMO Weather Site 2 0000002      -25       130         2           1 1981
#> 3 DEMO Weather Site 2 0000002      -25       130         3           1 1981
#> 4 DEMO Weather Site 2 0000002      -25       130         4           1 1981
#> 5 DEMO Weather Site 2 0000002      -25       130         5           1 1981
#> 6 DEMO Weather Site 2 0000002      -25       130         1           2 1981
#>   sow_doy head_doy head_das flow_doy flow_das
#> 1     105      171       66      180       75
#> 2     105      191       86      202       97
#> 3     105      229      124      238      133
#> 4     105      264      159      271      166
#> 5     105      280      175      286      181
#> 6     105      171       66      180       75