Localization grid in netCDF files contain (longitude, latitude) values of all pixels. LocalizationGridBuilder first computes a linear (affine) approximation of a localization grid, then stores only the residual in its internal grid. The intent is to have small residual, which make easier to compute the inverse transformation (given a latitude and longitude, find indices of the pixel at that location). However if the localization grid is non-linear, then the affine transform is a poor approximation of that grid and the residuals are high. High residual make inverse transforms hard to compute, which result sometime in TransformException being throw with a "no convergence" error message.
In practice, the localization grid in netCDF files is often used for storing the results of a map projection. The Mercator projection for example is often used. The proposed fix is to allow LocalizationGridBuilder to try to transform the grid using a given list of map projections and see if one of those projections results in a grid closer to a linear transform. In other words, we should be able to "guess" what the projection may be. It is okay if the guess is not a perfect match; if the residuals become smalls, it will resolve the "no convergence" errors.