@@ -201,8 +201,10 @@ Geocode::Geocode(const isce3::product::GeoGridParameters & geogrid,
201
201
_interp_double_handle(data_interp_method),
202
202
_interp_cdouble_handle(data_interp_method),
203
203
_interp_unsigned_char_handle(data_interp_method),
204
+ _interp_unsigned_int_handle(data_interp_method),
204
205
_proj_handle(geogrid.epsg()),
205
- _dem_interp_method(dem_interp_method)
206
+ _dem_interp_method(dem_interp_method),
207
+ _data_interp_method(data_interp_method)
206
208
{
207
209
// init light weight radar grid
208
210
_radar_grid.sensing_start = _rdr_geom.radarGrid ().sensingStart ();
@@ -231,10 +233,12 @@ Geocode::Geocode(const isce3::product::GeoGridParameters & geogrid,
231
233
_invalid_float = std::numeric_limits<float >::quiet_NaN ();
232
234
_invalid_double = std::numeric_limits<double >::quiet_NaN ();
233
235
_invalid_unsigned_char = 255 ;
236
+ _invalid_unsigned_int = 4294967295 ;
234
237
} else {
235
238
_invalid_float = invalid_value;
236
239
_invalid_double = static_cast <double >(invalid_value);
237
240
_invalid_unsigned_char = static_cast <unsigned char >(invalid_value);
241
+ _invalid_unsigned_int = static_cast <unsigned int >(invalid_value);
238
242
}
239
243
}
240
244
@@ -337,9 +341,21 @@ void Geocode::setBlockRdrCoordGrid(const size_t block_number)
337
341
}
338
342
}
339
343
344
+ void Geocode::rasterDtypeInterpCheck (const int dtype) const
345
+ {
346
+ if ((dtype == GDT_Byte || dtype == GDT_UInt32) &&
347
+ _data_interp_method != isce3::core::NEAREST_METHOD)
348
+ {
349
+ std::string err_str {" int type of raster can only use nearest neighbor interp" };
350
+ throw isce3::except::InvalidArgument (ISCE_SRCINFO (), err_str);
351
+ }
352
+ }
353
+
340
354
template <class T >
341
355
void Geocode::geocodeRasterBlock (Raster& output_raster, Raster& input_raster)
342
356
{
357
+ rasterDtypeInterpCheck (input_raster.dtype ());
358
+
343
359
// determine number of elements in output vector
344
360
const auto n_elem_out = _geo_block_length * _geogrid.width ();
345
361
@@ -362,6 +378,9 @@ void Geocode::geocodeRasterBlock(Raster& output_raster, Raster& input_raster)
362
378
} else if constexpr (std::is_same_v<T, unsigned char >) {
363
379
interp = _interp_unsigned_char_handle.getInterp ();
364
380
invalid_value = _invalid_unsigned_char;
381
+ } else if constexpr (std::is_same_v<T, unsigned int >) {
382
+ interp = _interp_unsigned_int_handle.getInterp ();
383
+ invalid_value = _invalid_unsigned_int;
365
384
}
366
385
367
386
// 0 width indicates current block is out of bounds
@@ -427,6 +446,10 @@ void Geocode::geocodeRasters(
427
446
428
447
const auto n_raster_pairs = output_rasters.size ();
429
448
449
+ // check if raster types consistent with data interp method
450
+ for (size_t i_raster = 0 ; i_raster < n_raster_pairs; ++i_raster)
451
+ rasterDtypeInterpCheck (input_rasters[i_raster].get ().dtype ());
452
+
430
453
// iterate over blocks
431
454
for (size_t i_block = 0 ; i_block < _n_blocks; ++i_block) {
432
455
@@ -457,6 +480,10 @@ void Geocode::geocodeRasters(
457
480
geocodeRasterBlock<unsigned char >(
458
481
output_rasters[i_raster], input_rasters[i_raster]);
459
482
break ;}
483
+ case GDT_UInt32: {
484
+ geocodeRasterBlock<unsigned int >(
485
+ output_rasters[i_raster], input_rasters[i_raster]);
486
+ break ;}
460
487
default : {
461
488
throw isce3::except::RuntimeError (ISCE_SRCINFO (),
462
489
" unsupported datatype" );
@@ -474,4 +501,5 @@ EXPLICIT_INSTATIATION(thrust::complex<float>);
474
501
EXPLICIT_INSTATIATION (double );
475
502
EXPLICIT_INSTATIATION (thrust::complex <double >);
476
503
EXPLICIT_INSTATIATION (unsigned char );
504
+ EXPLICIT_INSTATIATION (unsigned int );
477
505
} // namespace isce3::cuda::geocode
0 commit comments