1480 Commits

Author SHA1 Message Date
Alan D. Snow
8da79a344e
CLN:warp: Deprecate antimeridian_cutting & antimeridian_offset in transform_geom (#3474) 2025-12-11 15:08:37 -06:00
Alan D. Snow
7892f3bd5c
ENH: Add float16 dtype (#3469) 2025-12-11 12:14:35 -06:00
Omar Khan
7a6c55ff4b
BUG:warp: Don't fill masked output when reprojecting (#3471) 2025-12-11 12:14:06 -06:00
Alan D. Snow
51c85cdc59
DEP: Required GDAL 3.8+ (#3465) 2025-12-11 11:35:12 -06:00
Alan D. Snow
e08d89c569
TST:test_warped_vrt_msk_add_alpha: Use dsrec & caplog to check mask (#3462) 2025-12-09 14:38:13 -06:00
Alan D. Snow
da689bb0d4
TST: Use context manager for WarpedVRT (#3463) 2025-12-09 14:07:42 -06:00
Alan D. Snow
f94cccb90e
ENH:features:shapes: Add uint32,uint64,int64 dtypes & warn for possible truncation (#3456) 2025-12-09 10:38:20 -06:00
Mike Taves
46e3da7d25
Replace flake8 with ruff check "F", "E" and "W" rules (#3457) 2025-12-09 08:52:33 -06:00
Bas Couwenberg
51175d3e15
Vendor click-plugins, PyPI package no longer maintained. (#3367) 2025-12-06 08:17:28 -06:00
Alan D. Snow
90375aa99a TST: ensure datasets closed (#3444) 2025-12-05 11:35:39 -06:00
Alan D. Snow
9880c5c40f
DEP: Python 3.10+ & GDAL 3.6+ (#3440) 2025-12-05 08:47:04 -06:00
Alan D. Snow
725b49507e
REGR: Fix compression for YCbCr JPEG (#3426) 2025-11-06 15:41:47 -06:00
Elliott Sales de Andrade
6f1f1ed0e2
TST: Fix test fixture for test_reproject_error_propagation (#3360)
Pickling the HTTP server requires the 'fork' multiprocessing context,
and in some places, `HTTPServer.server_name` returns something that
doesn't work with curl. So force the 'fork' mode, and use
`HTTPServer.server_address` instead.

Also, remove the `network` marker, as it does nothing for fixtures and
isn't required since that marker signifies _external_ networking.
2025-11-06 13:19:42 -06:00
Alan D. Snow
4ceedbf4d8
TST:test_warpedvrt_gcps__width_height updated for GDAL 3.11 GPC_HOMOGRAPHY (#3404) 2025-09-11 15:46:50 -05:00
Alan D. Snow
355ad85ff2
TST: Change nearest neighbor warp expectations for GDAL 3.11 (#3400) 2025-09-11 15:08:19 -05:00
Elliott Sales de Andrade
347a97e625
Set INIT_DEST to 0 instead of NO_DATA if it's unset (#3389)
This matches behaviour in GDAL < 3.11 and _intended_ behaviour in 3.11
(which was supposed to warn about this, but still actually fails.)
2025-09-08 16:39:19 -05:00
Sean Gillies
0fe62a7106
Change nearest neighbor warp expectations at GDAL 3.10.2 (#3330)
* Change expectations at GDAL 3.10.2

Plus reformatting of the test module.

* Watch out for GDAL dev versions
2025-04-14 14:18:34 -06:00
Omar Khan
a1dd8a2c94
Fix reproject for masked arrays with np.ma.nomask (#3306) 2025-02-27 09:51:25 -07:00
Kurt Schwehr
7adb4f5b32
test_reproject_resampling: Add another value for mode. (#3293)
* test_reproject_resampling: Add another value for mode.

Change triggered by b68bf74b6a

* test_reproject_resampling_alpha: Change in mode
2025-01-16 20:23:34 -07:00
Sean Gillies
64474c1795
Introducing cache.invalidate() and invalidate_all() (#3276)
* Introducing cache.invalidate() and invalidate_all()

Resolves #3275

* Improve documentation of cache module

* Even more documentation
2024-12-14 19:03:25 -07:00
Sean Gillies
24d79d54af
Merge 1.4.3 (#3270)
* Eliminate boundless reads in merge, new compositing implementation (#3234)

* Eliminate boundless reads in merge, new compositing implementation

Resolves #3228

* Fix nits

* Compare non-zero mean of arrays

* Implement and use Window.align()

Combines the effects of Window.round_offsets and
Window.round_lengths, producing the same effect as gdal_merge.py

* Remove unused math import

* Add more docs about align()

Also increase the fraction used in round_offsets() to be
consistent with align()

* Move align() to a private func, use two existing methods in tests

* Add a test for merging WarpedVRTs (#3237)

Resolves #3196

* Backport of #3217 (#3243)

* Backport of #3217

* Update change log

* Increment GDAL and Python versions for CI (#3244)

* Rewrite _matches() to better support to_authority() and to_epsg() (#3255)

* Rewrite _matches() to better support to_authority() and to_epsg()

Resolves #3239

* Remove list() call and update change log

* Use to_epsg() in is_epsg_code() (#3258)

* Use to_epsg() in is_epsg_code()

Resolves #3248

* Update change log

* Allow MRF compression to surface in properties (#3259)

* Allow MRF compression to surface in properties

Resolves #3256

* Update change log

* Register drivers at most once per process (#3260)

* Register drivers at most once per process

Resolves #3250

* Appease flake8

* Add a note about GDAL_SKIP in the change log

* Support all GDALFillNodata() options in rasterio.fill (#3265)

* Support all GDALFillNodata() options

Resolve #3175.

* Cast values to str and update docs

* Update change log

* Prevent rasterio from trying to open a dataset object (#3266)

Resolves #3105.

* Fix typos discovered by codespell (#3264) (#3267)

* Fix typos discovered by codespell

* crasher



---------

Co-authored-by: Christian Clauss <cclauss@me.com>

* Fix erroneous masking of 0-valued data (#3268)

* Fix erroneous masking of 0-valued data

Resolves #3245

* Add an assertion about data values and update change log

* This is 1.4.3

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2024-12-02 10:43:14 -07:00
Christian Clauss
7a741ee370
Fix typos discovered by codespell (#3264)
* Fix typos discovered by codespell

* crasher

Co-authored-by: Sean Gillies <sean.gillies@gmail.com>

---------

Co-authored-by: Sean Gillies <sean.gillies@gmail.com>
2024-11-28 20:09:20 -07:00
Christian Clauss
7b9d93d041
Comparisons to None should always be done with is or is not (#3261)
https://docs.astral.sh/ruff/rules/none-comparison
```diff
- assert src.crs.to_epsg() == None
+ assert src.crs.to_epsg() is None
```
2024-11-28 10:03:07 -07:00
Denis Rykov
0339fb95be
Take into account nodata value in rio convert (#3247)
* Take into account nodata value in rio convert

* Update expected scaled/offset values

---------

Co-authored-by: Sean Gillies <sean.gillies@gmail.com>
2024-11-15 09:34:46 -07:00
Dr. Andrew Annex
60b84320fb
adds IAU as known authority to CRS.to_authority (#3206)
* adds IAU as known authority to CRS.to_authority

* slight change to match quote convention

* it looks like the IAU authority is incorporating the version year into the name of the authority

* making the IAU_2015 authority explicit in tests and etc
2024-11-08 15:02:04 -07:00
Dr. Andrew Annex
a6dd570404
Adds CRS.geodetic_crs property (#3218)
* Adds CRS.to_geodetic function

* inspired by pyproj's .geodetic_crs function to return the
  corresponding base geographic CRS for a given CRS
* helpful for projections that may not use common geographic CRSs

* switch to else rather than finally in to_geodetic

* improve docstring and remove todos

* fixed test comment

* added .geodetic_crs property following pyproj's approach

* change to throw exception, added an aux.xml to .gitignore I keep almost committing

* Update rasterio/crs.pyx

Co-authored-by: Sean Gillies <sean.gillies@gmail.com>

* Update rasterio/crs.pyx

Co-authored-by: Sean Gillies <sean.gillies@gmail.com>

---------

Co-authored-by: Sean Gillies <sean.gillies@gmail.com>
2024-11-08 14:58:57 -07:00
Sean Gillies
a68f9c57b0 Merge branch 'maint-1.4' 2024-10-31 17:04:45 -06:00
Sean Gillies
3e1514f4f2
Reduce shape of destination for the 1-D case. (#3223)
Resolves #3215
2024-10-29 08:13:18 -06:00
Sean Gillies
aa3b664e35
Eliminate much to_epsg() usage and speed up __eq__() (#3216)
* Eliminate from_user_inputs calls to prevent unintended recursion

* Eliminate usage of to_epsg(), implement speed up from #3208

Additionally: stop asserting on "init=epsg:dddd" as this is no
longer recommended usage.

* Remove tests of equivalence with "+init=" CRS

* Add EPSG:4326 vs OGC:CRS84 test. These are not equivalent.
2024-10-22 08:14:48 -06:00
Dr. Andrew Annex
74ccaf126d
Potential fix for CRS.__eq__ (#3208)
* Partial fix for CRS.__eq__ #3207

does away with to_epsg conversion and instead uses OSRIsSameEx to do the
comparison with OGR. Might not be fast...

* * added improvement suggested by @rouault
* added test that demonstrates ogc:crs84 is equivalent to epsg:4326 for
  the purposes of rasterio

* fix to ignore axis order by default, causes changes elsewhere, not yet micro benchmarked
2024-10-22 08:14:33 -06:00
Sean Gillies
20fddc18a2
Test maint-1.4 against GDAL 3.10-to-be and add more MEM file checks (#3212)
* Test maint-1.4 against GDAL 3.10-to-be and add more MEM file checks

* Build maint-1.4, too, and with gdal-latest
2024-10-17 09:30:50 -06:00
Sean Gillies
fd2ffe7424
Update return values in docstrings (#3204)
And fix a couple other nits.

Resolves #3201
2024-10-08 08:37:28 -06:00
Sean Gillies
df409de086
Rel 1.4.1 (#3199)
* This is the maint-1.4 branch

* Check for lowerCase netCDF instead of NetCDF (#3189)

Some tests were accidentally skipped even though netCDF driver was installed due to incorrect capitalization.

* Return ints from dataset index() (#3195)

Resolves #3192

* Mark additional tests that use the network (#3193)

The network marker is already used in other places, but these tests are
new.

* Restore xy transform of grid coordinates (#3198)

Resolves #3191

* Add fsspec to test dependencies (#3197)

Resolve #3190

* This is 1.4.1

* Configuration for our internal use of MEM:: datasets

---------

Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
2024-10-01 10:31:19 -06:00
Even Rouault
7d14093184
Update GDALColorInterp and ColorInterp to support new GCI_ constants of GDAL 3.10 (#3194) 2024-09-29 21:15:57 -06:00
Alan D. Snow
fd4163d4b5
DEP: GDAL 3.5+, numpy 1.24+ (#3166)
* DEP: Python 3.10+, GDAL 3.5+, numpy 1.24+

* Apply suggestions from code review

* DEP: GDAL 3.5+, numpy 1.24+

* Fix

* remove python 3.13 from conda matrix

---------

Co-authored-by: Sean Gillies <sean.gillies@gmail.com>
2024-09-09 21:59:11 -06:00
Sean Gillies
1ac101d8d7
Use mask as alpha when reprojecting a masked array (#3156)
* Use mask as alpha when reprojecting a masked array

Resolves #2575

* Remove unnecessary nodata wranging

* Masked reprojection results depend on GDAL version

* Fix test expectations and mask scaling value

The tests of this PR are now only run for GDAL 3.8+ because the
outputs are too variable.

* Update change log
2024-08-30 10:14:35 -06:00
Sean Gillies
d917c5cd38
Use gdalvrt.xsd as a marker for GDAL's data directory (#3157)
* Use gdalvrt.xsd as a marker for GDAL's data directory

Resolves #3153

* Update change log

* Adjust tests
2024-08-30 08:35:42 -06:00
Sean Gillies
1f54d9cfa4
_OverviewResampling is OverviewResampling (#3151)
* _OverviewResampling is OverviewResampling

Resolves #2153

* Fix ref in change log
2024-08-28 09:49:44 -06:00
Evan McClain
a9411f8d81
Handle case where a MemoryFile is passed into open (#3145)
This was being improperly passed into the `hasattr(fp, 'read')` branch

Test with a small SRTM 3 file.
2024-08-23 15:02:25 -06:00
Sean Gillies
a467cbd786
Properly set color interpretation after writing a colormap (#3136)
* Properly set color interpretation after writing a colormap

Resolves #3133

* Appease flake8
2024-08-12 15:45:19 -06:00
Sean Gillies
2832be37b9
Add stats(), clear_stats(), update_stats(), deprecate statistics() (#3134)
* Add stats(), clear_stats(), update_stats(), deprecate statistics()

Resolves #2806

* Update outdated statistics metadata by adding an .aux.xml file
2024-08-10 19:16:41 -06:00
Sean Gillies
87a582a391
Update code to Python 3.9 usage (#3132)
* Run pyupgrade --py39-up

* Run darker on previous pyupgrade changes
2024-08-10 18:22:54 -06:00
Sean Gillies
afc33d87a4
Allow rasterize() output to be captured in datasets (#3131)
* Allow rasterize() output to be captured in datasets.

Resolves #1018.

* Run pyupgrade on changed files
2024-08-10 17:58:41 -06:00
Sean Gillies
835c10b228
Add a merge CLI and Python tool option to use best source res (#3130)
* Add a merge CLI and Python tool option to use best source res

Resolves #2045

* Compute best resolution without a list

* Add a stack tool and update rio-stack command

* Add another test, comment out image generation

* Remove commented code, replace "merge" with "stack" in docs

* Add option to get a masked array.

Resolves #2691.
2024-08-08 15:59:29 -06:00
Pieter Roggemans
7f94c46eee
ENH: enable support for extra dtypes in features.shapes: int8 and float64 (#3125)
* ENH: enable support for more dtypes in features.shapes

* Update CHANGES.txt

* int8 needs gdal 3.7

* Add extra types to docstring

* Apply feedback: int8 only from version 3.7
2024-08-05 18:13:07 -06:00
Ryan Grout
40ece42ebb
Return numpy arrays from transformations (#3099)
* Return numpy arrays from transformations.

* Update tests.
2024-08-05 16:00:09 -06:00
Sean Gillies
91f51afcf9
Add a new MergeError and use it in the merge tool (#3126)
* Add a new MergeError and use it in the merge tool

Flipped and upside down sources now trigger this exception.

Resolves #3123

* Define new exception in merge.py

* Move MergeError, improve docs, add tests
2024-08-05 15:27:50 -06:00
Ryan Grout
321de72219
Clip rasters in chunks (#3098)
* Use subdivided windows for rio clip.

* Pair source windows with destination windows.

* Basic test to make sure clip works.
2024-08-05 15:01:00 -06:00
Vincent Sarago
6e68bbb601
Python file opener VSI plugin: read-multi-range support (#3117)
* add multi-range-read for VSIPlugin

* Update tests/test_pyopener.py

* Add and use abstract base classes in the opener implementation

* Silence flake8

---------

Co-authored-by: Sean Gillies <sean.gillies@gmail.com>
2024-07-30 16:30:52 -06:00
Sean Gillies
74b574d2cf
Add tests with multiple GDAL threads and implement truncate (#3115)
* Add tests with multiple GDAL threads and implement truncate

Follow up to #3113

* Test using tiled rgb_lzw.tif files
2024-07-13 19:41:08 -06:00