-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Additions to netCDF Driver to allow Reading from CF-1.8 Encoded Geometries (#1287) #1541
Conversation
…Feature creation yet though
… to be handled in another PR
@rouault While I'm waiting for the last build to pass (or wait for another warning to clean up), what would say is still required for this PR to pass your review (since I made a few other changes since your initial review)? What other changes should be made to get this thing finally pulled up (assuming changes to make CI pass is trivial work that doesn't change the overall structure)? EDIT: Okay so this time it seems like there's some failure from stuff that I didn't touch I'll try synching upstream hopefully this will fix it? |
I've tested a bit the driver with the test_ogrsf utility (
You should likely move the new code you've added in netCDFLayer::GetNextFeature() to the top of netCDFLayer::GetNextRawFeature() instead |
|
Huh interesting, I'll go look at this and see what's up; thanks for finding these issues! I'll go update the test cases with some layer counting assertions too. Update:
|
Okay so I found the culprit, some of the heuristics for the old implementation of vector layers kept detecting a variable (or some?) as Vector layers incompletely, so I disabled these if the dataset has CF >= 1.8. This also means however, that mixing a legacy Vector dataset with CF-1.8 geometries is not possible anymore. Would it be beneficial if I go more fine-grained and manipulate the heuristics themselves and re-enable the ability read from both vector layers that are CF-1.8 and old-WKT style? My latest push has made them mutually exclusive. EDIT: Actually it seems that the driver might have this behavior by default, as I tried this on my permissive implementation and got more or less the same result. EDIT 2: Well actually actually it looks like both the old implementations may freak out when CF-1.8 geometries are added in but work well on their own. Perhaps a target of future refactoring.. |
By the way some random builds (see Travis below) are failing due to tests from other drivers or some random unrelated test seg. faulting (testing code that I didn't write), in these events, would it be useful to...
|
I don't see this as a problem. I guess in the future we might want to generate CF-1.8 geometries, and completely deprecate/remove the WKT approach
Yes, those random failures are annoying. Part of them due to the CI insfrastructure itself. Some of them unexplained, perhaps coming from GDAL itself but hard to reproduce locally |
Alright, 👍 so in that case I guess maybe this is the most elegant solution. Though, on the note of writing CF-1.8 geometries (and I guess this is more suited for #1287) if I were to make another PR for it, would you say that hiding the WKT implementation behind a command line option would be the most appropriate thing to do?
Some of this behavior at least seem a little characteristic of intermittent errors when being reckless with C-style memory management and so perhaps may be produced by buffer overflows? I agree though tracking down these type of errors with CI may be kind of spotty, given the fact that these errors kind of randomly pop up. By the way what other changes would you say need to be made to this PR before I perhaps try to get another go at CI? |
A layer creation option, yes. The existing FEATURE_TYPE one could be extended likely. But honestly, I'm not sure about the point of writing old-style WKT based geometries in WKT once CF-1.8 support is there. I'd largely prefer to see removal of write support for WKT, which is an obscure feature not even used by the people who made me implement it. And at some later point, we could drop the support for WKT reading. The less code, the better.
Perhaps, although the gcc52_stdcpp14_sanitize CI target runs with -fsanitize=undefined -fsanitize=address . So it tracks most such issues. Failures seem to occur mostly on the trusty_32bit and osx configurations, which might have their own pecularities
I'd say we should probably be good once you've addressed my today comments. |
Wow, so the WKT portion is underutilized to that extent. The stuff behind old WKT write capabilities do indeed seem quite a bit to maintain. Maybe another refactoring project :)
Hmm indeed a mystery then. But yeah! Those two builds seem to be the ones that randomly segfault.
Apologies if I read too fast, but I'm not sure which comments from today you are referring to. I did resolve the issues from earlier review however. |
Ah, I see you've fixed them by your later commits. Restarting the OSX build, and we should be good |
EDIT: Nevermind I read incorrectly at first, thanks @rouault ! |
What does this PR do?
This PR includes additions to the netCDF Vector Driver to allow support for retrieving OGRFeature types from a netCDF File encoded utilizing the CF-1.8 standard. It adds support the following six feature types (OGRPoint, OGRLineString, OGRPolygon) and "Multi" collections of those three that are mentioned in the following CF documentation: (https://github.com/cf-convention/cf-conventions/blob/master/ch07.adoc#geometries).
What about backwards compatibility?
This PR preserves backwards compatibility with the earlier WKT representation used for earlier versions of this driver. The new CF-1.8 features are only activated if the input netCDF File if the
Conventions
attribute is of the following {CF-1.x
| (x ≥ 8) }. Otherwise, the driver will not even utilize the new additions to the driver, allowing for the driver to work as before.Testing
Automatic testing is now available as a part of the netCDF-GDAL test suite. Please see the following directory for test cases: https://github.com/wchen329/gdal/tree/master/autotest/gdrivers/data/netcdf-sg
A few more test cases are still being added.
What are related issues/pull requests?
Issue #1287
Tasklist
Environment
What Specifically Could Be Helpful
Information on getting automated tests running on CIInformation about detection of Big Endian through CPL interfaces or specific macros.