Skip to content

Blockwise documentation#936

Merged
belletva merged 16 commits into
GlacioHack:mainfrom
ould-a:blockwise-documentation
Apr 28, 2026
Merged

Blockwise documentation#936
belletva merged 16 commits into
GlacioHack:mainfrom
ould-a:blockwise-documentation

Conversation

@ould-a
Copy link
Copy Markdown
Contributor

@ould-a ould-a commented Mar 16, 2026

Resolves #868

The aim of this PR is to rewrite the blockwise documentation, both in the coregistration section and in the advanced example.

@belletva , @adehecq , @rhugonnet here are the links to the read the docs:

For the coregistration section:
https://xdem-ould-a.readthedocs.io/en/latest/coregistration.html#dividing-coregistration-in-blocks

For the example:
https://xdem-ould-a.readthedocs.io/en/latest/advanced_examples/plot_blockwise_coreg.html

@ould-a ould-a marked this pull request as draft March 16, 2026 16:47
@ould-a ould-a marked this pull request as ready for review April 15, 2026 07:59
@ould-a ould-a changed the title [WIP] Blockwise documentation Blockwise documentation Apr 15, 2026
Comment thread doc/source/coregistration.md Outdated
@@ -580,9 +580,7 @@ coregistration methods and for translation only. Rotation shifts will be soon im
Please set `only_translation=True` when initializing the coregistration method ICP(), LZD() or CPD().
Copy link
Copy Markdown
Contributor

@belletva belletva Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xdem.coreg.ICP, xdem.coreg.LZD or xdem.coreg.CPD

Comment thread doc/source/coregistration.md Outdated
A {class}`~xdem.coreg.BlockwiseCoreg` splits a coregistration across different spatial blocks of an elevation dataset, running that
method independently in each block.
By default, these blocks are loaded sequentially to reduce the memory used during a coregistration.
A {class}`~xdem.coreg.BlockwiseCoreg` splits DEMs into grids, then a coregistration method runs independently in each block. Afterwards, an interpolation method is used to obtain the overall offset. The advantages of this tool are that memory consumption is reduced and local errors are better detected.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you delete the information that the blocks are loaded sequentially to reduce the memory used ? I think this part is really important

Comment thread doc/source/coregistration.md Outdated
A {class}`~xdem.coreg.BlockwiseCoreg` splits a coregistration across different spatial blocks of an elevation dataset, running that
method independently in each block.
By default, these blocks are loaded sequentially to reduce the memory used during a coregistration.
A {class}`~xdem.coreg.BlockwiseCoreg` splits DEMs into grids, then a coregistration method runs independently in each block. Afterwards, an interpolation method is used to obtain the overall offset. The advantages of this tool are that memory consumption is reduced and local errors are better detected.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not clear that it is the same coregistration method for each block

Comment thread doc/source/coregistration.md Outdated
These two parameters do **not** need to be the same size.
```

In this example, processing is performed sequentially. However, it is possible to enable multiprocessing on {class}`~xdem.coreg.BlockwiseCoreg`, the configuration is described in the advanced example.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a link to this example

Comment thread doc/source/coregistration.md Outdated
blockwise.fit(ref_dem, tba_dem_shifted)
```

To give you a clearer picture, here is how {func}`~xdem.coreg.BlockwiseCoreg.fit`, divides a DEM with a block size of 500.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

block_size_fit

# Create a configuration without multiprocessing cluster (tasks will be processed sequentially)
mp_config = MultiprocConfig(chunk_size=500, outfile="aligned_dem.tif", cluster=None)
blockwise = xdem.coreg.BlockwiseCoreg(xdem.coreg.NuthKaab(), mp_config=mp_config)
# BlockwiseCoreg is also available without mp_config but with parent_path parameters.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment " BlockwiseCoreg is also available without mp_config but with parent_path parameters." is not clear for me

Comment thread doc/source/coregistration.md Outdated
A {class}`~xdem.coreg.BlockwiseCoreg` splits a coregistration across different spatial blocks of an elevation dataset, running that
method independently in each block.
By default, these blocks are loaded sequentially to reduce the memory used during a coregistration.
A {class}`~xdem.coreg.BlockwiseCoreg` splits DEMs into grids, then a coregistration method runs independently in each block. Afterwards, an interpolation method is used to obtain the overall offset. The advantages of this tool are that memory consumption is reduced and local errors are better detected.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Interpolation method": Maybe "interpolation" or "aggregation" method: We want to support things like the mean over all blocks (what many people do), not only the more advanced 2D fitting done in the current Blockwise.
Final statement: The primary objective is to better correct identify and local errors. Additionally, it makes scalable execution (which includes parallel processing and out-of-memory considerations) straightforward, but we do intend to support scalable execution also directly in normal coregistration (pretty close now), so it's not the main objective here.

Don't worry too much about it, I can also update this later on when I add the Scalability documentation in xDEM 😉

Comment thread doc/source/coregistration.md Outdated
blockwise.fit(ref_dem, tba_dem_shifted)
```

To give you a clearer picture, here is how {func}`~xdem.coreg.BlockwiseCoreg.fit`, divides a DEM with a block size of 500.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stylistic, but it's not common practice to use active voice ('we', "you") in the documentation, except for big notes in landing pages or so ("If you want to convert your GDAL pipeline, this is what you do..."), but not in feature pages of documentation.

@ould-a
Copy link
Copy Markdown
Contributor Author

ould-a commented Apr 16, 2026

Hello,

Thank you for your feedback !

I have corrected the formatting issues. Regarding the blockwise description paragraph, I have revised it to first explain local errors detection, and then detail the sequential process, as well as the possibility of use larger datasets.

I'm still not sure how I approached interpolation and aggregation.

rhugonnet
rhugonnet previously approved these changes Apr 16, 2026
Copy link
Copy Markdown
Member

@rhugonnet rhugonnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Perfect, no need to polish the aggregation/interpolation too much, as this will be adjusted in the PRs that will add the aggregagation!

belletva
belletva previously approved these changes Apr 28, 2026
Copy link
Copy Markdown
Contributor

@belletva belletva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good for me

@belletva belletva dismissed their stale review April 28, 2026 11:49

linting failed

Copy link
Copy Markdown
Contributor

@belletva belletva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good for me!

@belletva belletva merged commit 2cf84bb into GlacioHack:main Apr 28, 2026
39 checks passed
@ould-a ould-a deleted the blockwise-documentation branch April 30, 2026 08:15
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.

Blockwise coregistration documentation

3 participants