Skip to content

Migrate from legacy local dods.dap to standard opendap.dap package (#79) - #529

Open
ChrisJohnNOAA wants to merge 5 commits into
ERDDAP:mainfrom
ChrisJohnNOAA:opendap_refactor
Open

Migrate from legacy local dods.dap to standard opendap.dap package (#79)#529
ChrisJohnNOAA wants to merge 5 commits into
ERDDAP:mainfrom
ChrisJohnNOAA:opendap_refactor

Conversation

@ChrisJohnNOAA

Copy link
Copy Markdown
Contributor

Description

  • Migrate from legacy local dods.dap classes to modern standard opendap.dap package
  • Remove the legacy locally-bundled dods.dap package source code from WEB-INF/classes/dods.
  • Change edu.ucar:opendap dependency scope from runtime to compile in pom.xml.
  • Migrate all imports and class references from dods.dap.* to opendap.dap.*.
  • Use standard DConnect2 instead of the legacy DConnect class.
  • Resolve API discrepancies:
    • Adjust new DConnect2(...) invocations to use standard constructors.
    • Map getName() calls on opendap nodes and dimensions to getClearName().
    • Use standard java.util.Enumeration for standard getVariables(), getNames(), and similar methods.
    • Use getValuesIterator() and getContainerN() on Attribute to avoid NoSuchAttributeException.
    • Remove custom/non-standard DBoolean type references.
  • All unit tests pass successfully.
  • Clean up unused DAP_TO_NC task
  • Additional cleanup of now unused functions

Note: a lot of the changed lines are indentation from using DConnect in a try-with-resources.

I'm working on additional changes to migrate to the higher level NetCDF datasets api. This future work should simplify the code, make it more consistent with the classes already using other NetCDF apis, and give us additional benefits (like DAP4 support).

Fixes: Lots of ErrorProne warnings and reduces extreme legacy code that we need to maintain.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist before requesting a review

  • I have performed a self-review of my code
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

ChrisJohnNOAA and others added 5 commits July 23, 2026 01:44
* Migrate from legacy local dods.dap classes to modern standard opendap.dap package

- Remove the legacy locally-bundled `dods.dap` package source code from `WEB-INF/classes/dods`.
- Change `edu.ucar:opendap` dependency scope from `runtime` to `compile` in `pom.xml`.
- Migrate all imports and class references from `dods.dap.*` to `opendap.dap.*`.
- Use standard `DConnect2` instead of the legacy `DConnect` class.
- Resolve API discrepancies:
  * Adjust `new DConnect2(...)` invocations to use standard constructors.
  * Map `getName()` calls on opendap nodes and dimensions to `getClearName()`.
  * Use standard `java.util.Enumeration` for standard `getVariables()`, `getNames()`, and similar methods.
  * Use `getValuesIterator()` and `getContainerN()` on `Attribute` to avoid `NoSuchAttributeException`.
  * Remove custom/non-standard `DBoolean` type references.
- All unit tests pass successfully.

* Clean up unused DAP_TO_NC task
* Additional cleanup of now unused functions
* Refactor EDDGridFromDap and EDDGridFromErddap to use NetCDF-Java APIs

- Replaced low-level opendap.dap classes with high-level NetCDF-Java APIs (NetcdfDatasets, Variable, Range, Section) in constructors, metadata scraping (generateDatasetsXml), lowUpdate, and getSourceData.
- Bypassed DAS/DDS serialization inside quick-restart Nc3 files, instead caching dimension sizes, structures, types, and variable/global attributes directly prefixed (e.g. global:, axis:, vardata:) using NcHelper.writeAttributesToNc3.
- Utilized ucar.ma2.Section slicing inside getSourceData to fetch data variables and subset axis coordinate slices in-place.
- Created getSectionFromConstraints helper on NcHelper.java to DRY and clean up the getSourceData section generation.
* Refactor Opendap.java to use NetCDF Dataset API

Replace legacy DConnect2 and opendap.dap type usage in getGridInfo
and makeGrid methods with high-level NetCDF dataset and variable APIs.
Update callers in OpendapTest.java and OpendapTests.java to align.
Add offline local file test to OpendapTests.java.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant