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

Add nodata attribute to Raster #20

Merged
merged 2 commits into from
Jan 10, 2024
Merged

Conversation

gmgunter
Copy link
Member

Add the ability to set (when creating the Raster) and get the "nodata" value from Raster objects.

It seems most intuitive that the "nodata" value should have the same dtype as the Raster image data. However, due to underlying limitations in GDAL/rasterio12, the nodata value must be a float, even if the raster is integer- or complex-valued.

Footnotes

  1. https://github.com/OSGeo/gdal/pull/808

  2. https://github.com/rasterio/rasterio/issues/1747

Regardless of the raster datatype, the nodata value is always a
floating-point value (even for integer- & complex-valued rasters).

See:
* OSGeo/gdal#808
* rasterio/rasterio#1747
Copy link

codecov bot commented Jan 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0060311) 90.36% compared to head (ed36ae1) 90.47%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #20      +/-   ##
==========================================
+ Coverage   90.36%   90.47%   +0.11%     
==========================================
  Files           7        7              
  Lines         415      420       +5     
==========================================
+ Hits          375      380       +5     
  Misses         40       40              

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

Older versions of rasterio don't know about 64-bit integer dtypes.
Support for int64 was added in rasterio 1.3.0.
@gmgunter gmgunter merged commit 1518e81 into isce-framework:main Jan 10, 2024
7 checks passed
@gmgunter gmgunter deleted the raster-nodata branch January 10, 2024 21:56
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.

1 participant