9
9
- https://github.com/opendatacube/datacube-core/blob/1d345f08a10a13c316f81100936b0ad8b1a374eb/LICENSE # noqa: E501
10
10
11
11
"""
12
+
12
13
import copy
13
14
import os
14
15
from collections .abc import Hashable , Iterable , Mapping
@@ -128,7 +129,13 @@ def _make_dst_affine(
128
129
** kwargs ,
129
130
):
130
131
"""Determine the affine of the new projected `xarray.DataArray`"""
131
- src_bounds = () if "gcps" in kwargs else src_data_array .rio .bounds ()
132
+ src_bounds = ()
133
+ if (
134
+ "gcps" not in kwargs
135
+ and "rpcs" not in kwargs
136
+ and "src_geoloc_array" not in kwargs
137
+ ):
138
+ src_bounds = src_data_array .rio .bounds ()
132
139
src_height , src_width = src_data_array .rio .shape
133
140
dst_height , dst_width = dst_shape if dst_shape is not None else (None , None )
134
141
# pylint: disable=isinstance-second-argument-not-valid-type
@@ -453,8 +460,12 @@ def reproject(
453
460
if gcps :
454
461
kwargs .setdefault ("gcps" , gcps )
455
462
456
- gcps_or_rpcs = "gcps" in kwargs or "rpcs" in kwargs
457
- src_affine = None if gcps_or_rpcs else self .transform (recalc = True )
463
+ use_affine = (
464
+ "gcps" not in kwargs
465
+ and "rpcs" not in kwargs
466
+ and "src_geoloc_array" not in kwargs
467
+ )
468
+ src_affine = None if not use_affine else self .transform (recalc = True )
458
469
if transform is None :
459
470
dst_affine , dst_width , dst_height = _make_dst_affine (
460
471
src_data_array = self ._obj ,
@@ -474,7 +485,6 @@ def reproject(
474
485
dst_data = self ._create_dst_data (dst_height = dst_height , dst_width = dst_width )
475
486
476
487
dst_nodata = self ._get_dst_nodata (nodata )
477
-
478
488
rasterio .warp .reproject (
479
489
source = self ._obj .values ,
480
490
destination = dst_data ,
@@ -506,7 +516,7 @@ def reproject(
506
516
dst_affine = dst_affine ,
507
517
dst_width = dst_width ,
508
518
dst_height = dst_height ,
509
- force_generate = gcps_or_rpcs ,
519
+ force_generate = not use_affine ,
510
520
),
511
521
dims = tuple (dst_dims ),
512
522
attrs = new_attrs ,
0 commit comments