# See ../README.md for a description of the file format

tests:

  - algorithm: saga:invertgrid
    name: Raster tools - Invert grid
    params:
      GRID:
        name: dem.tif
        type: raster
    results:
      INVERSE:
        hash: 8e3947b878a00f70ce837fba962f6be6d3f0c8eae2d614099b015f1e
        type: rasterhash

  - algorithm: saga:fixeddistancebuffer
    name: Vector general - Fixed distance buffer (polygon)
    params:
      DARC: 5.0
      DISSOLVE: false
      DIST_FIELD_DEFAULT: 0.5
      NZONES: 1
      POLY_INNER: false
      SHAPES:
        name: polys.gml
        type: vector
    results:
      BUFFER:
        name: expected/saga/buffer_polys.shp
        type: vector

  - algorithm: saga:addrastervaluestopoints
    name: Simple add raster values to points
    params:
      GRIDS:
        params:
        - name: dem.tif
          type: raster
        type: multi
      RESAMPLING: 0
      SHAPES:
        name: custom/points_over.shp
        type: vector
    results:
      RESULT:
        name: expected/saga/add_grid_to_points.shp
        type: vector

  - algorithm: saga:addrastervaluestofeatures
    name: Add raster values to shapes
    params:
      GRIDS:
        params:
        - name: dem.tif
          type: raster
        type: multi
      RESAMPLING: 0
      SHAPES:
        name: custom/lines_over.shp
        type: vector
    results:
      RESULT:
        name: expected/saga/add_grid_to_shapes.shp
        type: vector

  - algorithm: saga:mergevectorlayers
    name: Merge vector layers
    params:
      INPUT:
        params:
        - name: points.gml
          type: vector
        - name: points_in_polys.gml
          type: vector
        type: multi
      MATCH: true
      SRCINFO: true
    results:
      MERGED:
        name: expected/saga/merge_vector_layers.shp
        type: vector

  - algorithm: saga:reclassifyvaluessimple
    name: Reclassify values (simple)
    params:
      GRID_IN:
        name: raster.tif
        type: raster
      LOOKUP:
      - 800
      - 840
      - 1
      - 840
      - 870
      - 2
      - 870
      - 1000
      - 3
      METHOD: 2
    results:
      GRID_OUT:
        hash: 57437ebf7eb3667c5aa390598120967b0a2cd5d85751185bb445d1f8
        type: rasterhash

  - algorithm: saga:rastercalculator
    name: Raster calculator, 1 input
    params:
      FORMULA: a*10
      GRIDS:
        name: raster.tif
        type: raster
      RESAMPLING: 3
      TYPE: 7
      USE_NODATA: false
      XGRIDS:
        params: []
        type: multi
    results:
      RESULT:
        hash: 68d805a45416467e0f1be3066dd642772cf8ffdff9535f3254cd5ffb
        type: rasterhash

  - algorithm: saga:rastercalculator
    name: Raster calculator, 2 inputs
    params:
      FORMULA: a*10+b
      GRIDS:
        name: raster.tif
        type: raster
      RESAMPLING: 3
      TYPE: 7
      USE_NODATA: false
      XGRIDS:
        params:
        - name: raster.tif
          type: raster
        type: multi
    results:
      RESULT:
        hash: c8c2c7c32ad3eaa1ebb491aed7af7d16f1c7f574a3de1f7622894092
        type: rasterhash

  - algorithm: saga:rastercalculator
    name: Raster calculator, 3 inputs
    params:
      FORMULA: a*10+b-c
      GRIDS:
        name: raster.tif
        type: raster
      RESAMPLING: 3
      TYPE: 7
      USE_NODATA: false
      XGRIDS:
        params:
        - name: dem.tif
          type: raster
        - name: raster.tif
          type: raster
        type: multi
    results:
      RESULT:
        hash: a11f159696f5726eedaa16e872fd2582cf8a88c8c1d84d72560e4647
        type: rasterhash

  - algorithm: saga:simplekriging
    name: Simple kriging
    params:
      BLOCK: true
      DBLOCK: 1.0
      FIELD: elev
      LOG: false
      POINTS:
        name: pointsz.gml
        type: vector
      SEARCH_DIRECTION: 0
      SEARCH_POINTS_ALL: 0
      SEARCH_POINTS_MAX: 10
      SEARCH_POINTS_MIN: 3
      SEARCH_RADIUS: 5.0
      SEARCH_RANGE: 0
      TARGET_USER_FITS: 0
      TARGET_USER_SIZE: 1.0
      TQUALITY: 0
      VAR_MAXDIST: -1.0
      VAR_MODEL: a + b * x
      VAR_NCLASSES: 100
      VAR_NSKIP: 1
    results:
      PREDICTION:
        hash: a1f5a1d369cef86332a914442c444d1c0753e471523cb838d0b2bc09
        type: rasterhash
      VARIANCE:
        hash: 4f0378da7f0ff16326b6c404a202b004b66dbffcda38f42544a11490
        type: rasterhash

  - algorithm: saga:ordinarykriging
    name: Ordinary Kriging
    params:
      BLOCK: true
      DBLOCK: 1.0
      FIELD: elev
      LOG: true
      POINTS:
        name: pointsz.gml
        type: vector
      SEARCH_DIRECTION: 0
      SEARCH_POINTS_ALL: 0
      SEARCH_POINTS_MAX: 10
      SEARCH_POINTS_MIN: 3
      SEARCH_RADIUS: 5.0
      SEARCH_RANGE: 0
      TARGET_USER_FITS: 0
      TARGET_USER_SIZE: 1.0
      TQUALITY: 0
      VAR_MAXDIST: -1.0
      VAR_MODEL: a + b * x
      VAR_NCLASSES: 100
      VAR_NSKIP: 1
    results:
      PREDICTION:
        hash: 0fff15c98a1c5af9eab6c242559a5f4484a7a40f5be399899b24fd39
        type: rasterhash
      VARIANCE:
        hash: ec7b708609178533ac2b89cd575140415ef93c70396fa630d1c15b67
        type: rasterhash

  - algorithm: saga:universalkriging
    name: Universal Kriging
    params:
      BLOCK: true
      DBLOCK: 1.0
      FIELD: elev
      LOG: true
      POINTS:
        name: pointsz.gml
        type: vector
      SEARCH_DIRECTION: 0
      SEARCH_POINTS_ALL: 0
      SEARCH_POINTS_MAX: 10
      SEARCH_POINTS_MIN: 3
      SEARCH_RADIUS: 5.0
      SEARCH_RANGE: 0
      TARGET_USER_FITS: 0
      TARGET_USER_SIZE: 1.0
      TQUALITY: 0
      VAR_MAXDIST: -1.0
      VAR_MODEL: a + b * x
      VAR_NCLASSES: 100
      VAR_NSKIP: 1
    results:
      PREDICTION:
        hash: 0fff15c98a1c5af9eab6c242559a5f4484a7a40f5be399899b24fd39
        type: rasterhash
      VARIANCE:
        hash: ec7b708609178533ac2b89cd575140415ef93c70396fa630d1c15b67
        type: rasterhash

  - algorithm: saga:polygonupdate
    name: Polygon update
    params:
      A:
        name: custom/overlay1_a.geojson
        type: vector
      B:
        name: custom/overlay1_b.geojson
        type: vector
      SPLIT: true
    results:
      RESULT:
        name: expected/saga/polygon_update.shp
        type: vector

  - algorithm: saga:polygonunion
    name: Polygon union
    params:
      A:
        name: custom/overlay1_a.geojson
        type: vector
      B:
        name: custom/overlay1_b.geojson
        type: vector
      SPLIT: true
    results:
      RESULT:
        name: expected/saga/polygon_union.shp
        type: vector

  - algorithm: saga:polygonidentity
    name: Polygon identity
    params:
      A:
        name: custom/overlay1_a.geojson
        type: vector
      B:
        name: custom/overlay1_b.geojson
        type: vector
      SPLIT: true
    results:
      RESULT:
        name: expected/saga/polygon_identity.shp
        type: vector

  - algorithm: saga:difference
    name: Polygon difference
    params:
      A:
        name: custom/overlay1_a.geojson
        type: vector
      B:
        name: custom/overlay1_b.geojson
        type: vector
      SPLIT: true
    results:
      RESULT:
        name: expected/saga/polygon_difference.shp
        type: vector

  # Note - SAGA results are wrong here, so really we are just testing that the algorithm runs. Use the native one instead!
  - algorithm: saga:symmetricaldifference
    name: Polygon symmetrical difference
    params:
      A:
        name: custom/overlay1_a.geojson
        type: vector
      B:
        name: custom/overlay1_b.geojson
        type: vector
      SPLIT: true
    results:
      RESULT:
        name: expected/saga/polygon_symmetrical_difference.shp
        type: vector

  - algorithm: saga:intersect
    name: Polygon intersect
    params:
      A:
        name: custom/overlay1_a.geojson
        type: vector
      B:
        name: custom/overlay1_b.geojson
        type: vector
      SPLIT: true
    results:
      RESULT:
        name: expected/saga/polygon_intersect.shp
        type: vector


  - algorithm: saga:polygonselfintersection  #spellok
    name: Polygon self intersection
    params:
      POLYGONS:
        name: custom/overlay2_b.geojson
        type: vector
    results:
      INTERSECT:
        name: expected/saga/polygon_self_intersection.shp
        type: vector

  - algorithm: saga:crossprofiles
    name: Cross profiles
    params:
      DEM:
        name: dem.tif
        type: raster
      DIST_LINE: 0.001
      DIST_PROFILE: 0.002
      LINES:
        name: custom/lines_over.shp
        type: vector
      NUM_PROFILE: 10
    results:
      PROFILES:
        name: expected/saga/cross_profiles.shp
        type: vector

  - algorithm: saga:snappointstolines
    name: Snap points to lines
    params:
      DISTANCE: 0.9
      INPUT:
        name: snap_points.gml
        type: vector
      SNAP:
        name: snap_lines.gml
        type: vector
    results:
      MOVES:
        name: expected/saga/snap_points_to_lines_moves.shp
        type: vector
      OUTPUT:
        name: expected/saga/snap_points_to_lines_result.shp
        type: vector

  - algorithm: saga:snappointstopoints
    name: Snap points to points
    params:
      DISTANCE: 0.5
      INPUT:
        name: snap_points.gml
        type: vector
      SNAP:
        name: points.gml
        type: vector
    results:
      MOVES:
        name: expected/saga/snap_points_to_points_moves.shp
        type: vector
      OUTPUT:
        name: expected/saga/snap_points_to_points_result.shp
        type: vector

  - algorithm: saga:interpolatecubicspline
    name: Cubic spline
    params:
      FIELD: fid
      K: 140
      NPMAX: 20
      NPMIN: 3
      NPPC: 2.0
      SHAPES:
        name: pointsz.gml
        type: vector
      TARGET_USER_FITS: 0
      TARGET_USER_SIZE: 0.5
    results:
      TARGET_OUT_GRID:
        hash: f4ac677152697773262aa1e5f69146a475139014ace77149966ec045
        type: rasterhash

  - algorithm: saga:watershedsegmentation
    name: Test (saga:watershedsegmentation)
    params:
      'BBORDERS': true
      DOWN: 0
      'EDGE': true
      GRID:
        name: dem.tif
        type: raster
      JOIN: 0
      OUTPUT: 0
      THRESHOLD: 0.5
    results:
      BORDERS:
        hash: d0cd8bdc7c8400bedb2b5c1edc4a64b4c9b7c14692a4f30fbf3c5f2d
        type: rasterhash
      SEEDS:
        name: expected/saga/watershed_segmentation_seeds.shp
        type: vector
      SEGMENTS:
        hash: f2e71e3374eb229d387db8f87bc24d09b86ffc23d9fca85f324b566b
        type: rasterhash

  - algorithm: saga:multilevelbsplineinterpolation
    name: Multilevel B Spline Interpolation
    params:
      EPSILON: 0.0001
      FIELD: EC
      METHOD: 0
      SHAPES:
        name: custom/points_values.gml
        type: vector
      TARGET_USER_FITS: 0
      TARGET_USER_SIZE: 0.001
    results:
      TARGET_OUT_GRID:
        hash: 793c02e1f71091d5dcc7523bc7a872a80d20bcb29a70797479dd7740
        type: rasterhash

  - algorithm: saga:multilevelbsplineinterpolationfromraster
    name: Multilevel B Spline Interpolation from Raster
    params:
      DATATYPE: 0
      EPSILON: 0.0001
      GRID:
        name: dem.tif
        type: raster
      LEVEL_MAX: 11
      METHOD: 0
      TARGET_USER_FITS: 0
      TARGET_USER_SIZE: 0.01
      UPDATE: false
    results:
      TARGET_OUT_GRID:
        hash: 6f81c858fc7575eaff6258b6e75bf4427d0568d5134837523b730929
        type: rasterhash