-
Notifications
You must be signed in to change notification settings - Fork 19
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
Not all components are being returned by FetchNASIS #82
Comments
My apologies. I misread my tabular data from the GIS, and I am not sure how. That wasn't even the mukey or dmu. Since then, I have figured out that it wasn't the actual Schoolcraft component that lacked the horizon data, but a minor component. I I knew that the area was mostly Schoolcraft and saw the map unit name, but forgot to have my export only show major components. |
Apologies. I must have misread the id from the GIS. I am not sure where that record id came from. I have also forgot to restrict my export to major components, so the actual component was not Schoolcraft. The Schoolcraft happened to have all its horizon data. This is the component which lacked horizon data: I have confirmed that it is present in NASIS. I also found that the problem is not limited to minor components, in this case a Riddles map unit has only horizon data with the minor Kalamazoo component: lmapunitiid compname coiid dmuiid nationalmusym muname horizon data? majcompflag I will follow up by trying those get component functions one by one. |
For the following, $coiid %in% '885254' applies.get1 <- get_component_data_from_NASIS_db() --> 1 obs Thus, horizon, parent material, and geomorph data is present. It lacks only ecosite, veg, and diaghz data. I also tried a component that didn't come up with missing data by the fetchNASIS function; it also lacked the same three data tables. |
My earlier claim that rmHzErrors=F does not work is proven to be an error. I ran the script again with this remove errors turned off. All the components and their horizon data are now showing up. I don't know why it appeared not to work before. It could be that output file was not refreshed due to a file lock by ArcGIS. Anyhow, I now think it is probably a matter of data population, and not a bug in the code. |
No worries! Thank you for including the necessary info so we can try and replicate your issue! Maybe the number was the COKEY (SSURGO) as opposed to COIID (NASIS)? I didn't check what you gave against COKEYs. Now, down to the real problem: horizon data in NASIS not getting reflected in the fetchNASIS SPC For Sleeth component in the natmusym '68nt' I get the same results from the lower-level fetch functions:
Now, when we try to get it from fetchNASIS_components() ... we find there is a horizon error in the 885254 component:
And I just saw your comment. I was gonna track down your horizon error |
Testing horizon logic for one of the offending components:
When the test_hz_logic() strict=FALSE flag is set, the only thing that results in hz logic fail is NA or overlapping horizons. When you look at the horizons for the offending component (via R) the problem becomes apparent (the Bt horizon is duplicated)
This often happens when one or more child tables of the offending have multiple values marked as RV. fetchNASIS() attempts to "flatten" the heirarchical relations from the database, and often the RV record is used to reduce that many:one relationship. Here --- it is an issue with two RVs marked in the structure table This is another instance of issues #32 #58 & #66; the main issue is NASIS doesn't have any front end validation to prevent you having multiple RVs checked off. We need to explicitly handle the cases with multiple RVs |
This might be another reason to switch the default value of |
In order to avoid giving too much weight to this horizon, I should probably filter it out by averaging the quantitative values and returning only the first of the text values. If this is at all representative of the errors, however, all I'll really need to do is omit the 'structgrpname' field as irrelevant to ecosites, and then redefine the table using the unique() function. |
Greg, yes, I also would be concerned about accidentally including the duplicated HZ in subsequent analysis if leaving rmHzErrors=F Unfortunately, the issue with many:one flattening / duplication of RV records in child tables also affects things like texture group which are likely more related to ES concepts than structuregrp is. The reason this has not been fixed sooner is the decision about which RV to reflect in the result is not straightforward. If two different records are marked RV, which one is actually representative? In the case where you get overlap from multiple RVs within a single NASIS record, all data will be the same in the record with the exception of the attribute(s) that had multiple RVs. This issue is complicated further by the fact that certain types of horizons (combination horizons; e.g. A/C) are internally represented by NASIS as overlapping horizons. Presumably, at least some of the component horizon level attributes (texture, clay content, etc.) will be different in these "intentionally overlapping" cases. Your approach of averaging would be a good one in that it would deal with both the identical data issue, as well as combination horizons (assuming you got the weighting of the different "kinds" of horizon material sorted out). Averaging is easy enough to implement in a particular function that summarizes a pedon/component's horizon data and returns a value (or set of values) for each input profile, but becomes more challenging with putting your modified representation back into the original SPC. |
Thanks Andrew. I can dispense with the texture field as well, since I quantify weighted averages for sand, clay, organic matter, and pH for a 0-50 cm and a 0-150 cm depth zones, before I arrive at my groupings. As far as I am aware, our B/E horizons are populated for the components as a composite texture of the two materials. However, I am told that this is not the case with pedons, . |
OK, sounds excellent! I think the composite approach is probably very very common for the component data, especially where any of the NASIS horizon-level calculations are involved. And luckily the combination horizons are pretty rare in general. So unlikely to cause major problems, but nonetheless the averaging approach would be the safest if you had to deal with those data. |
A minority of map units that are not being captured by fetchNASIS. I am not sure if bug or data population/validation error. I queried the national database for all components located in area = MI077 (Kalamazoo County), and was able to see that the Schoolcraft coiid == 291548 was in the local database. But this among other components were missing from my NASIS import into R.
fc <- fetchNASIS(from='components', fill=TRUE, SS=F)
I’ve even tried making rmHzErrors=F
The text was updated successfully, but these errors were encountered: