jedalong / stampr

r code for stamp
4 stars 1 forks source link

stamp.direction(...): "ModConeModel" cannot be called using the arguments #1

Open JacksonKusack opened 1 year ago

JacksonKusack commented 1 year ago

The ModConeModel option for directional analyses isn't available within the function (Note, I moved the directional methods functions outside of the main 'stamp.direction(...) function in my version):

stamp.direction <- function(stmp,dir.mode="CentroidAngle",ndir=4,group=FALSE){
  #Compute function results based on input method.
  crs_orig <- st_crs(stmp)
  stmp <- st_transform(stmp,crs=4326)

  stmp <- switch(dir.mode,
                 CentroidAngle = CentroidAngle(stmp,group),
                 ConeModel = ConeModel(stmp,ndir),
                 MBRModel = MBRModel(stmp),
                 #ModConeModel = ModConeModel(stmp,ndir),
                 stop(paste("The direction method does not exist: ",dir.mode)))

  stmp <- st_transform(stmp,crs=crs_orig)
  return(stmp)  
}

I assume it is meant to be available, as the help documentation mentions that the function has been altered in this version:

"ModConeModel" – The modified cone model first computes the centroid of the T1 events. Then ndir = 4 or 8 cones are created outward from this centroid to the minimum bounding rectangle of the entire grouping. As described by Robertson et al. (2007) this approach is more accommodating to polygon groups that are irregular in size or shape. The modified cone model method first computes the centroid of all T1 polygons in a STAMP grouping. It then computes the bounding box of ALL events in a STAMP grouping. Then, ndir=4 or 8 cones are computed. In the case of ndir=4, cones radiate from the T1 centroid to the four corners of the bounding box. The result of the modified cone model method is that the cones are not equally spaced, but tailored to the individual STAMP groupings shape. See Robertson et al. (2007) for more detailed information. NOTE: This function has been altered slightly as of stampr v 0.3.

It's an easy fix, just wanted to bring it to your attention.

jedalong commented 1 year ago

@JacksonKusack im going in the field starting thursday can we meet on a coding cafe in november to sort out these issues! thanks for the help! Jed

JacksonKusack commented 1 year ago

Sounds good to me - good luck in the field!

jedalong commented 8 months ago