V1_0.java [src/java/m/watershed/average_slope] Revision: default Date:
///*
// * To change this license header, choose License Headers in Project Properties.
// * To change this template file, choose Tools | Templates
// * and open the template in the editor.
// */
//package m.watershed.average_slope;
//
//import csip.ModelDataService;
//import csip.annotations.Description;
//import csip.annotations.Name;
//import csip.annotations.Resource;
//import static csip.annotations.ResourceType.*;
//import javax.ws.rs.Path;
//import java.io.*;
//import m.watershed.Resources;
//import static m.watershed.Utils.exec;
//import static m.watershed.Utils.checkExist;
//
///**
// * average_slope
// *
// * @author JK (using OD's template)
// */
//@Name("average_slope")
//@Description("Example of average_slope")
//@Path("m/average_slope/1.0")
//@Resource(file = "/python/zonalstats.py", id = "zonalstats")
//@Resource(file = "gdalwarp", type = REFERENCE, id = "gdalwarp")
//@Resource(file = "ogr2ogr", type = REFERENCE, id = "ogr")
//@Resource(file = "python", type = REFERENCE, id = "python")
//@Resource(file = "/bin/lin-amd64/pitremove", type = EXECUTABLE, id = "pitremove")
//@Resource(file = "/bin/lin-amd64/d8flowdir", type = EXECUTABLE, id = "d8flowdir")
//public class V1_0 extends ModelDataService {
//
// @Override
// protected void doProcess() throws Exception {
//
// int threads = Resources.mpiThreads(parameter());
//
// String file1 = parameter().getString("boundary");
// File file_1 = attachments().getFile(file1);
//
// exec(resources(), LOG,
// "ogr",
// "-t_srs", "EPSG:5070",
// "-s_srs", "EPSG:4326",
// workspace().getFile("boundary.shp"),
// file_1.getPath());
//
// checkExist(workspace().getDir(), "boundary.shp");
//
// exec(resources(), LOG,
// "gdalwrap",
// "/mnt/csip-watershed/DEM.vrt",
// workspace().getFile("DEM_clip.tif"),
// "-crop_to_cutline",
// "-cutline",
// workspace().getFile("boundary.shp"),
// "-multi",
// "-ot", "Float32",
// "-co", "NUM_THREADS=" + threads,
// "-wo", "NUM_THREADS=" + threads,
// "--config", "GDAL_CACHEMAX", "1000",
// "-wm", "1000"
// );
//
// checkExist(workspace().getDir(), "DEM_clip.tif");
//
// exec(resources(), LOG,
// "pitremove",
// "-z", workspace().getFile("DEM_clip.tif"),
// "-fel", workspace().getFile("dem_fill.tif")
// );
//
// checkExist(workspace().getDir(), "dem_fill.tif");
//
// exec(resources(), LOG,
// "d8flowdir",
// "-fel", workspace().getFile("dem_fill.tif"),
// "-sd8", workspace().getFile("sd8.tif"),
// "-p", workspace().getFile("p.tif")
// );
//
// checkExist(workspace().getDir(), "sd8.tif", "p.tif");
//
// exec(resources(), LOG,
// "python",
// resources().getFile("zonalstats"),
// workspace().getFile("boundary.shp"),
// workspace().getFile("s8.tif")
// );
//
// }
//
//
// @Override
// protected void postProcess() throws Exception {
// results().put(workspace().getFile("sd8.tif"), "cutoff direction");
// results().put(workspace().getFile("results.csv"), "cutoff direction");
// }
//
//}