Skip to content

Bugfix/interpolation dimensions#544

Open
scranford1 wants to merge 3 commits intodevelopfrom
bugfix/interpolation-dimensions
Open

Bugfix/interpolation dimensions#544
scranford1 wants to merge 3 commits intodevelopfrom
bugfix/interpolation-dimensions

Conversation

@scranford1
Copy link
Contributor

@scranford1 scranford1 commented Mar 5, 2026

Changes

  • Remove squeeze from Stacked Coordinates to avoid issues with axes being removed unintentionally in the case of single value coordinates.
  • Use udrop instead of drop for extra dimensions as the dimensions are found using udims method.
  • Allow rasterio interpolator to handle additional CRS formats as coordinates can use PROJ4 or WKT according to documentation.
crs : str, optional
            Coordinate reference system. Supports PROJ4 and WKT.

@scranford1 scranford1 requested a review from mpu-creare March 5, 2026 20:31
@scranford1 scranford1 self-assigned this Mar 5, 2026
@scranford1 scranford1 marked this pull request as draft March 10, 2026 20:07
@scranford1 scranford1 force-pushed the bugfix/interpolation-dimensions branch from b2df68d to 8bd8c32 Compare March 10, 2026 20:19
@sonarqubecloud
Copy link

@scranford1 scranford1 marked this pull request as ready for review March 10, 2026 21:17
@scranford1
Copy link
Contributor Author

Unit tests are now passing at same percentage as develop. (18 failed, 987 passed, 48 skipped, 9 deselected, 2 xfailed)

@scranford1
Copy link
Contributor Author

@dhinckley-creare Tagging you in this pull request as well, mostly related to stacked coordinate changes and one change for CRS formats.

else:
dtype = object
return np.dstack([c.coordinates.astype(dtype) for c in self._coords]).squeeze()
return np.stack([c.coordinates.astype(dtype) for c in self._coords], axis=-1)
Copy link
Collaborator

@dhinckley-creare dhinckley-creare Mar 19, 2026

Choose a reason for hiding this comment

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

@scranford1 this is the only line that I'm not too sure about.

What gives me pause here is that squeeze would crush a pointless dimension regardless of order but I'm not familiar enough with stacked_coordinates to know if axis=-1 is always correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From my understanding the squeeze is being used to remove the extra dimension that is introduced during the conversion to a 3D shape. However for single values it can end up removing a dimension which should be kept. With stack and axis=-1, 1D arrays are staked to go from (N,) -> (N,k) and 2-D Arrays are stacked to go from (N,M,) to (N,M,k) where k is number of arrays in stack.

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.

2 participants