Users sometimes simulate quantities that do not always correspond to continuous spatial values. Instead, these quantities can be discrete and result from a sampling process across the landscape. In such cases, users often want to visually verify the sampling scheme.
One way to achieve this is by exporting the samples as a shapefile and employing various software tools like Quetzal-CRUMBS or the raster package in R to visualize them.
Input
1#include "quetzal/geography.hpp"
11 using time_type = int;
13 using latlon =
typename raster_type::latlon;
16 std::vector<time_type> times(10);
17 std::iota(times.begin(), times.end(), 2001);
19 auto input_file = std::filesystem::current_path() /
"data/bio1.tif";
20 auto output_dir = std::filesystem::current_path() /
"my_sample";
23 auto bio1 = raster_type::from_file(input_file, times);
26 auto p1 = latlon(48., 0.);
27 auto p2 = latlon(51, 3.5);
28 auto p3 = latlon(38.0, 9.0);
30 bio1.to_shapefile({p1, p2, p3}, output_dir);
31 std::cout << (std::filesystem::is_directory(output_dir) ?
"success" :
"error") << std::endl;
34 std::filesystem::remove_all(output_dir);
Discrete spatio-temporal variations of an environmental variable.
Definition raster.hpp:38
Simulation of coalescence-based models of molecular evolution.
Definition coalescence.hpp:21
Output