[ZFDB] Refactoring of Chunking + Documentation Update#290
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #290 +/- ##
===========================================
+ Coverage 71.47% 72.08% +0.61%
===========================================
Files 372 378 +6
Lines 23510 23908 +398
Branches 2464 2509 +45
===========================================
+ Hits 16803 17235 +432
+ Misses 6707 6673 -34 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
b404bca to
636a611
Compare
There was a problem hiding this comment.
Pull request overview
Refactors Z3FDB/chunked_data_view chunking to support fixed-size “individual chunk” shapes, reworks chunk access around bounding-box intersections, and updates the Python/Zarr interface and documentation accordingly.
Changes:
- Add
IndividualChunkchunking (with configurable chunk size) across C++ core, Python wrapper, and bindings. - Introduce bounding-box based request slicing / buffer mapping and add new C++ + Python tests.
- Propagate
fillValueinto Zarr metadata and expose it through the Python API; expand/refresh the docs set.
Reviewed changes
Copilot reviewed 61 out of 61 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/z3fdb/test_store_v3_parts.py | Formatting adjustments in existing Z3FDB tests. |
| tests/z3fdb/test_store_v3_individual_chunking.py | New Z3FDB tests covering IndividualChunk across multi-part/axis layouts. |
| tests/pychunked_data_view/test_chunked_data_view.py | Adds Python-side tests for IndividualChunk and fill value behavior. |
| tests/conftest.py | Adds function-scoped temp fixture and changes FDB setup fixture scope/storage location. |
| tests/chunked_data_view/test_view.cc | Refactors tests to shared mock helpers + updated builder/extractor API. |
| tests/chunked_data_view/test_view_individual_chunking.cc | New C++ tests for IndividualChunking behavior. |
| tests/chunked_data_view/test_request_manipulation_bounding_box.cc | New tests for request slicing via bounding boxes. |
| tests/chunked_data_view/test_mock_helpers.h | New shared mock helper utilities for chunked_data_view tests. |
| tests/chunked_data_view/test_index_mapper.cc | Updates include path + adds/changes computeBufferIndex tests. |
| tests/chunked_data_view/test_builder.cc | Removes old builder-focused tests (replaced by other suites). |
| tests/chunked_data_view/test_bounding_box.cc | New unit tests for BoundingBox behavior. |
| tests/chunked_data_view/test_axis.cc | Updates RequestManipulation API usage in axis tests. |
| tests/chunked_data_view/CMakeLists.txt | Registers new/renamed C++ test targets. |
| src/z3fdb/_internal/zarr.py | Uses ChunkedDataView’s configured fill value in Zarr metadata. |
| src/pychunked_data_view/chunked_data_view.py | Adds Chunking.IndividualChunk, fill value plumbing, and translation updates. |
| src/chunked_data_view/ViewPart.h | Introduces BoundingBox + ViewPart refactor toward bounding-box based access. |
| src/chunked_data_view/ViewPart.cc | Implements BoundingBox operations and ViewPart construction/slicing. |
| src/chunked_data_view/RequestManipulation.h | Adds selectRequest + range-based updateRequest API. |
| src/chunked_data_view/RequestManipulation.cc | Implements bounding-box selection logic and alignment checks. |
| src/chunked_data_view/mapping/IndexMapper.h | New header for buffer-index and delinearization utilities. |
| src/chunked_data_view/mapping/IndexMapper.cc | Implements new computeBufferIndex and index mapping logic. |
| src/chunked_data_view/mapping/AxisMapper.h | New mapper from AxisDefinition to (Axis, AxisChunks). |
| src/chunked_data_view/mapping/AxisMapper.cc | Implements mapping + chunk-size validation. |
| src/chunked_data_view/IndexMapper.h | Removes old IndexMapper interface header. |
| src/chunked_data_view/include/chunked_data_view/Types.h | Introduces BoundingBox type aliases for coordinate spaces. |
| src/chunked_data_view/include/chunked_data_view/ListIterator.h | Documentation/comments for iterator interface/wrapper. |
| src/chunked_data_view/include/chunked_data_view/LibChunkedDataView.h | Adds/clarifies library-level documentation comments. |
| src/chunked_data_view/include/chunked_data_view/Fdb.h | Documents FDB abstraction and factory. |
| src/chunked_data_view/include/chunked_data_view/Extractor.h | Refactors Extractor API to extractInto based on bounding boxes. |
| src/chunked_data_view/include/chunked_data_view/ChunkedDataViewBuilder.h | Builder now supports fill value + shared extractor ownership + optional config path. |
| src/chunked_data_view/include/chunked_data_view/ChunkedDataView.h | Adds fillValue() to the view interface and improves docs. |
| src/chunked_data_view/include/chunked_data_view/DataLayout.h | Adds clarifying docs/comments. |
| src/chunked_data_view/include/chunked_data_view/AxisDefinition.h | Adds SingleValue vs Individual chunking and improves docs. |
| src/chunked_data_view/GribExtractor.h | Refactors GRIB extractor to new layout/extractInto API. |
| src/chunked_data_view/GribExtractor.cc | Implements new extraction path + buffer-index mapping. |
| src/chunked_data_view/Extractor.cc | Removes old extractor factory implementation. |
| src/chunked_data_view/ChunkedDataViewBuilder.cc | Builds ViewParts via AxisMapper + new Extractor API; offsets/extension handling. |
| src/chunked_data_view/ChunkedDataViewImpl.h | Holds (ViewPart, Extractor) pairs + fill value; updated shape/chunk computations. |
| src/chunked_data_view/ChunkedDataViewImpl.cc | Implements chunk intersection routing and per-part extraction. |
| src/chunked_data_view/Axis.h | Adds AxisChunks and refactors Axis to remove “chunked” flag. |
| src/chunked_data_view/Axis.cc | Updates Axis constructor and error text. |
| src/chunked_data_view/include/chunked_data_view/Buffer.h | Removes old Buffer type. |
| src/chunked_data_view/Buffer.h | Removes old Buffer type. |
| src/chunked_data_view/include/chunked_data_view/exception/*.h | Adds new exception types for clearer failure modes. |
| src/chunked_data_view/exception/*.cc | Implements new exception types. |
| src/chunked_data_view/CMakeLists.txt | Removes Buffer/old IndexMapper; adds mapping + exception sources. |
| src/chunked_data_view_bindings/bindings.cc | Updates pybind API for new chunking types and builder/extractor wiring. |
| docs/z3fdb/technical_insights.rst | New internal mechanics explanation (bounding boxes, buffer mapping). |
| docs/z3fdb/index.rst | Restructures landing page and adds “getting_started” + “technical_insights”. |
| docs/z3fdb/getting_started.rst | New guided tutorial for first-time users. |
| docs/z3fdb/dimension_mapping.rst | Expands data model/coordinate system + documents IndividualChunk + fill value. |
| docs/z3fdb/architecture.rst | Adds layer descriptions to architecture overview. |
| docs/z3fdb/api.rst | Documents IndividualChunk and fill value API. |
Comments suppressed due to low confidence (3)
src/chunked_data_view/mapping/IndexMapper.cc:66
- The reverse loop uses
int i = axes.size() - 1, which is fragile (underflow ifaxes.size()==0) and can trigger signed/unsigned warnings. Use the standardsize_t i = axes.size(); i-- > 0;idiom.
src/chunked_data_view/ChunkedDataViewImpl.cc:124 ChunkedDataViewImpl::at()never initializes the output buffer withfillValue_. Any positions not written by an extractor (e.g. uncovered by any part, or out-of-array in edge chunks) will contain uninitialized data. Also consider validatinglenbefore writing.
void ChunkedDataViewImpl::at(const std::vector<size_t>& chunkIndex, float* ptr, size_t len) {
if (chunkIndex.size() != chunks_.size()) {
std::ostringstream ss;
ss << "ChunkedDataViewImpl::at: Expected chunk index of dimension " << chunks_.size() << ", got dimension "
<< chunkIndex.size();
throw eckit::UserError(ss.str());
src/chunked_data_view/ChunkedDataViewImpl.cc:21
- The suggested fix for initializing the buffer uses
std::fill, but this file currently doesn't include<algorithm>, so it won't compile once added. Add the include.
#include "chunked_data_view/exception/GribExtractorException.h"
#include <cstddef>
#include <ostream>
#include <sstream>
#include <utility>
#include <vector>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
890531f to
51f85f8
Compare
caraghbiner
left a comment
There was a problem hiding this comment.
It's a very big PR. I only looked at the docs as I said I would. Overall they looked nice to me.
cb1da20 to
db0158a
Compare
d513c22 to
1a746e8
Compare
cbbb4e3 to
38b3005
Compare
Also removed dead code which triggered an impossible scenario of the bounding box check and therefore caused an underflow in the size_t.
Move internal mappings logic to own subfolder
The fill value in the builder of views is now taken in consideration during the extraction of data from the GRIB messages. If the numerical value of a missing value in the GRIB message is encountered, the value gets replaced by the specified fill_value of the builder.
The check in ChunkedDataViewImpl for extensionAxisIndex being in bounds was in the wrong position. Moved it in front of the first write access.
Instead of using strings as a representation of the MARS request, use user-defined dictionaries.
38b3005 to
4c75f61
Compare
caraghbiner
left a comment
There was a problem hiding this comment.
Some fairly trivial changes requested.
c5aafaf to
a2095ef
Compare
a6507be to
92fa553
Compare
92fa553 to
41278f8
Compare
Description
Refactor of ZFDB handling chunking besides non and individual.
Contributor Declaration
By opening this pull request, I affirm the following:
🌈🌦️📖🚧 Documentation FDB 🚧📖🌦️🌈
https://sites.ecmwf.int/docs/fdb/pull-requests/PR-290