本文整理汇总了C++中LSDRaster::RemoveBelow方法的典型用法代码示例。如果您正苦于以下问题:C++ LSDRaster::RemoveBelow方法的具体用法?C++ LSDRaster::RemoveBelow怎么用?C++ LSDRaster::RemoveBelow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LSDRaster
的用法示例。
在下文中一共展示了LSDRaster::RemoveBelow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
raster_selection.push_back(0);
raster_selection.push_back(0);
int CurrentWindowSize = window_radius;
vector<LSDRaster> Surfaces = FilledDEM.calculate_polyfit_surface_metrics(CurrentWindowSize, raster_selection);
LSDRaster slope = Surfaces[1];
LSDRaster aspect = Surfaces[2];
cout << "\nGetting drainage network and basins\n" << endl;
// get a flow info object
LSDFlowInfo FlowInfo(BoundaryConditions,FilledDEM);
//get stream net from channel heads
stringstream ss_ch;
ss_ch << Path << "Pelletier/" << Prefix << "_" << Resolutions[a] << "_CH";
vector<int> sources = FlowInfo.Ingest_Channel_Heads(ss_ch.str(), "bil");
LSDJunctionNetwork ChanNetwork(sources, FlowInfo);
LSDIndexRaster StreamNetwork = ChanNetwork.StreamOrderArray_to_LSDIndexRaster();
//Extract basins based on input stream order
vector< int > basin_junctions = ChanNetwork.ExtractBasinJunctionOrder(BasinOrder, FlowInfo);
LSDIndexRaster Basin_Raster = ChanNetwork.extract_basins_from_junction_vector(basin_junctions, FlowInfo);
cout << "\nExtracting hilltops and hilltop curvature" << endl;
// extract hilltops - no critical slope filtering is performed here
LSDRaster hilltops = ChanNetwork.ExtractRidges(FlowInfo);
//get hilltop curvature using filter to remove positive curvatures
LSDRaster cht_raster = FilledDEM.get_hilltop_curvature(Surfaces[3], hilltops);
LSDRaster CHT = FilledDEM.remove_positive_hilltop_curvature(cht_raster);
cout << "Starting hilltop flow routing\n" << endl;
// these params do not need changed during normal use of the HFR algorithm
bool print_paths_switch = false;
int thinning = 1;
string trace_path = "";
bool basin_filter_switch = false;
vector<int> Target_Basin_Vector;
//run HFR
vector< Array2D<float> > HFR_Arrays = FlowInfo.HilltopFlowRouting(FilledDEM, hilltops, slope, StreamNetwork, aspect, Filename_variable, Basin_Raster, Surfaces[4], print_paths_switch, thinning, trace_path, basin_filter_switch, Target_Basin_Vector);
LSDRaster HFR_LH = hilltops.LSDRasterTemplate(HFR_Arrays[1]);
LSDRaster relief = hilltops.LSDRasterTemplate(HFR_Arrays[3]);
//Filter Relief and LH data to remove any values < 2 pixels, as in Grieve et al (2015)
LSDRaster LH1 = HFR_LH.RemoveBelow(2.0*Resolutions[a]);
LSDRaster Relief1 = relief.RemoveBelow(2.0*Resolutions[a]);
//Filter Relief and LH data to remove any values > 10000
//These are created due to using 1m channel heads on low res data, and inadvertantly
//sampling nodata values, which gives us massive relief values
LSDRaster LH = LH1.RemoveAbove(10000);
LSDRaster Relief = Relief1.RemoveAbove(10000);
//go through the lh raster and get every value into a 1D vector
vector<float> LH_vec = Flatten_Without_Nodata(LH.get_RasterData(), LH.get_NoDataValue());
vector<float> Boxplot = BoxPlot(LH_vec);
//write the values to the output file
WriteLHData << Resolutions[a] << " " << Boxplot[0] << " " << Boxplot[1] << " " << Boxplot[2] << " " << Boxplot[3] << " " << Boxplot[4] << " " << Boxplot[5] << " " << Boxplot[6] << " " << Boxplot[7];
WriteLHData << endl;
stringstream ss3;
ss3 << Path << Prefix << "_" << Resolutions[a] << "_Hist_LH_variable.txt";
print_histogram(LH_vec, 1, ss3.str());
//go through the relief raster and get every value into a 1D vector
vector<float> R_vec = Flatten_Without_Nodata(Relief.get_RasterData(), Relief.get_NoDataValue());
vector<float> Boxplot_R = BoxPlot(R_vec);
//write the values to the output file
WriteRData << Resolutions[a] << " " << Boxplot_R[0] << " " << Boxplot_R[1] << " " << Boxplot_R[2] << " " << Boxplot_R[3] << " " << Boxplot_R[4] << " " << Boxplot_R[5] << " " << Boxplot_R[6] << " " << Boxplot_R[7];
WriteRData << endl;
stringstream ss4;
ss4 << Path << Prefix << "_" << Resolutions[a] << "_Hist_R_variable.txt";
print_histogram(R_vec, 1, ss4.str());
//if the user requests the rasters to be written, write the rasters
if (WriteRasters == 1){
cout << "Writing Rasters\n" << endl;
Surfaces[1].write_raster((Filename + "_Slope_variable"), DEM_Format);
CHT.write_raster((Filename + "_CHT_variable"), DEM_Format);
LH.write_raster((Filename + "_HFR_LH_variable"), DEM_Format);
Relief.write_raster((Filename + "_Relief_variable"), DEM_Format);
}
}
WriteLHData.close();
WriteRData.close();
}