public static void TestMadingleyModelOutputDataSets(CommonTestType commonTestType, int?monthsComplete, MadingleyModelOutputDataSets result) { var data = Data.LookupCommonTestTypePaths(commonTestType, monthsComplete); ColumnTest.TestDataSet("global", data.ExpectedGlobalLookupColumnTest, data.ExpectedGlobalVariableNames, result.Global, ColumnTest.TestDataSetType.NetCDF); if (data.ExpectedCellVariableNames != null && data.ExpectedCellLookupColumnTests != null) { ColumnTest.TestDataSetArray("cell", data.ExpectedCellLookupColumnTests, data.ExpectedCellVariableNames, result.Cells, ColumnTest.TestDataSetType.NetCDF); } if (data.ExpectedGridVariableNames != null && data.ExpectedGridLookupColumnTest != null && data.ExpectedGridLookupColumn3dTest != null) { Column3dTest.TestDataSet3D("grid", data.ExpectedGridLookupColumn3dTest, data.ExpectedGridLookupColumnTest, data.ExpectedGridVariableNames, result.Grid, Column3dTest.TestDataSetType.NetCDF); } if (data.ExpectedDispersalVariableNames != null && data.ExpectedDispersalLookupColumnTest != null) { ColumnTest.TestDataSet("dispersal", data.ExpectedDispersalLookupColumnTest, data.ExpectedDispersalVariableNames, result.Dispersal, ColumnTest.TestDataSetType.TSV); } if (data.ExpectedNPPVariableNames != null && data.ExpectedNPPLookupColumnTest != null && data.ExpectedNPPLookupColumn3dTest != null) { Column3dTest.TestDataSet3D("npp", data.ExpectedNPPLookupColumn3dTest, data.ExpectedNPPLookupColumnTest, data.ExpectedNPPVariableNames, result.NPP, Column3dTest.TestDataSetType.NetCDF); } }
public static void TestMadingleyModelOutputDataSets(CommonTestType commonTestType, int? monthsComplete, MadingleyModelOutputDataSets result) { var data = Data.LookupCommonTestTypePaths(commonTestType, monthsComplete); ColumnTest.TestDataSet("global", data.ExpectedGlobalLookupColumnTest, data.ExpectedGlobalVariableNames, result.Global, ColumnTest.TestDataSetType.NetCDF); if (data.ExpectedCellVariableNames != null && data.ExpectedCellLookupColumnTests != null) { ColumnTest.TestDataSetArray("cell", data.ExpectedCellLookupColumnTests, data.ExpectedCellVariableNames, result.Cells, ColumnTest.TestDataSetType.NetCDF); } if (data.ExpectedGridVariableNames != null && data.ExpectedGridLookupColumnTest != null && data.ExpectedGridLookupColumn3dTest != null) { Column3dTest.TestDataSet3D("grid", data.ExpectedGridLookupColumn3dTest, data.ExpectedGridLookupColumnTest, data.ExpectedGridVariableNames, result.Grid, Column3dTest.TestDataSetType.NetCDF); } if (data.ExpectedDispersalVariableNames != null && data.ExpectedDispersalLookupColumnTest != null) { ColumnTest.TestDataSet("dispersal", data.ExpectedDispersalLookupColumnTest, data.ExpectedDispersalVariableNames, result.Dispersal, ColumnTest.TestDataSetType.TSV); } if (data.ExpectedNPPVariableNames != null && data.ExpectedNPPLookupColumnTest != null && data.ExpectedNPPLookupColumn3dTest != null) { Column3dTest.TestDataSet3D("npp", data.ExpectedNPPLookupColumn3dTest, data.ExpectedNPPLookupColumnTest, data.ExpectedNPPVariableNames, result.NPP, Column3dTest.TestDataSetType.NetCDF); } }
public static void CommonTest(CommonTestType commonTestType, Func <Data, MadingleyModelOutputDataSets> runner) { var data = Data.LookupCommonTestTypePaths(commonTestType, null); var result = runner.Invoke(data); Madingley.Test.Run.Common.TestMadingleyModelOutputDataSets(commonTestType, null, result); }
public static void CommonTestResumable(CommonTestType commonTestType, Func <Data, int, int, Action <MadingleyModelOutputDataSets>, MadingleyModelOutputDataSets> runner) { var data = Data.LookupCommonTestTypePaths(commonTestType, null); var rowCount = data.RowCount; var pauseMonthsComplete = (int)(rowCount / 2); var maxIterations = (int)(rowCount / 12); var pauseIterations = (int)(maxIterations / 2); Action <MadingleyModelOutputDataSets> optionalHalfTest = halfResult => Madingley.Test.Run.Common.TestMadingleyModelOutputDataSets(commonTestType, pauseMonthsComplete, halfResult); var result = runner.Invoke(data, pauseIterations, maxIterations, optionalHalfTest); Madingley.Test.Run.Common.TestMadingleyModelOutputDataSets(commonTestType, null, result); }
// // Map from test to a set of paths to folders and configuration options // public static Data LookupCommonTestTypePaths(CommonTestType commonTestType, int? monthsComplete) { var shortRunLength = 1; var longRunLength = 10; // years #if __MonoCS__ var expectedFolder = "Expected_Mono"; #else var expectedFolder = "Expected"; #endif Func<int, int> allRowCount = (int yearCount) => 12 * yearCount; Func<int, int> truncateRowCount = (int yearCount) => { var rowCount = allRowCount.Invoke(yearCount); if (monthsComplete.HasValue) { return Math.Min(rowCount, monthsComplete.Value); } else { return rowCount; } }; Func<int, int> truncateDispersalCount = (int rowCount) => { if (monthsComplete.HasValue) { return Math.Min(rowCount, monthsComplete.Value * 4); // 4 cells } else { var longRunDispersalCount = 4 * 12 * longRunLength; // 4 cells, 12 months/year return Math.Min(rowCount, longRunDispersalCount); } }; switch (commonTestType) { case CommonTestType.COWS_NO_NPP_1_CELL_1_YEAR: { var expectedDataRoot = Path.Combine(expectedFolder, @"Cows no NPP/1 Cell/1 Year"); var pathToModelSetup = @"Model setup/Cows no NPP/1 Cell/1 Year"; var rowCount = truncateRowCount.Invoke(shortRunLength); return new Data( true, allRowCount.Invoke(shortRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromDataSetReverse(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc")), Data.LookupCell0(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc"), (rowCount + 1)), null, null, null, null, null, null, null, null, null, null); } case CommonTestType.COWS_1_CELL_1_YEAR: { var expectedDataRoot = Path.Combine(expectedFolder, @"Cows/1 Cell/10 Years"); var pathToModelSetup = @"Model setup/Cows/1 Cell/1 Year"; var rowCount = truncateRowCount.Invoke(shortRunLength); return new Data( true, allRowCount.Invoke(shortRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromDataSetReverse(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc")), Data.LookupCell0(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc"), (rowCount + 1)), null, null, null, null, null, null, null, null, null, null); } case CommonTestType.COWS_1_CELL_10_YEARS: { var expectedDataRoot = Path.Combine(expectedFolder, @"Cows/1 Cell/10 Years"); var pathToModelSetup = @"Model setup/Cows/1 Cell/10 Years"; var rowCount = truncateRowCount.Invoke(longRunLength); return new Data( true, allRowCount.Invoke(longRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromDataSetReverse(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc")), Data.LookupCell0(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc"), (rowCount + 1)), null, null, null, null, null, null, null, null, null, null); } case CommonTestType.COWS_4_CELLS_10_YEARS: { var expectedDataRoot = Path.Combine(expectedFolder, @"Cows/4 Cells/10 Years"); var pathToModelSetup = @"Model setup/Cows/4 Cells/10 Years"; var rowCount = truncateRowCount.Invoke(longRunLength); var dispersalRowCount = truncateDispersalCount.Invoke(467); return new Data( true, allRowCount.Invoke(longRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), null, null, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Data.LookupDataFromNCGridOutputs3d(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromTSV(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt")), Data.LookupCrossCellProcessData(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt"), dispersalRowCount), Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "NPPOutput.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Data.LookupDataFromNCNPPOutputs3d(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount) ); } case CommonTestType.TERRESTRIAL_4_CELLS_1_YEAR: { var expectedDataRoot = Path.Combine(expectedFolder, @"Terrestrial/4 Cells/10 Years"); var pathToModelSetup = @"Model setup/Terrestrial/4 Cells/1 Year"; var rowCount = truncateRowCount.Invoke(shortRunLength); return new Data( true, allRowCount.Invoke(shortRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), null, null, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Data.LookupDataFromNCGridOutputs3d(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromTSV(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt")), Data.LookupCrossCellProcessData(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt"), 0), Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "NPPOutput.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Data.LookupDataFromNCNPPOutputs3d(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount) ); } case CommonTestType.TERRESTRIAL_4_CELLS_10_YEARS: { var expectedDataRoot = Path.Combine(expectedFolder, @"Terrestrial/4 Cells/10 Years"); var pathToModelSetup = @"Model setup/Terrestrial/4 Cells/10 Years"; var rowCount = truncateRowCount.Invoke(longRunLength); var dispersalRowCount = truncateDispersalCount.Invoke(448); return new Data( true, allRowCount.Invoke(longRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), null, null, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Data.LookupDataFromNCGridOutputs3d(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromTSV(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt")), Data.LookupCrossCellProcessData(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt"), dispersalRowCount), Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "NPPOutput.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Data.LookupDataFromNCNPPOutputs3d(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount) ); } case CommonTestType.MARINE_1_CELL_1_YEAR: { var expectedDataRoot = Path.Combine(expectedFolder, @"Marine/1 Cell/10 Years"); var pathToModelSetup = @"Model setup/Marine/1 Cell/1 Year"; var rowCount = truncateRowCount.Invoke(shortRunLength); return new Data( false, allRowCount.Invoke(shortRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromDataSetReverse(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc")), Data.LookupCell0(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc"), (rowCount + 1)), null, null, null, null, null, null, null, null, null, null); } case CommonTestType.MARINE_1_CELL_10_YEARS: { var expectedDataRoot = Path.Combine(expectedFolder, @"Marine/1 Cell/10 Years"); var pathToModelSetup = @"Model setup/Marine/1 Cell/10 Years"; var rowCount = truncateRowCount.Invoke(longRunLength); return new Data( false, allRowCount.Invoke(longRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromDataSetReverse(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc")), Data.LookupCell0(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc"), (rowCount + 1)), null, null, null, null, null, null, null, null, null, null); } case CommonTestType.MARINE_4_CELLS_10_YEARS: { var expectedDataRoot = Path.Combine(expectedFolder, @"Marine/4 Cells/10 Years"); var pathToModelSetup = @"Model setup/Marine/4 Cells/10 Years"; var rowCount = truncateRowCount.Invoke(longRunLength); var dispersalRowCount = truncateDispersalCount.Invoke(441); return new Data( false, allRowCount.Invoke(longRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), null, null, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Data.LookupDataFromNCGridOutputs3d(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromTSV(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt")), Data.LookupCrossCellProcessData(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt"), dispersalRowCount), Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "NPPOutput.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Data.LookupDataFromNCNPPOutputs3d(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount) ); } default: throw new Exception("Unexpected test type"); } }
// // Map from test to a set of paths to folders and configuration options // public static Data LookupCommonTestTypePaths(CommonTestType commonTestType, int?monthsComplete) { var shortRunLength = 1; var longRunLength = 10; // years #if __MonoCS__ var expectedFolder = "Expected_Mono"; #else var expectedFolder = "Expected"; #endif Func <int, int> allRowCount = (int yearCount) => 12 * yearCount; Func <int, int> truncateRowCount = (int yearCount) => { var rowCount = allRowCount.Invoke(yearCount); if (monthsComplete.HasValue) { return(Math.Min(rowCount, monthsComplete.Value)); } else { return(rowCount); } }; Func <int, int> truncateDispersalCount = (int rowCount) => { if (monthsComplete.HasValue) { return(Math.Min(rowCount, monthsComplete.Value * 4)); // 4 cells } else { var longRunDispersalCount = 4 * 12 * longRunLength; // 4 cells, 12 months/year return(Math.Min(rowCount, longRunDispersalCount)); } }; switch (commonTestType) { case CommonTestType.COWS_NO_NPP_1_CELL_1_YEAR: { var expectedDataRoot = Path.Combine(expectedFolder, @"Cows no NPP/1 Cell/1 Year"); var pathToModelSetup = @"Model setup/Cows no NPP/1 Cell/1 Year"; var rowCount = truncateRowCount.Invoke(shortRunLength); return(new Data( true, allRowCount.Invoke(shortRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromDataSetReverse(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc")), Data.LookupCell0(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc"), (rowCount + 1)), null, null, null, null, null, null, null, null, null, null)); } case CommonTestType.COWS_1_CELL_1_YEAR: { var expectedDataRoot = Path.Combine(expectedFolder, @"Cows/1 Cell/10 Years"); var pathToModelSetup = @"Model setup/Cows/1 Cell/1 Year"; var rowCount = truncateRowCount.Invoke(shortRunLength); return(new Data( true, allRowCount.Invoke(shortRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromDataSetReverse(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc")), Data.LookupCell0(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc"), (rowCount + 1)), null, null, null, null, null, null, null, null, null, null)); } case CommonTestType.COWS_1_CELL_10_YEARS: { var expectedDataRoot = Path.Combine(expectedFolder, @"Cows/1 Cell/10 Years"); var pathToModelSetup = @"Model setup/Cows/1 Cell/10 Years"; var rowCount = truncateRowCount.Invoke(longRunLength); return(new Data( true, allRowCount.Invoke(longRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromDataSetReverse(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc")), Data.LookupCell0(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc"), (rowCount + 1)), null, null, null, null, null, null, null, null, null, null)); } case CommonTestType.COWS_4_CELLS_10_YEARS: { var expectedDataRoot = Path.Combine(expectedFolder, @"Cows/4 Cells/10 Years"); var pathToModelSetup = @"Model setup/Cows/4 Cells/10 Years"; var rowCount = truncateRowCount.Invoke(longRunLength); var dispersalRowCount = truncateDispersalCount.Invoke(467); return(new Data( true, allRowCount.Invoke(longRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), null, null, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Data.LookupDataFromNCGridOutputs3d(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromTSV(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt")), Data.LookupCrossCellProcessData(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt"), dispersalRowCount), Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "NPPOutput.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Data.LookupDataFromNCNPPOutputs3d(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount) )); } case CommonTestType.TERRESTRIAL_4_CELLS_1_YEAR: { var expectedDataRoot = Path.Combine(expectedFolder, @"Terrestrial/4 Cells/10 Years"); var pathToModelSetup = @"Model setup/Terrestrial/4 Cells/1 Year"; var rowCount = truncateRowCount.Invoke(shortRunLength); return(new Data( true, allRowCount.Invoke(shortRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), null, null, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Data.LookupDataFromNCGridOutputs3d(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromTSV(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt")), Data.LookupCrossCellProcessData(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt"), 0), Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "NPPOutput.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Data.LookupDataFromNCNPPOutputs3d(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount) )); } case CommonTestType.TERRESTRIAL_4_CELLS_10_YEARS: { var expectedDataRoot = Path.Combine(expectedFolder, @"Terrestrial/4 Cells/10 Years"); var pathToModelSetup = @"Model setup/Terrestrial/4 Cells/10 Years"; var rowCount = truncateRowCount.Invoke(longRunLength); var dispersalRowCount = truncateDispersalCount.Invoke(448); return(new Data( true, allRowCount.Invoke(longRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), null, null, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Data.LookupDataFromNCGridOutputs3d(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromTSV(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt")), Data.LookupCrossCellProcessData(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt"), dispersalRowCount), Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "NPPOutput.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Data.LookupDataFromNCNPPOutputs3d(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount) )); } case CommonTestType.MARINE_1_CELL_1_YEAR: { var expectedDataRoot = Path.Combine(expectedFolder, @"Marine/1 Cell/10 Years"); var pathToModelSetup = @"Model setup/Marine/1 Cell/1 Year"; var rowCount = truncateRowCount.Invoke(shortRunLength); return(new Data( false, allRowCount.Invoke(shortRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromDataSetReverse(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc")), Data.LookupCell0(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc"), (rowCount + 1)), null, null, null, null, null, null, null, null, null, null)); } case CommonTestType.MARINE_1_CELL_10_YEARS: { var expectedDataRoot = Path.Combine(expectedFolder, @"Marine/1 Cell/10 Years"); var pathToModelSetup = @"Model setup/Marine/1 Cell/10 Years"; var rowCount = truncateRowCount.Invoke(longRunLength); return(new Data( false, allRowCount.Invoke(longRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromDataSetReverse(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc")), Data.LookupCell0(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Cell0.nc"), (rowCount + 1)), null, null, null, null, null, null, null, null, null, null)); } case CommonTestType.MARINE_4_CELLS_10_YEARS: { var expectedDataRoot = Path.Combine(expectedFolder, @"Marine/4 Cells/10 Years"); var pathToModelSetup = @"Model setup/Marine/4 Cells/10 Years"; var rowCount = truncateRowCount.Invoke(longRunLength); var dispersalRowCount = truncateDispersalCount.Invoke(441); return(new Data( false, allRowCount.Invoke(longRunLength), pathToModelSetup, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc")), Data.LookupDataFromNCGlobal(Path.Combine(expectedDataRoot, "BasicOutputs_NI_0_Global.nc"), (rowCount + 1)), null, null, Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Data.LookupDataFromNCGridOutputs3d(Path.Combine(expectedDataRoot, "GridOutputs_NI_0.nc"), (rowCount + 1)), Common.Common.LookupColumnNamesFromTSV(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt")), Data.LookupCrossCellProcessData(Path.Combine(expectedDataRoot, "DispersalData_NI_0.txt"), dispersalRowCount), Common.Common.LookupColumnNamesFromDataSet(Path.Combine(expectedDataRoot, "NPPOutput.nc")), Data.LookupDataFromNCGridOutputs(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Madingley.Test.Common.Column3dTest.LookupColumn3dTestFromDataSetTruncated(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount), Data.LookupDataFromNCNPPOutputs3d(Path.Combine(expectedDataRoot, "NPPOutput.nc"), rowCount) )); } default: throw new Exception("Unexpected test type"); } }