Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix excessive warnings when writing COGs #204

Merged
merged 3 commits into from
Feb 14, 2025
Merged

Fix excessive warnings when writing COGs #204

merged 3 commits into from
Feb 14, 2025

Conversation

robbibt
Copy link
Contributor

@robbibt robbibt commented Feb 14, 2025

Based in discussion in #203, this implements a fix to exclude "width", "height", "count", "dtype", "crs", "transform", "nodata" kwargs from rio_opts, matching the approach taken for in-memory COGs.

@robbibt robbibt linked an issue Feb 14, 2025 that may be closed by this pull request
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 94.91%. Comparing base (8b5c56f) to head (b73a97b).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
odc/geo/cog/_rio.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #204   +/-   ##
========================================
  Coverage    94.91%   94.91%           
========================================
  Files           33       33           
  Lines         5663     5663           
========================================
  Hits          5375     5375           
  Misses         288      288           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Kirill888
Copy link
Member

@robbibt please add a write to file test to here:

def test_write_cog(gbox: GeoBox):
img = xr_zeros(gbox, dtype="uint16")
assert img.odc.geobox == gbox
img_bytes = img.odc.to_cog(blocksize=32)
assert isinstance(img_bytes, bytes)
img_bytes2 = img.odc.write_cog(":mem:", blocksize=32)
assert len(img_bytes) == len(img_bytes2)
img_bytes = img.odc.to_cog(blocksize=32, overview_levels=[2])
assert isinstance(img_bytes, bytes)
img_bytes2 = img.odc.write_cog(
":mem:", blocksize=32, overview_levels=[2], use_windowed_writes=True
)
assert len(img_bytes) == len(img_bytes2)

Copy link

github-actions bot commented Feb 14, 2025

@github-actions github-actions bot temporarily deployed to pull request February 14, 2025 06:19 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 14, 2025 06:48 Inactive
@robbibt
Copy link
Contributor Author

robbibt commented Feb 14, 2025

@Kirill888 Is that what you had in mind? I just tested it wrote out and could be read back in.

@robbibt robbibt marked this pull request as ready for review February 14, 2025 06:50
@Kirill888 Kirill888 merged commit 6358091 into develop Feb 14, 2025
20 checks passed
@Kirill888 Kirill888 deleted the fix_warnings branch February 14, 2025 07:35
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.

Excessive warnings when writing COGs
2 participants