vignettes/a05_custom_land_units_input.Rmd
a05_custom_land_units_input.Rmd
ALUES comes with two datasets for input land units. These are the land units of Marinduque, Philippines; and, Lao Cai, Vietnam. However, users will likely have their own region of interest. This article will illustrate how to prepare such data.
For any region of interest, users must specify the properties of the land units into three categories:
Note that both terrain and soil factors must be specified as one dataframe, not separate. Suppose there are 5 land units under study, the three characteristics can be specified as follows:
Suppose for terrain, we want to target the following factors: Flood and SlopeD; and, suppose for soil we have CFragm and SoilDpt. The dataframe can be prepared as follows:
terrain_input <- data.frame(
Flood = c(1, 2, 2, 2, 3),
SlopeD = c(3, 4, 5, 1, 2),
CFragm = c(10, 30, 50, 60, 40),
SoilDpt = c(45, 60, 90, 70, 30)
)
Note: the column names must be the same with the naming convention used by the crop requirements datasets.
So that, if this input is assessed for avocado, then the suitability score for these land units are computed as follows:
## Loading required package: Rcpp
AVOCADOTerrain
## code s3_a s2_a s1_a s1_b s2_b s3_b wts
## 1 Slope1 6.0 4.0 2 <NA> <NA> <NA> <NA>
## 2 Slope2 16.0 8.0 4 <NA> <NA> <NA> <NA>
## 3 Slope3 30.0 16.0 8 <NA> <NA> <NA> <NA>
## 4 Flood 1.5 1.2 1 <NA> <NA> <NA> <NA>
## 5 Drainage 3.0 2.0 1 <NA> <NA> <NA> <NA>
AVOCADOSoil
## code s3_a s2_a s1_a s1_b s2_b s3_b wts
## 1 CFragm 55.0 33.0 15.0 <NA> <NA> <NA> <NA>
## 2 SoilDpt 50.0 75.0 100.0 <NA> <NA> <NA> <NA>
## 3 CaCO3 10.0 4.0 1.0 <NA> <NA> <NA> <NA>
## 4 CECc 16.0 16.0 16.0 <NA> <NA> <NA> <NA>
## 5 BS 19.9 20.0 35.0 <NA> <NA> <NA> <NA>
## 6 SumBCs 1.5 1.6 2.8 <NA> <NA> <NA> <NA>
## 7 pHH2O 4.3 4.6 5.0 6.5 7.5 8.3 <NA>
## 8 OC 0.7 0.8 1.2 <NA> <NA> <NA> <NA>
## 9 ECedS 5.0 4.0 3.0 <NA> <NA> <NA> <NA>
## 10 ESP 20.0 15.0 10.0 <NA> <NA> <NA> <NA>
avocado_suit <- suit("avocado", terrain=terrain_input)
head(avocado_suit[["terrain"]][["Suitability Score"]])
## Flood
## 1 0.4285714
## 2 0.0000000
## 3 0.0000000
## 4 0.0000000
## 5 0.0000000
head(avocado_suit[["terrain"]][["Suitability Class"]])
## Flood
## 1 S3
## 2 N
## 3 N
## 4 N
## 5 N
head(avocado_suit[["soil"]][["Suitability Score"]])
## CFragm SoilDpt
## 1 0.8666667 0.36
## 2 0.6000000 0.48
## 3 0.3333333 0.72
## 4 0.2000000 0.56
## 5 0.4666667 0.24
head(avocado_suit[["soil"]][["Suitability Class"]])
## CFragm SoilDpt
## 1 S1 S3
## 2 S2 S3
## 3 S3 S2
## 4 N S2
## 5 S3 N
For water characteristics, suppose the average rainfall for 3 land units were recorded for four months with the following data:
water_input <- data.frame(
Apr = c(150, 140, 120),
May = c(70, 90, 100),
Jun = c(85, 90, 105)
)
water_input
## Apr May Jun
## 1 150 70 85
## 2 140 90 90
## 3 120 100 105
Note that when specifying the factors for water chacteristics, the month must be specified in three characters (correct case) only, that is, it shouldn’t be specified as January, February, etc.
The suitability scores for rainfed bunded rice water requirement are computed as follows:
RICEBRWater
## code s3_a s2_a s1_a s1_b s2_b s3_b wts
## 1 WmAv1 100.0 125.0 175.0 500 650 750 <NA>
## 2 WmAv2 100.0 125.0 175.0 500 650 750 <NA>
## 3 WmAv3 100.0 125.0 175.0 500 650 750 <NA>
## 4 WmAv4 29.0 30.0 50.0 300 500 600 <NA>
## 5 WmhAv2 30.0 40.0 50.0 90 <NA> <NA> <NA>
## 6 WmhAv4 29.9 30.0 33.0 80 <NA> <NA> <NA>
## 7 WynN 0.44 0.45 0.65 <NA> <NA> <NA> <NA>
water_suit <- suit("ricebr", water=water_input, sow_month=1)
water_suit
## $water
## $`Factors Evaluated`
## [1] "Apr"
##
## $`Suitability Score`
## Apr
## 1 0.8571429
## 2 0.8000000
## 3 0.6857143
##
## $`Suitability Class`
## Apr
## 1 S1
## 2 S1
## 3 S2
##
## $`Factors' Minimum Values`
## Apr
## 0
##
## $`Factors' Maximum Values`
## Apr
## 714.2
##
## $`Factors' Weights`
## [1] NA
##
## $`Crop Evaluated`
## [1] "RICEBRWater"
##
## attr(,"class")
## [1] "suitability"
Setting the sow_month=1
indicates that the factors for
RICEBRWater
’s WmAv1
correspond to January,
WmAv2
to February, WmAv3
to March, and
WmAv4
to April. Thus, the only factors that were targetted
by the water_input
is April. So that, setting the
sow_month=3
, would make WmAv1
of
RICEBRWater
as March, WmAv2
as April, etc.
This in turn targets the months April to Jun.
water_suit <- suit("ricebr", water=water_input, sow_month=3)
water_suit
## $water
## $`Factors Evaluated`
## [1] "Apr" "May" "Jun"
##
## $`Suitability Score`
## Apr May Jun
## 1 0.4444444 0.2074074 0.4857143
## 2 0.4148148 0.2666667 0.5142857
## 3 0.3555556 0.2962963 0.6000000
##
## $`Suitability Class`
## Apr May Jun
## 1 S3 N S3
## 2 S3 S3 S2
## 3 S3 S3 S2
##
## $`Factors' Minimum Values`
## Apr May Jun
## 0 0 0
##
## $`Factors' Maximum Values`
## Apr May Jun
## 880.0 880.0 714.2
##
## $`Factors' Weights`
## [1] NA NA NA
##
## $`Crop Evaluated`
## [1] "RICEBRWater"
##
## attr(,"class")
## [1] "suitability"
Another characteristics that can be targetted is the temperature.
temp_input <- data.frame(
Sep = c(34.2, 35.5, 33.4),
Oct = c(32.5, 34.2, 32.0),
Nov = c(30.3, 32.2, 31.1)
)
RICEBRTemp
## code s3_a s2_a s1_a s1_b s2_b s3_b wts
## 1 TgAv 10 18 24 36 36.1 36.1 1
## 2 TmMaxXm 21 26 30 40 45.0 50.0 <NA>
## 3 TmAv2 10 18 24 36 42.0 45.0 2
## 4 TmMinAv4 7 10 14 25 28.0 30.0 <NA>
temp_suit <- suit("ricebr", temp=temp_input, sow_month=9)
The RICEBRTemp
crop requirement has factor
TmAv2
, which is the mean temperature for the 2nd month.
Thus, setting the sowing month to 9 suggest that the sowing month
started at September, and thus sets TmAv2
to October.
Hence, the factor that was targetted by the input land units is the
October as seen below:
temp_suit
## $temp
## $`Factors Evaluated`
## [1] "Oct"
##
## $`Suitability Score`
## Oct
## 1 0.8863636
## 2 0.8090909
## 3 0.9090909
##
## $`Suitability Class`
## Oct
## 1 S1
## 2 S1
## 3 S1
##
## $`Factors' Minimum Values`
## Oct
## 0
##
## $`Factors' Maximum Values`
## Oct
## 52
##
## $`Factors' Weights`
## [1] 2
##
## $`Crop Evaluated`
## [1] "RICEBRTemp"
##
## attr(,"class")
## [1] "suitability"