Riverscapes / gcd

Geomorphic Change Detection For Windows
http://gcd.riverscapes.xyz
GNU General Public License v3.0
25 stars 5 forks source link

Raster Subraction Exception #340

Closed philipbaileynar closed 5 years ago

philipbaileynar commented 5 years ago

Reported by @emma994 on 30 Jan 2019 as a follow up to resolving issue #338.

Thanks for your advice, that has worked and I can now load the two raster files into my GCD project. However, when I am conducting a change detection I am now getting the following error message:

EXCEPTION
Exception has been thrown by the target of an invocation.
 --- Stacktrace --- 
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at GCDConsoleLib.RasterOperators.GenericRunWithOutput(Type generic, Type innerType, String sDesc, EventHandler`1 progressHandler, Object[] args) in D:\Code\gcd\gcd\GCDConsoleLib\RasterOperators\Interfaces.cs:line 1293
   at GCDConsoleLib.RasterOperators.Subtract(Raster rInputA, Raster rInputB, FileInfo sOutputRaster, EventHandler`1 progressHandler) in D:\Code\gcd\gcd\GCDConsoleLib\RasterOperators\Interfaces.cs:line 159
   at GCDCore.Engines.ChangeDetectionEngineBase.Calculate(String dodName, DirectoryInfo analysisFolder, Boolean bBuildPyramids, UnitGroup units)
   at GCDCore.UserInterface.ChangeDetection.frmDoDProperties.cmdOK_Click(Object sender, EventArgs e)
 --- Exception Data --- 
ArcMap = 10.5.1.7333
GCD = 7.4.0.0Index was outside the bounds of the array.
 --- Stacktrace --- 
   at GCDConsoleLib.Common.Extensons.ArrayExtensions.Plunk[T](T[] dstData, T[] srcData, Int32 dstSizeR0, Int32 dstSizeR1, Int32 srcSizeR0, Int32 srcSizeR1, Int32 offsetR0, Int32 offsetR1) in D:\Code\gcd\gcd\GCDConsoleLib\Extensions\ArrayExtensions.cs:line 121
   at GCDConsoleLib.Internal.BaseOperator`1.GetChunk(List`1 data) in D:\Code\gcd\gcd\GCDConsoleLib\RasterOperators\BaseOperator.cs:line 334
   at GCDConsoleLib.Internal.BaseOperator`1.Run() in D:\Code\gcd\gcd\GCDConsoleLib\RasterOperators\BaseOperator.cs:line 411
   at GCDConsoleLib.Internal.BaseOperator`1.RunWithOutput() in D:\Code\gcd\gcd\GCDConsoleLib\RasterOperators\BaseOperator.cs:line 448
Windows: Microsoft Windows NT 6.2.9200.0
Date: 30/01/2019 10:24:50
philipbaileynar commented 5 years ago

@emma994 we have not seen this issue before. Could you please zip your GCD project and send it to us? It will probably be too big for email. Do you have another means of transmitting it?

philipbaileynar commented 5 years ago

Just to confirm @ that I have the data.

philipbaileynar commented 5 years ago

@emma994 this error is actually a red herring. The raster subtraction is failing because your rasters have different cell resolutions. While you should have handled this in your data prep, GCD should not let you add both rasters to your GCD project without first fixing this problem. I have logged this issue (#341) and will tackle it ASAP. In the meantime see the bottom of this issue for a quick worksaround.

The two cell resolutions in these screenshots from your GCD project must be the same:

2019_02_07_145103

Temporary Workaround

  1. Create a new blank GCD project.
  2. Click to add a new DEM survey and browse to your first raster (doesn't matter which, but I chose the 2017 raster).
  3. In the raster properties form that appears change the precision to 2 and the cell resolution to 0.07. 2019_02_07_145642
  4. Click Add raster and wait for it to process.
  5. Now add the second DEM survey and ensure that the cell resolution and precision controls at the bottom of the form show the identical values as you specified above. (Note that the controls will be read only the second time that you use the form).
philipbaileynar commented 5 years ago

Closing this issue because it is the result of rasters within the same project having different cell resolutions which should never occur. Issue #341 is now resolved and so this situation should never occur again.