-
Notifications
You must be signed in to change notification settings - Fork 15
Add support for subset by value in the DAP4 CE syntax #322
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
base: master
Are you sure you want to change the base?
Changes from all commits
f3fbaf0
6e819ce
c564387
5392ab1
85e1577
e9154ee
c8707c9
a5303ab
dac2fad
51ed45e
2f528d1
8e06dd1
cbcba8d
7e41510
21dbe63
0f9019d
b2e2bdb
31b32ea
0013449
87b0892
e4e25a2
d374165
01ff095
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||||||||||||||||||||||||
| # Using cmake to build libdap4 | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| ## how to build outside the source tree | ||||||||||||||||||||||||||||
| ## How to build outside the source tree | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| Make a build directory (or build/libdap4 if libdap4 is a git submodule). | ||||||||||||||||||||||||||||
| Then, in that directory, run cmake with the source directory as a command line | ||||||||||||||||||||||||||||
|
|
@@ -70,3 +70,70 @@ Time to run the unit tests: | |||||||||||||||||||||||||||
| Total Test time (real) = 2.35 sec | ||||||||||||||||||||||||||||
| make test -j20 2.20s user 0.14s system 98% cpu 2.381 total | ||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| ## Using Cmake Presets | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| There are several Presets defined that combine several cmake switches | ||||||||||||||||||||||||||||
| in one setting. For example | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||
| cmake --preset developer | ||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| uses the following options to configure the build: | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||
| Preset CMake variables: | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| BIG_ARRAY_TEST="OFF" | ||||||||||||||||||||||||||||
| BUILD_DEVELOPER="ON" | ||||||||||||||||||||||||||||
| BUILD_TESTING="ON" | ||||||||||||||||||||||||||||
| CMAKE_BUILD_TYPE="Debug" | ||||||||||||||||||||||||||||
| CMAKE_CXX_STANDARD="14" | ||||||||||||||||||||||||||||
| CMAKE_CXX_STANDARD_REQUIRED="ON" | ||||||||||||||||||||||||||||
| CMAKE_INSTALL_PREFIX="$prefix" | ||||||||||||||||||||||||||||
| USE_ASAN="OFF" | ||||||||||||||||||||||||||||
| USE_CPP_11_REGEX="ON" | ||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||
|
Comment on lines
+85
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial | 💤 Low value Add language identifier to fenced code block. Per markdown best practices (markdownlint MD040), fenced code blocks should specify a language identifier. The preset variables block shows text assignments and could use Add language specifier-```
+```text
Preset CMake variables:📝 Committable suggestion
Suggested change
🧰 Tools🪛 markdownlint-cli2 (0.22.1)[warning] 85-85: Fenced code blocks should have a language specified (MD040, fenced-code-language) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| Note that using the preset makes the ```build``` directory and will configure | ||||||||||||||||||||||||||||
| the build to use a directory named for the preset under the ```build``` directory. | ||||||||||||||||||||||||||||
| For the _developer_ preset, that will be ```build/developer```: | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| ```commandline | ||||||||||||||||||||||||||||
| hyrax_git/libdap4 % ls build/developer | ||||||||||||||||||||||||||||
| cmake_install.cmake d4_ce/ http_dap/ Testing/ | ||||||||||||||||||||||||||||
| CMakeCache.txt d4_function/ libdap.pc tests/ | ||||||||||||||||||||||||||||
| CMakeFiles/ dap-config libdap4Config.cmake unit-tests/ | ||||||||||||||||||||||||||||
| config.h DartConfiguration.tcl libdap4ConfigVersion.cmake xdr-datatypes.h | ||||||||||||||||||||||||||||
| CTestTestfile.cmake dods-datatypes.h Makefile | ||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| You can run the build using cmake from the top -level of the repo like this: | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||
| cmake --build . --preset developer --parallel | ||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| and run the tests like this: | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||
| ctest --preset developer | ||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| The ```ctest``` program does that ```--parallel``` but don't use that with libdap | ||||||||||||||||||||||||||||
| until the test tolls are made thread safe. If you do use ```--parallel``` by mistake | ||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial | 💤 Low value Simplify "by mistake" phrasing. The phrase "by mistake" is wordy; consider a more concise alternative like "incorrectly" or "accidentally." Simplify wording-If you do use ```--parallel``` by mistake then clean the dirs and re-run the tests.
+If you do use ```--parallel``` incorrectly, clean the dirs and re-run the tests.📝 Committable suggestion
Suggested change
🧰 Tools🪛 LanguageTool[style] ~125-~125: ‘by mistake’ might be wordy. Consider a shorter alternative. (EN_WORDINESS_PREMIUM_BY_MISTAKE) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||||||||||||||||||||||||
| then clean the dirs and re-run the tests. Until the tests are more solid, it might | ||||||||||||||||||||||||||||
| be best to just ```rm -rf build``` and start over. There are special targets to | ||||||||||||||||||||||||||||
| clean out the temp files made by the tests, that target is called _clean-tests_. | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| To use ```cmake``` to run a custom target, use this syntax: | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||
| cmake --build . --preset developer --parallel --target clean-tests | ||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| ## You can still use _make_ | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| To use _make_, just cd to ```build/developer``` and run the usual commands to | ||||||||||||||||||||||||||||
| build an install the code. Use the target _test_ to run the tests. | ||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,9 +61,9 @@ class D4ConstraintEvaluator { | |
| bool empty = false; | ||
| // When a slice is applied to an Array with Maps, we need to know the name of | ||
| // each dimension. These names are then used to apply the slice to each of the | ||
| // Maps (Maps may have fewer dimensions than the Array, but the idea that a | ||
| // Maps. Maps may have fewer dimensions than the Array, but the idea that a | ||
| // Map is a simple vector doesn't hold for DAP4, so the mapping between a slice's | ||
| // indexes and the set of Maps can be complex - use the names to make sure | ||
| // indexes and the set of Maps can be complex. Use the names to make sure | ||
| // all cases are covered. The value of this field may be empty. | ||
| std::string dim_name; | ||
|
|
||
|
|
@@ -83,6 +83,16 @@ class D4ConstraintEvaluator { | |
| static index make_index(const std::string &i, const std::string &s); | ||
| static index make_index(const std::string &i, int64_t s); | ||
|
|
||
| // For now, if a value-based subset is given, return the entire dimension. jhrg 12/23/25 | ||
| // start and end | ||
| static index make_value_based_index(const std::string &, const std::string &) { | ||
| return index(0, 1, 0, false, false, ""); | ||
| } | ||
| // start, stride, end | ||
| static index make_value_based_index(const std::string &, const std::string &, const std::string &) { | ||
| return index(0, 1, 0, false, false, ""); | ||
| } | ||
|
Comment on lines
+86
to
+94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don’t silently coerce value-based slices to a fixed Both overloads discard parsed VBS values and return a concrete fixed index ( 🤖 Prompt for AI Agents |
||
|
|
||
| bool d_trace_scanning = false; | ||
| bool d_trace_parsing = false; | ||
| bool d_result = false; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -477,3 +477,37 @@ dmr_series_test(177 names_with_spaces2.dmr "/inst2/\"Point%20Break\".x" names_wi | |
|
|
||
| dmr_series_test(178 names_with_spaces3.dmr "/inst2/\"New Group\"/x" names_with_spaces3.dmr.1.trans_base "xfail") | ||
| dmr_series_test(179 names_with_spaces3.dmr "/inst2/New%20Group/x" names_with_spaces3.dmr.1.trans_base "xfail") | ||
|
|
||
| # Test the value-based subsetting syntax addition. NB: vbs (value-based subsetting). jhrg 12/29/25 | ||
| # This is the baseline version to start with - the temporary hack for the parsing uses an 'index' | ||
| # of 0:1:0. Thus, _for now_, all these CEs return the same values. That will change once the work | ||
| # moves forward. | ||
|
|
||
| # NB: test_array_4.xml uses shared dimensions, to the indicial syntax parses, but it does not | ||
| # have Maps, so this kind of subsetting will actually fail. Make sure that these six following | ||
| # tests _do_ fail once the VBS logic is coded. jhrg 12/29/25 | ||
| dmr_trans_test(180 test_array_4.xml "/row=[0];/col=[0];a[][]" "" test_array_4.xml.vbs.1a.trans_base "universal") | ||
| dmr_trans_test(181 test_array_4.xml "/row=[(0):(1)];/col=[(0):(1)];a[][]" "" test_array_4.xml.vbs.1a.trans_base "universal") | ||
| dmr_trans_test(182 test_array_4.xml "/row=[(10):(11.11)];/col=[(0.4):(-10.7)];a[][]" "" test_array_4.xml.vbs.1a.trans_base "universal") | ||
|
|
||
| # The above tests were derived from, and use the same baselines as, these three below. jhrg 12/29/25 | ||
| # DMR_TRANS_CE_NO_CRC([test_array_4.xml], [/row=[0];/col=[0];a[][] ], [test_array_4.xml.vbs.1a.trans_base], [pass]) | ||
| # DMR_TRANS_CE_NO_CRC([test_array_4.xml], [/row=[(0):(1)];/col=[(0):(1)];a[][] ], [test_array_4.xml.vbs.1a.trans_base], [pass]) | ||
| # DMR_TRANS_CE_NO_CRC([test_array_4.xml], [/row=[(10):(11.11)];/col=[(0.4):(-10.7)];a[][] ], [test_array_4.xml.vbs.1a.trans_base], [pass]) | ||
|
|
||
| dmr_trans_test(183 test_array_4.xml "/row=[0];/col=[0];x[][]" "" test_array_4.xml.vbs.1x.trans_base "universal") | ||
| dmr_trans_test(184 test_array_4.xml "/row=[(0):(1)];/col=[(0):(1)];x[][]" "" test_array_4.xml.vbs.1x.trans_base "universal") | ||
| dmr_trans_test(185 test_array_4.xml "/row=[(10):(11.11)];/col=[(0.4):(-10.7)];x[][]" "" test_array_4.xml.vbs.1x.trans_base "universal") | ||
|
|
||
| # DMR_TRANS_CE_NO_CRC([test_array_4.xml], [/row=[0];/col=[0];x[][] ], [test_array_4.xml.vbs.1x.trans_base], [pass]) | ||
| # DMR_TRANS_CE_NO_CRC([test_array_4.xml], [/row=[(0):(1)];/col=[(0):(1)];x[][] ], [test_array_4.xml.vbs.1x.trans_base], [pass]) | ||
| # DMR_TRANS_CE_NO_CRC([test_array_4.xml], [/row=[(10):(11.11)];/col=[(0.4):(-10.7)];x[][] ], [test_array_4.xml.vbs.1x.trans_base], [pass]) | ||
|
|
||
| # NB: vol_1_ce_7.xml has Maps and this should not only parse but also subset by value. jhrg 12/29/25 | ||
| dmr_trans_test(186 vol_1_ce_7.xml "nlon=[0:2];nlat=[0];temp[][]" "" vol_1_ce_7.xml.vbs.1.trans_base "universal") | ||
| dmr_trans_test(187 vol_1_ce_7.xml "nlon=[0:2];nlat=[(10.0):(-17.9)];temp[][]" "" vol_1_ce_7.xml.vbs.1.trans_base "universal") | ||
| dmr_trans_test(188 vol_1_ce_7.xml "nlon=[0:2];nlat=[(0.09):(-17.9)];temp[][]" "" vol_1_ce_7.xml.vbs.1.trans_base "universal") | ||
|
|
||
| # DMR_TRANS_CE_NO_CRC([vol_1_ce_7.xml], [nlon=[0:2];nlat=[0];temp[][] ], [vol_1_ce_7.xml.vbs.1.trans_base], [pass]) | ||
| # DMR_TRANS_CE_NO_CRC([vol_1_ce_7.xml], [nlon=[0:2];nlat=[(10.0):(-17.9)];temp[][] ], [vol_1_ce_7.xml.vbs.1.trans_base], [pass]) | ||
| # DMR_TRANS_CE_NO_CRC([vol_1_ce_7.xml], [nlon=[0:2];nlat=[(0.09):(-17.9)];temp[][] ], [vol_1_ce_7.xml.vbs.1.trans_base], [pass]) | ||
|
Comment on lines
+481
to
+513
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VBS tests currently lock in placeholder behavior instead of semantic correctness. Line 481–Line 513 document that parsing is still using a temporary index hack, but the tests are still asserted as normal passing baseline matches. This makes CI green even when value-based subsetting is not actually being validated (especially for the map-backed Before merge, switch these to semantic expectations (e.g., explicit xfail/pass split and distinct expected outputs for value-ranged cases) so the suite fails when VBS evaluation is wrong rather than preserving the temporary parser-only behavior. 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial | 💤 Low value
Align CMake capitalization with conventions.
The heading should use "CMake" (capital M) per the CMake project naming standard and consistency with other references in the document.
Fix capitalization
📝 Committable suggestion
🤖 Prompt for AI Agents
Source: Linters/SAST tools