Commit b4ce3f2f9a723939121952150ac674456e16eb7b

Authored by Jordi Inglada
1 parent 4c9621f0
Exists in master

Minor edits

Showing 2 changed files with 7 additions and 6 deletions   Show diff stats
README.org
... ... @@ -2,6 +2,6 @@
2 2 #+BEGIN_SRC bash
3 3 mkdir build
4 4 cd build
5   -cmake -DCMAKE_CXX_FLAGS:STRING=-std=c++17 -DOTB_DIR:PATH=/home/inglada/OTB/SuperBuild/lib/cmake/OTB-6.7 ../
  5 +cmake -DCMAKE_CXX_FLAGS:STRING="-std=c++17" -DOTB_DIR:PATH=/home/inglada/OTB/SuperBuild/lib/cmake/OTB-6.7 ../
6 6 #+END_SRC
7 7  
... ...
src/select.cxx
... ... @@ -3,8 +3,10 @@
3 3 int main()
4 4 {
5 5 std::string s2_tiles_shp{"/home/inglada/stok/DATA/iota2/S22017/Features.shp"};
6   - std::string departements_shp{"/home/inglada/stok/DATA/departements_shp/"
  6 + std::string departements_shp{"/home/inglada/stok/DATA/departements_shp/"
7 7 "departements_lambert93.shp"};
  8 + std::string shape_dir{"/home/inglada/stok/DATA/OSO/MAA_SSP/"};
  9 + std::vector<std::string> cultures_rendement{"_BLE_DUR"};
8 10  
9 11 auto s2_tiles = otb::ogr::DataSource::New(s2_tiles_shp);
10 12 auto departements = otb::ogr::DataSource::New(departements_shp);
... ... @@ -14,10 +16,9 @@ int main()
14 16 auto tile_list = get_intersecting_tiles(depts, s2_tiles);
15 17 print_dept_tiles(tile_list);
16 18  
17   - std::string shape_dir{"/home/inglada/stok/DATA/OSO/MAA_SSP/"};
18 19 AreaPerTilePerDept aptpd{};
19 20 for(const auto& f : cbutils::file::list_files(shape_dir,
20   - ".*RPG_TERLAB_DEP0.*_2017.7z"))
  21 + ".*RPG_TERLAB_DEP.*_2017.7z"))
21 22 {
22 23 std::cout << "Unzipping " << f << '\n';
23 24 cbutils::system::call("7z x "+f+" -aoa");
... ... @@ -25,6 +26,7 @@ int main()
25 26 ".*shp");
26 27 for(auto& shape : shapes_to_process)
27 28 {
  29 + auto code_dept = cbutils::string::split(shape, "_")[1].substr(1,2);
28 30 auto parcelles = otb::ogr::DataSource::New(shape);
29 31 if(has_field(parcelles, "RENDNORME"))
30 32 {
... ... @@ -32,10 +34,9 @@ int main()
32 34 auto parcs = reproject_geometries(parc_geometries,
33 35 s2_tiles->GetLayer(0).GetProjectionRef());
34 36  
35   - auto code_dept = cbutils::string::split(shape, "_")[1].substr(1,2);
36 37 std::cout << "Departement " << code_dept << '\n';
37 38 auto apt = compute_area_per_tile(parcs, tile_list[code_dept],
38   - {"TOURNESOL", "COLZA"});
  39 + cultures_rendement);
39 40 aptpd[code_dept] = apt;
40 41 }
41 42 auto files_to_remove = std::string("."+cbutils::string::split(shape, ".")[1]+".*");
... ...