Skip to content

Bugfix/132 gdal compatibility#134

Merged
dcdenu4 merged 4 commits intonatcap:mainfrom
davemfish:bugfix/132-gdal-compatibility
Apr 13, 2026
Merged

Bugfix/132 gdal compatibility#134
dcdenu4 merged 4 commits intonatcap:mainfrom
davemfish:bugfix/132-gdal-compatibility

Conversation

@davemfish
Copy link
Copy Markdown
Collaborator

@davemfish davemfish commented Apr 13, 2026

Guard against accessing attributes that are not available before GDAL 3.12.

When loading a RAT, we ask GDAL to get the type of each column and then read values using the method appropriate for that type. GDAL will only return types that it knows how to read. if it cannot determine the type it returns 'Integer'. So the only real bug here was accessing the constants for certain types in our utils.py module.

@davemfish davemfish marked this pull request as ready for review April 13, 2026 14:47
Copy link
Copy Markdown
Member

@dcdenu4 dcdenu4 left a comment

Choose a reason for hiding this comment

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

Hey @davemfish, this looks good to me. Did you want to add a note in History.rst?

Comment on lines +29 to +33
exclude:
- os: windows-latest
gdal-version: "3.11"
- os: macos-latest
gdal-version: "3.11"
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.

So we're only running the gdal version comparison on ubuntu. All else equal makes sense to conserve GHA runners.

bool_name = 'Bool'
rat.CreateColumn(value_name, gdal.GFT_Integer, gdal.GFU_MinMax)
rat.CreateColumn(count_name, gdal.GFT_Integer, gdal.GFU_PixelCount)
if geometamaker.geometamaker.GDAL_VERSION < (3, 12, 0):
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.

Cool, convenient having the gdal version is handy

@dcdenu4
Copy link
Copy Markdown
Member

dcdenu4 commented Apr 13, 2026

@davemfish , going to merge and we can remember to add the HISTORY note during the release.

@dcdenu4 dcdenu4 merged commit 617c262 into natcap:main Apr 13, 2026
21 checks passed
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