-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPC square-bracket horizon subsetting with index of length 1 causes Spatial errors #85
Comments
Note: there is an unrelated issue for fixing some edge cases in clod.hz.ids() -- it may be related to issues with single horizon results, but is not the cause of the Spatial error #86 |
I am pretty sure that this is now fixed for all new This issue is mostly resolved for Simple example. library(aqp)
d <- data.frame(
id='001',
name=c('A', 'A/E', 'A/E', 'Bhs1', 'Bhs2', 'C1', 'C2'),
top=c(0,5,5,10,20,50,80),
bottom=c(5,10,10,20,50,80,100),
var=c(15, 4, 8, 15, 18, 2, 3),
v2=1,
stringsAsFactors=FALSE
)
depths(d) <- id ~ top + bottom
# check: https://github.com/ncss-tech/aqp/issues/85
d@sp
# new check for valid SpatialPoints
validSpatialData(d)
# error
slice(d, 0:50 ~ ., strict=TRUE)
# warnings
s <- slice(d, 0:50 ~ ., strict=FALSE)
# works now
# previously an error due to
# faulty logic testing for 'real' SpatialPoints data
s[1, 8] |
@brownag I'll close after you test. |
Still errors with an uninitialized spatial object. This is with the latest version of soilDB and aqp (reinstalled several times, both last friday and toda)
works when initialized
|
This is still an issue
|
The underlying problem has been fixed, but some kind of namespace-related bug is preventing the new S4 class from being used. This only happens when loading the Moving this into a new The following works fine: library(aqp)
data("loafercreek", package = 'soilDB')
d <- data.frame(
id='001',
name=c('A', 'A/E', 'A/E', 'Bhs1', 'Bhs2', 'C1', 'C2'),
top=c(0,5,5,10,20,50,80),
bottom=c(5,10,10,20,50,80,100),
var=c(15, 4, 8, 15, 18, 2, 3),
v2=1,
stringsAsFactors=FALSE
)
depths(d) <- id ~ top + bottom
slot(d, 'sp')
slot(loafercreek, 'sp') |
I first noticed this (SPDF results) when I was trying to use horizon-index subsetting on multi-profile SPCs for early versions of the Loafercreek demo. I never really investigated it further, but it seemed like a bug. I've also noticed that accessing the @sp slot results in an error before elevation of the SPC to have SpatialPoints.
However, when I was investigating some of the logic in
clod.hz.ids()
for newglom()
demo, I ran into this problem again. Check out this example.Key error message:
The text was updated successfully, but these errors were encountered: