isce3  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Covariance.h
1 // -*- C++ -*-
2 // -*- coding: utf-8 -*-
3 //
4 // Author: Heresh Fattahi
5 // Copyright 2019-
6 //
7 
8 #pragma once
9 
10 #include "forward.h"
11 
12 #include <map>
13 
14 // isce3::core
15 #include <isce3/core/Ellipsoid.h>
16 #include <isce3/core/LUT2d.h>
17 #include <isce3/core/Orbit.h>
18 
19 // isce3::product
20 #include <isce3/product/RadarGridParameters.h>
21 
22 // isce3::io
23 #include <isce3/io/Raster.h>
24 
25 // isce3::geometry
27 
31 template<class T>
33 public:
34  ~Covariance();
35 
45  void covariance(std::map<std::string, isce3::io::Raster> & slc,
46  std::map<std::pair<std::string, std::string>,
47  isce3::io::Raster> & cov,
48  size_t rangeLooks=1, size_t azimuthLooks=1);
49 
58  void faradayRotation(std::map<std::string, isce3::io::Raster> & slc,
59  isce3::io::Raster & faradayAngleRaster,
60  size_t rangeLooks, size_t azimuthLooks);
61 
72  void orientationAngle(isce3::io::Raster & azimuthSlopeRaster,
73  isce3::io::Raster & rangeSlopeRaster,
74  isce3::io::Raster & lookAngleRaster,
75  isce3::io::Raster & tauRaster);
76 
86  isce3::io::Raster & demRaster);
87 
100  isce3::io::Raster & demRaster,
101  isce3::io::Raster & rtc);
102 
116  void geocodeCovariance(isce3::io::Raster & rdrCov, isce3::io::Raster & geoCov,
117  isce3::io::Raster & demRaster, isce3::io::Raster & rtc,
118  isce3::io::Raster & orientationAngle);
119 
135  void geoGrid(double geoGridStartX, double geoGridStartY,
136  double geoGridSpacingX, double geoGridSpacingY,
137  double geoGridEndX, double geoGridEndY, int epsgcode);
138 
152  void geoGrid(double geoGridStartX, double geoGridStartY,
153  double geoGridSpacingX, double geoGridSpacingY, int width,
154  int length, int epsgcode);
155 
174  isce3::core::DateTime refEpoch, double azimuthStartTime,
175  double azimuthTimeInterval, int radarGridLength,
176  double startingRange, double rangeSpacing,
178  double wavelength, int radarGridWidth);
179 
181  void prf(double p) { _prf = p; }
182 
184  void doppler(const isce3::core::LUT2d<double> & dop) { _doppler = dop; }
185 
187  void rangeSamplingFrequency(double rngSamplingFreq);
188 
190  void rangeBandwidth(double rngBandwidth) { _rangeBandwidth = rngBandwidth; }
191 
193  void rangePixelSpacing(double rngPixelSpacing) { _rangePixelSpacing = rngPixelSpacing; }
194 
196  void wavelength(double wvl) { _wavelength = wvl; }
197 
200 
202  void orbit(const isce3::core::Orbit & orbit) { _orbit = orbit; }
203 
205  void ellipsoid(const isce3::core::Ellipsoid & ellipsoid) { _ellipsoid = ellipsoid; }
206 
208  void projection(isce3::core::ProjectionBase * proj) { _proj = proj; }
209 
211  void thresholdGeo2rdr(double threshold) { _threshold = threshold; }
212 
214  void numiterGeo2rdr(int numiter) { _numiter = numiter; }
215 
217  void linesPerBlock(size_t linesPerBlock) { _linesPerBlock = linesPerBlock; }
218 
220  void demBlockMargin(double demBlockMargin) { _demBlockMargin = demBlockMargin; }
221 
223  void radarBlockMargin(int radarBlockMargin) { _radarBlockMargin = radarBlockMargin; }
224 
226  void interpolator(isce3::core::Interpolator<T> * interp) { _interp = interp; }
227 
228 private:
229  void _correctRTC(std::valarray<std::complex<float>> & rdrDataBlock,
230  std::valarray<float> & rtcDataBlock);
231 
232  void _correctRTC(std::valarray<std::complex<double>> & rdrDataBlock,
233  std::valarray<float> & rtcDataBlock);
234 
235  void _computeRangeAzimuthBoundingBox(
236  int lineStart, int blockLength, int blockWidth, int margin,
237  isce3::geometry::DEMInterpolator & demInterp, int & azimuthFirstLine,
238  int & azimuthLastLine, int & rangeFirstPixel, int & rangeLastPixel);
239 
240  void _loadDEM(isce3::io::Raster demRaster,
242  isce3::core::ProjectionBase * _proj, int lineStart,
243  int blockLength, int blockWidth, double demMargin);
244 
245  void _geo2rdr(double x, double y, double & azimuthTime, double & slantRange,
247 
248  void _interpolate(std::valarray<T> & rdrDataBlock,
249  std::valarray<T> & geoDataBlock,
250  std::valarray<double> & radarX,
251  std::valarray<double> & radarY, size_t radarBlockWidth,
252  size_t radarBlockLength, size_t width, size_t length);
253 
254  void _faradayRotationAngle(std::valarray<T> & Shh, std::valarray<T> & Shv,
255  std::valarray<T> & Svh, std::valarray<T> & Svv,
256  std::valarray<float> & faradayRotation,
257  size_t width, size_t length, size_t rngLooks,
258  size_t azLooks);
259 
260  void _correctFaradayRotation(isce3::core::LUT2d<double> & faradayAngle,
261  std::valarray<std::complex<float>> & Shh,
262  std::valarray<std::complex<float>> & Shv,
263  std::valarray<std::complex<float>> & Svh,
264  std::valarray<std::complex<float>> & Svv,
265  size_t length, size_t width, size_t lineStart);
266 
267  void _orientationAngle(std::valarray<float> & azimuthSlope,
268  std::valarray<float> & rangeSlope,
269  std::valarray<float> & lookAngle,
270  std::valarray<float> & tau);
271 
272  void _correctOrientation(std::valarray<float> & tau,
273  std::valarray<std::complex<float>> & C11,
274  std::valarray<std::complex<float>> & C12,
275  std::valarray<std::complex<float>> & C13,
276  std::valarray<std::complex<float>> & C21,
277  std::valarray<std::complex<float>> & C22,
278  std::valarray<std::complex<float>> & C23,
279  std::valarray<std::complex<float>> & C31,
280  std::valarray<std::complex<float>> & C32,
281  std::valarray<std::complex<float>> & C33);
282 
283  // pulse repetition frequency
284  double _prf;
285 
286  // range samping frequency
287  double _rangeSamplingFrequency;
288 
289  // range signal bandwidth
290  double _rangeBandwidth;
291 
292  // range pixel spacing
293  double _rangePixelSpacing;
294 
295  // radar wavelength
296  double _wavelength;
297 
298  // The following needed for geocoding
299 
300  // isce3::core objects
301  isce3::core::Orbit _orbit;
302  isce3::core::Ellipsoid _ellipsoid;
303 
304  // Optimization options
305  double _threshold;
306  int _numiter;
307  size_t _linesPerBlock = 2000;
308 
309  // radar grids parameters
312 
313  // start X position for the output geocoded grid
314  double _geoGridStartX;
315 
316  // start Y position for the output geocoded grid
317  double _geoGridStartY;
318 
319  // X spacing for the output geocoded grid
320  double _geoGridSpacingX;
321 
322  // Y spacing for the output geocoded grid
323  double _geoGridSpacingY;
324 
325  // number of pixels in east-west direction (X direction)
326  size_t _geoGridWidth;
327 
328  // number of lines in north-south direction (Y direction)
329  size_t _geoGridLength;
330 
331  // geoTransform array (gdal style)
332  double * _geoTrans;
333 
334  // epsg code for the output geocoded grid
335  int _epsgOut;
336 
337  // projection object
338  isce3::core::ProjectionBase * _proj = nullptr;
339 
340  // margin around a computed bounding box for DEM (in degrees)
341  double _demBlockMargin;
342 
343  // margin around the computed bounding box for radar dara (integer number of
344  // lines/pixels)
345  int _radarBlockMargin;
346 
347  // interpolator
348  isce3::core::Interpolator<T> * _interp = nullptr;
349 
350  // RTC correction flag for geocoded covariance
351  bool _correctRtcFlag = true;
352 
353  // Polarimetric orientation correction flag for geocoded covariance
354  bool _correctOrientationFlag = true;
355 
356  // dualPol or Quadpol flags
357  bool _singlePol = false;
358  bool _dualPol = false;
359  bool _quadPol = false;
360 
361  // coPol and crossPol names (used only for dual-pol)
362  std::string _coPol;
363  std::string _crossPol;
364 };
365 
366 // Get inline implementations for Geocode
367 #define ISCE_SIGNAL_COVARIANCE_ICC
368 #include "Covariance.icc"
369 #undef ISCE_SIGNAL_COVARIANCE_ICC
void rangeSamplingFrequency(double rngSamplingFreq)
Set range sampling frequency.
Definition: Covariance.icc:100
void rangePixelSpacing(double rngPixelSpacing)
Set range pixel spacing.
Definition: Covariance.h:193
dataInterpMethod
Enumeration type to indicate interpolation method.
Definition: Constants.h:23
Data structure to store Ellipsoid information.
Definition: Ellipsoid.h:20
Definition: DEMInterpolator.h:22
void geocodeCovariance(isce3::io::Raster &rdrCov, isce3::io::Raster &geoCov, isce3::io::Raster &demRaster)
Geocode covariance components.
Definition: Covariance.cpp:100
void interpolator(isce3::core::Interpolator< T > *interp)
Set interpolator.
Definition: Covariance.h:226
Data structure to store date time to nano-sec precision.
Definition: DateTime.h:18
void doppler(const isce3::core::LUT2d< double > &dop)
Set Doppler.
Definition: Covariance.h:184
LookSide
Side that radar looks at, Left or Right.
Definition: LookSide.h:13
void faradayRotation(std::map< std::string, isce3::io::Raster > &slc, isce3::io::Raster &faradayAngleRaster, size_t rangeLooks, size_t azimuthLooks)
Estimate the Faraday rotation angle from quad-pol data.
Definition: Covariance.cpp:311
Definition: RadarGridParameters.h:15
void geoGrid(double geoGridStartX, double geoGridStartY, double geoGridSpacingX, double geoGridSpacingY, double geoGridEndX, double geoGridEndY, int epsgcode)
Set geocoded grid.
Definition: Covariance.icc:27
void ellipsoid(const isce3::core::Ellipsoid &ellipsoid)
Set ellipsoid.
Definition: Covariance.h:205
void orbit(const isce3::core::Orbit &orbit)
Set platform&#39;s orbit.
Definition: Covariance.h:202
void covariance(std::map< std::string, isce3::io::Raster > &slc, std::map< std::pair< std::string, std::string >, isce3::io::Raster > &cov, size_t rangeLooks=1, size_t azimuthLooks=1)
Covariance estimation.
Definition: Covariance.cpp:17
Covariance estimation from dual-polarization or quad-polarization data.
Definition: Covariance.h:32
Abstract base class for individual projections.
Definition: Projections.h:22
void thresholdGeo2rdr(double threshold)
Set the threshold for Geo2rdr computation.
Definition: Covariance.h:211
void demBlockMargin(double demBlockMargin)
Set DEM block margin.
Definition: Covariance.h:220
void orientationAngle(isce3::io::Raster &azimuthSlopeRaster, isce3::io::Raster &rangeSlopeRaster, isce3::io::Raster &lookAngleRaster, isce3::io::Raster &tauRaster)
Estimate polarimetric orientation angle.
Definition: Covariance.cpp:471
void wavelength(double wvl)
Set radar wavelength.
Definition: Covariance.h:196
void radarGrid(isce3::core::LUT2d< double > doppler, isce3::core::DateTime refEpoch, double azimuthStartTime, double azimuthTimeInterval, int radarGridLength, double startingRange, double rangeSpacing, isce3::core::LookSide side, double wavelength, int radarGridWidth)
Set the input radar grid.
Definition: Covariance.icc:85
void rangeBandwidth(double rngBandwidth)
Set range bandwidth.
Definition: Covariance.h:190
Collection of simple commonly used geometry functions.
void radarBlockMargin(int radarBlockMargin)
Set radar block margin.
Definition: Covariance.h:223
void linesPerBlock(size_t linesPerBlock)
Set lines per block.
Definition: Covariance.h:217
Sequence of platform ephemeris samples (state vectors) with uniform temporal spacing, supporting efficient lookup and interpolation.
Definition: Orbit.h:43
void prf(double p)
Set pulse repetition frequency (PRF).
Definition: Covariance.h:181
void numiterGeo2rdr(int numiter)
Set number of iterations Geo2rdr computation.
Definition: Covariance.h:214
void projection(isce3::core::ProjectionBase *proj)
Set the projection object.
Definition: Covariance.h:208
void interpolator(isce3::core::dataInterpMethod method)
Set interpolator method for geocoding.
Definition: Covariance.icc:107
Data structure meant to handle Raster I/O operations.
Definition: Raster.h:34

Generated for ISCE3.0 by doxygen 1.8.5.