1187 Commits

Author SHA1 Message Date
Yann-Sebastien Tremblay-Johnston
d7be6a8210
don't check ERR_RAND and ERR_BIAS in test_rpcs (#2158) 2021-04-20 10:07:54 -06:00
Mike Taves
3c630f8a30
Python3 classes does not need to inherit from object (#2150) 2021-04-12 12:47:35 -06:00
Sean Gillies
471cfb588a Merge branch 'master' of github.com:mapbox/rasterio 2021-04-07 07:46:21 -06:00
Sean Gillies
3e1765c5b3 Add a --nodata option to rio-clip
Resolves #2084
2021-04-06 18:32:58 -06:00
Sean Gillies
5b10c8d154 Raise exception when bounds and transform are not consistent
Resolves #2138
2021-04-06 16:07:57 -06:00
Sean Gillies
0813068912
Fix mask error in min and max merge algorithms (#2145)
* Fix mask error in min and max merge algorithms

Resolves #2135

* Note changes in #2145
2021-04-06 16:06:57 -06:00
Sean Gillies
a715da9a07 Backport changes from #2089 2021-03-31 13:01:06 -06:00
Alan D. Snow
5b76d05fb3
ENH: Add version to CRS.to_wkt() (#2122)
* ENH: Add version to CRS.to_wkt()

* Update tests/test__crs.py for PROJ 8

Co-authored-by: Even Rouault <even.rouault@spatialys.com>

* Update tests/test__crs.py for PROJ 8

Co-authored-by: Even Rouault <even.rouault@spatialys.com>

* Update tests/test__crs.py for PROJ 8

Co-authored-by: Even Rouault <even.rouault@spatialys.com>

* Update tests/test__crs.py for PROJ 8

Co-authored-by: Even Rouault <even.rouault@spatialys.com>

* morph_to_esri_dialiect docstring update.

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

* DOC: update CHANGES with blurb about WKT2 support

Co-authored-by: Even Rouault <even.rouault@spatialys.com>
Co-authored-by: Sean Gillies <sean.gillies@gmail.com>
2021-03-17 22:40:46 -06:00
Denis Rykov
eed1194dfb
Don't create AWSSession for presigned URLs (#2133) 2021-03-11 10:26:51 -07:00
Sean Gillies
f3ff6575f4 Merge branch 'maint-1.2' 2021-03-03 08:24:29 -07:00
Denis Rykov
b962f10be7
Add unsigned Azure requests support (#2120)
* Add unsigned Azure requests support

* Take into account AZURE_STORAGE_ACCOUNT env variable
2021-02-22 11:16:16 -07:00
Sean Gillies
fb55ddc4e5 Document rectilinear requirement for rio-clip
And a test, plus a new clip test module
2021-02-15 08:54:45 -07:00
Sean Gillies
3847cc2410
Rewrite of from_bounds and geometry_window (#2116)
* Rewrite of from_bounds and geometry_window

Resolves #2112

* Remove unused parameters from call to geometry_window
2021-02-15 08:31:24 -07:00
Martijn Visser
4eaaf5d97e
Add a Resampling.sum method (#2089)
* Add a Resampling.sum method

For weighted sum.
Added in GDAL 3.1 per https://github.com/OSGeo/gdal/pull/2366

I copied the approach used in #2056 to add and test this.

* resampling method sum not supported for read/write

* Resampling.sum fill in expected nonzero
2021-02-12 09:31:13 -07:00
Sean Gillies
30476fd1b2
Cast nodata before filling (#2110)
* Cast nodata before filling

Resolves #2041

* Use ma.asanyarray when required

And silence a new warning
2021-02-10 19:50:49 -07:00
Ryan Grout
5aeaa3591b
Use the right dtype when checking nodataval (#2100)
* Use the right dtype when checking nodataval

Use the dtype of the first dataset if dtype is None. If dtype is not
None, then dt == dtype.

* Use np.issubdtype to check dtypes.

* Add test for out of range nodata.

* Only query float dtype when nodataval is not NaN.

* Modify warning phrasing.

At this point the nodataval could either be set by the input files or by
the user. Use a more general phrasing to just convey the fact that the
nodata value is out of range of the dtype.
2021-02-10 15:30:43 -07:00
Ryan Grout
ceb0e45bc1
Use machine epsilon in transform.rowcol (#2106)
* Use machine epsilon.

* Use window rounding methods.

* Update test checksums

* Update test expected value
2021-02-09 18:33:58 -07:00
Sean Gillies
beb964f69d Handle string values for tiled kwarg
Resolves #2085
2021-01-24 14:51:29 -07:00
Sean Gillies
7f7bbec0a2 Allow GDAL to do the right thing w.r.t GCPs and warping
Resolves #2086
2021-01-24 14:23:08 -07:00
Sean Gillies
6dbf74b643 Close error handling environment *after* dataset closes
Resolves #2088
2021-01-24 13:23:39 -07:00
Vincent Sarago
c9c3e1a56c
make sure the WarpedVRT dataset is marked as closed on ctx exit (#2093)
* make sure the WarpedVRT dataset is marked as closed on ctx exit

* rely on inherited methods
2021-01-22 14:37:38 -07:00
Sean Gillies
b58cff5783
Update CRS of test dataset to be precisely EPSG:32618 (#2091)
* Update CRS of test dataset to be precisely EPSG:32618

Leaving two new GDAL functions in gdal.pxi for future use.

* Update builds to use PROJ 7.2.1 and GDAL 3.2.1
2021-01-20 11:20:04 -07:00
Sean Gillies
6351d5a2cb Switch from tostring -> tobytes
Eliminates a new warning
2021-01-08 13:17:01 -07:00
Sean Gillies
a1cb28a77e
Remove compat module (#2067)
* Remove compat imports in tests

* Remove compat module and future namespace imports
2020-12-11 16:30:23 -07:00
Sean Gillies
264ccaa838
Make feature extraction tests robust with respect to noding (#2066)
* Make feature extraction tests robust with respect to noding

Resolves #2034

* Install test extras

* Add shapely

* Finish adjusting tests and tweaking build matrix
2020-12-11 15:44:59 -07:00
Even Rouault
1d43837d15
Add a Resampling.rms method (#2056)
For root mean square / quadratic mean.
Added in GDAL 3.3 per https://github.com/OSGeo/gdal/pull/3210
2020-12-04 16:52:04 -07:00
Sean Gillies
203f78fc98
Add new merge tool arguments to support resolution of #1867 (#2054) 2020-12-03 15:45:07 -07:00
Denis Rykov
a5da8c47bd
Add support for Microsoft Azure Blob Storage (#1906)
Co-authored-by: Sean Gillies <sean@mapbox.com>
2020-12-02 11:55:14 -07:00
Loïc Dutrieux
28ea232107
Test option to ignore overviews (OVERVIEW_LEVEL=-1) (#2050)
* Test for upcoming GDAL feature (from 3.3) allowing existing overviews to
not be exposed
- see https://github.com/OSGeo/gdal/pull/3181
- see https://rasterio.groups.io/g/main/message/649

The test:
- requires gdal 3.3
- tests whether a dataset can be opened with OVERVIEW_LEVEL=-1
- ensures that opening a dataset with OVERVIEW_LEVEL=-1 ignores the file
overview
- ensures that a decimated read on a dataset opened with
OVERVIEW_LEVEL=1 does not read the file overview

* Make test for ignoring overviews when performing decimated read more
simple and robust
2020-12-01 17:03:22 -07:00
Yann-Sebastien Tremblay-Johnston
ea8220bf45
Don't use approximate transformer if using rpcs & passing RPC_DEM kwarg (#2047)
* Don't use approximate transformer if using rpcs & passing RPC_DEM kwarg

* [rpc_no_approx_transformer_with_dem] split test

* [rpc_no_approx_transformer_with_dem] update docstring
2020-11-23 17:12:08 -07:00
Florian
0746738acc
Support for pathlib.Path in merge (#2043)
* allow path objects

* incorporated feedback
2020-11-22 16:34:03 -07:00
Yann-Sebastien Tremblay-Johnston
d52432898e
Make NotGeoreferencedWarning rarer (#2042)
* Add new private method to detect if dataset has gcps or rpcs, suppress NotGeoreferencedWarning unless dataset has neither geotransform set, gcps, or rpcs.

* remove unused logging import
2020-11-19 18:22:37 -07:00
Yann-Sebastien Tremblay-Johnston
11ae663ff4
Warp add rpcs (#2031)
* [warp_add_rpcs] initial update to reproject to support rpcs

* catch kwargs in _calculate_default_transform

* fix allocation of crs to wrong dataset (was src, now dst) in _calculate_default_transform. Specifically where we went from GDALCreateGenImgProjTransformer -> GDALCreateGenImgProjTransformer2

* pass kwargs to calculate_default_transform (to be passed to transformer

* update docstrings

* update documentation

* add debug messages for kwargs used to set Transformer options

* Don't capitalize RPC_DEM transformer option value, as it might be a path

* includes existing changes from https://github.com/mapbox/rasterio/pull/2030, better support for computation of calculate_default_transform with just gcps or rpcs

* adds testse

* Remove an empty line

Mainly to trigger a new build on travis-ci.com

* add new test file (Largely derived from RGB.byte.tif)

* Fix incorrectly encoding RPC metadata as transform options

Was checking for transformer option RPC_DEM in the RPC metadata by mistake

Co-authored-by: Sebastien Tremblay-Johnston <sebastien.tremblayjohnston@mdacorporation.com>
Co-authored-by: Sean Gillies <sean@mapbox.com>
Co-authored-by: Sean Gillies <sean.gillies@gmail.com>
2020-11-13 18:26:58 -07:00
Yann-Sebastien Tremblay-Johnston
1ca42295e7
Enable reproject to better handle computation of dst_transform when reprojecting from gcps (#2030)
* [update_warp_gcps] Enable reproject to better handle computation of dst_transform when reprojecting from gcps

* Remove weird auto import from pylance? and unused from_gcps import

Co-authored-by: Sebastien Tremblay-Johnston <sebastien.tremblayjohnston@mdacorporation.com>
2020-11-12 11:14:26 -07:00
Yann-Sebastien Tremblay-Johnston
97ad7a7c49
Only create RPC if found metadata in RPC domain. (#2029)
* Only create `RPC` if found metadata in RPC domain.

* add assert

* add newline

* use already computed md variable
2020-11-12 11:02:53 -07:00
Yann-Sebastien Tremblay-Johnston
10809b036b
WIP: Add coordinate transformation with RPCs (#1922)
* This is part of an effort to introduce the concept of rational polynomial coeffecients to be used for coordinate transformations using GDALCreateRPCTransformer.

- Added a new UserDict subclass named RPC to control.py. This structure contains the rationa polynomial coefficients, and can be instatiated from user input or read from dataset. GDAL stores RPCs as metadata which are all string encoded. The RPC object deserializes string values to float or list appropriately, and also provides a serialization method when passing to lower level GDAL methods.
- A new _transform.pyx method called _rpc_transform, similar to _base._transform except using GDALCreateRPCTransformer and GDALRPCTransform.
- A new RPCTransformWarning to errors.py, indicating when a RPC coordinate transformation has failed.
- New includes from gdal.h and gdal_alg.h for RPC related structs and functions
- New rpcs property to DatasetBase and subclassese with appropriate getter and setters (error when read only mode). Corresponding updates to _base.pxd and _io.pxd
- Tests

* trigger new travis build

* This is part of an effort to introduce the concept of rational polynomial coeffecients to be used for coordinate transformations using GDALCreateRPCTransformer.

- Added a new UserDict subclass named RPC to control.py. This structure contains the rationa polynomial coefficients, and can be instatiated from user input or read from dataset. GDAL stores RPCs as metadata which are all string encoded. The RPC object deserializes string values to float or list appropriately, and also provides a serialization method when passing to lower level GDAL methods.
- A new _transform.pyx method called _rpc_transform, similar to _base._transform except using GDALCreateRPCTransformer and GDALRPCTransform.
- A new RPCTransformWarning to errors.py, indicating when a RPC coordinate transformation has failed.
- New includes from gdal.h and gdal_alg.h for RPC related structs and functions
- New rpcs property to DatasetBase and subclassese with appropriate getter and setters (error when read only mode). Corresponding updates to _base.pxd and _io.pxd
- Tests

trigger new travis build

* Move RPC Class to it's own file

* fix typo

* make private

* re-implement RPC with attr

* make err_bias, err_rand attributes optional, default to empty string

* default to None, rather than empty string
2020-11-02 09:26:59 -07:00
Ian Schneider
201a8d0143
flatten multipolygon to avoid holes in output (#2014)
related to 1274, a multipolygon was resulting in the same behavior
2020-10-15 12:49:12 -06:00
Alan D. Snow
6a8e8ab1c9
ENH: Auto-detect driver based on extension (#2008) 2020-10-05 13:15:25 -06:00
Sean Gillies
023836d4c9 Merge tag '1.1.7' 2020-09-29 17:20:12 -06:00
Sean Gillies
c58d534182
add CRS.is_northingeasting and CRS.is_latlon to test if EPSG axis is inverted (#1943) (#2006)
* add CRS.is_northingeasting and CRS.is_latlon to test if EPSG axis is inverted

* make separate functions

* pass _crs object to _CRS functions

* update test and confirm GDAL2/3 difference

* fix tests

* more pytest.mark.parametrize

* rename test functions

Co-authored-by: Vincent Sarago <vincent.sarago@gmail.com>
2020-09-28 14:26:14 -06:00
Sean Gillies
4e6d48544b Warn about WarpedVRT dataset's mode instead of raising 2020-09-28 09:52:08 -06:00
Sean Gillies
d442b69030
Consolidate dataset stop methods and test for issue #2000 (#2001)
* Consolidate dataset stop methods and test for issue #2000

* Try reverting to see if warped vrt tests will fail

* Undo previous commit

* Make WarpedVRT safer

We're only calling GDALClose now if reference counts are 0 and
insisting that the dataset passed to WarpedVRT be opened in
read-only mode.

Resolves #2000
2020-09-24 17:45:06 -06:00
Alan D. Snow
0e05ac5e04
ENH: Add support for generic SRS authorities (#1998) 2020-09-19 17:52:05 -06:00
Sean Gillies
d646ae0939 xfail resampling tests entirely for GDAL 1.11 2020-09-17 16:53:47 -06:00
Sean Gillies
205883a1bf xfail mode resampling for GDAL 1.x 2020-09-17 16:09:15 -06:00
Sean Gillies
bb0068fa48 xfail tests of boundless reads with fill_value
These require GDAL 3.1.4 (not yet released) or equivalent patches.
2020-09-15 14:06:25 -06:00
Guillaume Lostis
7ff4c7a68d Add resampling method option to merge (#1945)
* Add resampling argument to merge

* Expose resampling option in rio merge

* Add tests for rio merge resampling

* Add xfail test for gauss resampling in rio merge
2020-09-15 12:35:45 -06:00
Sean Gillies
098693734a Merge branch 'maint-1.1' 2020-09-15 08:14:59 -06:00
Sean Gillies
2144d443fd Sort caplog records for more deterministic results 2020-09-14 18:06:07 -06:00
Sean Gillies
151cc319ec Remove background layer from boundless VRT
In combination with GDAL fixes, this resolves #1982
2020-09-14 17:59:39 -06:00