Closed MollicMeyer closed 7 months ago
When we select a handful, the function works properly. So it must be something on our end in NASIS. Perhaps incongruent numbers of matching sites and pedons?
Not sure without knowing the exact record IDs or some other way to "find" these sites/pedons. Try setting lab = FALSE
.
Also, consider updating to the latest versions of soilDB and aqp.
Sites = 8921; Pedons = 9341
The latest versions are installed. And setting lab = FALSE
caused it to work for the whole selected set. However, the lab data is what we're chasing after.
My guess is this is due to pedon horizons with more than one phlabresults
record which are missing "sampledepthtop"
and/or "sampledepthbottom"
values. This causes the weights used in the case of many:1 relationship to be missing i.e. NOTICE: multiple phiid values exist in the phlabresults table, computing weighted averages and dominant values based on horizon thickness
I will see if I can come up with a workaround based on this diagnosis, but in the meantime look for instances that meet these conditions (multiple lab sample records per pedon horizon without sample depths) and fix/remove them from your selected set.
OK good.
I very much doubt you want these "lab data", unless you or someone you know has done some local characterization and put those values into the Horizon Lab Results table. If you are after the Soil Characterization Database records, it will take multiple requests to two different databases.
That makes sense @brownag thank you, I will take a look. And @dylanbeaudette that's a valid point, but we have a student expanding on some other work from a previous grad that looked at the relationship between field and lab particle size fractions estimates and their utility.
@MollicMeyer I think this is fixed by https://github.com/ncss-tech/soilDB/commit/a5375d47e2454c929cbcdd99113229340c7e3191. Please install latest off GitHub master branch and let me know
I believe only the categorical variables in the many:1 case needed fixing, the numeric cases correctly return NA
value (rather than 0-length) if the weights are missing.
Now, in the case where the selection of categorical data can't be made based on the relative thickness of the subsample, the first record is taken--which corresponds to the first record with shallowest sampledepthtop
within phiid
(based on the sort order set by the phlabresults
query).
Possibly the message needs to be further updated to indicate that some of the weights were missing, and that the source data should be inspected (done in https://github.com/ncss-tech/soilDB/commit/3c63e3de671c5b4f7a4de0eab57ad43f75796574)
Thank you! I will test it out shortly and let you know.
That seemed to solve the problem. The download completed correctly!
I'm working with a selected set from eastern SD. I've never had this issue before. Any ideas why the dataframe won't build?