parseRotationStrings: Parse Crop Rotations from Experiment String Code

Description Usage Arguments Examples

View source: R/write_xdb_helper_funs.R

Description

This function extracts rotation and management level parameters for one experiment. Outputs a data frame containing year, crop, and irrigation status, along with nldas and soil codes.

Usage

1
parseRotationStrings(ExpCode, startyear, cropkey)

Arguments

ExpCode

One text string denoting sequence of annual climate-soil-crop-irrigation rotations, separated by '_'

startyear

year to start experiment

cropkey

Look up table for CDL crop codes. column names should be 'cropCode' and 'crop'

Examples

1
2
3
4
5
6
7
8
# make inputs
expCode <- '20266874911230010_20266874911230010_20266874911230010_20266874911231760_20266874911230010_20266874911230610_20266874911230010_20266874911230040_20266874911230240_20266874911230240_20266874911230611'
sYear <- 2006
cropkey <- data.frame(cropCode = c('001','004','005','024','061','176'),
                      crop = c('CORN','SORGHUM','SOYBEANS','WHEAT',
                                   'FALLOW','GRASS'))

rotations <- parseRotationStrings(expCode, sYear, cropkey)

jdeines/salustools documentation built on May 29, 2019, 1:03 a.m.