dsval / rsplash

rsplash is the R implementation of the Simple process-led algorithms for simulating habitats (SPLASH v.2.0), which comprises robust formulations to compute energy and water fluxes. This R package, wrapping the C++ code, is intended to provide simulations either at site-scale or spatially-distributed, when the grid functionality is used
8 stars 5 forks source link

error in seq.default #1

Open bonushenricus opened 1 year ago

bonushenricus commented 1 year ago

Hello I would try the package to calculate a water budget for a watershed but there is something wrong splash.point(sw_in=200, tc=15, pn=10, lat=44,elev=1800,slop=10,asp=270,soil_data=c(sand=44,clay=2,OM=6,fgravel=12))

Error in seq.default(time_index[1], time_index[length(time_index)], "month") : 'from' should be of lenght=1

run1<-splash.point(
  sw_in=Bourne$forcing$sw_in,   # shortwave radiation W/m2
  tc=Bourne$forcing$Ta,     # air temperature C
  pn= Bourne$forcing$P,     # precipitation mm
  lat=Bourne$md$latitude,       # latitude deg
  elev=Bourne$md$elev_m,        # elevation masl
  slop=Bourne$md$slop_250m, # slope deg
  asp=Bourne$md$asp_250m,       # aspect deg
  soil_data=Bourne$soil,        # soil data: sand,clay,som in w/w %. Gravel v/v %, bulk density g/cm3, and depth to the bedrock (m)**
  Au=Bourne$md$Aups_250m,       # upslope area m2
  resolution=250.0              # resolution pixel dem used to get Au
)

Error in if (class(tc) %in% c("xts", "zoo", "ts")) { : condition has length > 1 Error in exists(cacheKey, where = .rs.CachedDataEnv, inherits = FALSE) : first argument invalid Error in if (maxRows != -1 && nrow(data) > maxRows) data <- head(data, : missing value where TRUE/FALSE is required

dsval commented 1 year ago

Hi, rsplash needs at least one year of data, monthly or daily to do the spin-up, and the dates. The soil data should be a vector of 6 elements. Here is a toy example:

splash toy

test1<-splash.point(sw_in=200sin(seq(0.01,pi,length.out =365)), tc=15sin(seq(0.01,pi,length.out =365)), pn=rgamma(n=365, shape=5, rate=5), lat=44,elev=1800,slop=10,asp=270, soil_data=c(sand=44,clay=2,OM=6,fgravel=12,bd=NA,depth=1), time_index=seq(as.Date('1800-01-01'),as.Date('1800-12-31'),by='day') ) Cheers, David