Git Product home page Git Product logo

Comments (3)

adehecq avatar adehecq commented on August 17, 2024

Related shape issue at line https://github.com/GlacioHack/DemUtils/blob/95cf00be26499b09830e300f273d25ceef4a3b57/DemUtils/coreg.py#L207

from xdem.

adehecq avatar adehecq commented on August 17, 2024

Here is a quick fix, but I believe the issue should be analyzed more in depth:

diff --git a/DemUtils/coreg.py b/DemUtils/coreg.py
index acb58ea..8a18852 100644
--- a/DemUtils/coreg.py
+++ b/DemUtils/coreg.py
@@ -626,7 +626,7 @@ class Coregistration:
 
         intersection = reference_raster.intersection(to_be_aligned_raster)
         bounds = dict(zip(["west", "south", "east", "north"], intersection))
-        resolution = (bounds["east"] - bounds["west"]) / reference_raster.data.shape[1]
+        resolution = (bounds["east"] - bounds["west"]) / reference_raster.data.shape[2]
 
         # TODO: Read the to_be_aligned_dem from the actual to_be_aligned_raster and not its filename
         # TODO: The above leads to highly surprising results sometimes if the raster had been modified from its file.
@@ -639,7 +639,7 @@ class Coregistration:
 
         # Align the raster using the selected method. This returns a numpy array and the corresponding error
         aligned_dem, error = self.method(  # type: ignore
-            reference_dem=reference_raster.data,
+            reference_dem=reference_raster.data.squeeze(),
             dem_to_be_aligned=to_be_aligned_dem,
             bounds=bounds,
             crs=reference_raster.crs

from xdem.

erikmannerfelt avatar erikmannerfelt commented on August 17, 2024

All suggestions have been taken into account for as of commit 36dbf5b

from xdem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.