# 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

  - algorithm: saga:pointdistances
    name: Point distances
    params:
      FORMAT: 1
      ID_POINTS: fid
      MAX_DIST: 0.0
      POINTS:
        name: custom/points.shp
        type: vector
    results:
      DISTANCES:
        name: expected/saga/point_distances.dbf
        type: vector

  - algorithm: saga:patching
    name: Patching
    params:
      ADDITIONAL:
        name: dem.tif
        type: raster
      ORIGINAL:
        name: custom/dem_gaps.tif
        type: raster
      RESAMPLING: 0
    results:
      COMPLETED:
        hash: e016ba480e7c9a7cfe7bbbec50f4f3df0e796be7641fe68744f541b5
        type: rasterhash


  - algorithm: saga:rgbcomposite
    name: RGB Composite
    params:
      B_GRID:
        name: custom/grass7/raster_6class.tif
        type: raster
      B_METHOD: 1
      B_PERCTL_MAX: 6
      B_PERCTL_MIN: 1
      B_RANGE_MAX: 255
      B_RANGE_MIN: 0
      B_STDDEV: 2.0
      G_GRID:
        name: custom/grass7/raster_4class.tif
        type: raster
      G_METHOD: 1
      G_PERCTL_MAX: 99
      G_PERCTL_MIN: 1
      G_RANGE_MAX: 4
      G_RANGE_MIN: 0
      G_STDDEV: 2.0
      R_GRID:
        name: custom/grass7/raster_1class.tif
        type: raster
      R_METHOD: 1
      R_PERCTL_MAX: 99
      R_PERCTL_MIN: 1
      R_RANGE_MAX: 1
      R_RANGE_MIN: 0
      R_STDDEV: 2.0
    results:
      RGB:
        hash:
        - db2c282835706e4320e7c59d86c28d930b35433ec57af70e35a325d5
        - 9caba3703fd59f99466c0bf37054826d328d1349cfe03f171655adf6
        type: rasterhash

  - algorithm: saga:zonalrasterstatistics
    name: Zonal grid statistics
    params:
      ZONES:
        name: custom/dem_boolean.tif
        type: raster
    results:
      OUTTAB:
        name: expected/saga/zonal_grid_stats.dbf
        type: vector

  - algorithm: saga:resampling
    name: Resample down
    params:
      INPUT:
        name: dem.tif
        type: raster
      KEEP_TYPE: true
      SCALE_DOWN: 3
      SCALE_UP: 5
      TARGET_USER_FITS: 0
      TARGET_USER_SIZE: 0.0005
    results:
      OUTPUT:
        hash: 1b3a17a724c489ea2eea60b39bc1b9c79778832bd41e982a4e9fb09f
        type: rasterhash

  - algorithm: saga:resampling
    name: Resample up
    params:
      INPUT:
        name: dem.tif
        type: raster
      KEEP_TYPE: true
      SCALE_DOWN: 3
      SCALE_UP: 5
      TARGET_USER_FITS: 0
      TARGET_USER_SIZE: 5.0e-05
    results:
      OUTPUT:
        hash: 32008adf7520fee2848d689fcb53d0f8ac862bcd162575b03fefc7f1
        type: rasterhash

  - algorithm: saga:resamplingfilter
    name: Resampling filter
    params:
      GRID:
        name: dem.tif
        type: raster
      SCALE: 10.0
    results:
      HIPASS:
        hash: cf992e69d506924bb59a5fbabd86617e263cb951a61c1b3c0b10012b
        type: rasterhash
      LOPASS:
        hash: f36069a8ceb7ffe839a34f66b82eebacb80143e9df4ed54485bf8293
        type: rasterhash

  - algorithm: saga:fillsinks
    name: Fill sinks (Planchon/Darboux)
    params:
      DEM:
        name: dem.tif
        type: raster
      MINSLOPE: 0.01
    results:
      RESULT:
        hash: aa197cdf1b0bac1595bd337bab08ae3cddb82ddb4d06c17b528a1d43
        type: rasterhash

  - algorithm: saga:fillsinksqmofesp
    name: Fill sinks (QM of ESP)
    params:
      DEM:
        name: dem.tif
        type: raster
      DZFILL: 0.01
    results:
      FILLED:
        hash: ebd24bb7d011f0c4d87d1e4748e89d90d5a78cfa820070ece87df4d0
        type: rasterhash
      SINKS:
        hash: 83d1936c0421783372573c9dcd04e6415e9db911c5fa254e74c929b0
        type: rasterhash

  - algorithm: saga:fillsinkswangliu
    name: Fill sinks Wang & Liu
    params:
      ELEV:
        name: dem.tif
        type: raster
      MINSLOPE: 0.01
    results:
      FDIR:
        hash: 24367e9ca83c757628f329029d82341fe9111138e019138c949c34c0
        type: rasterhash
      FILLED:
        hash: aa197cdf1b0bac1595bd337bab08ae3cddb82ddb4d06c17b528a1d43
        type: rasterhash
      WSHED:
        hash: d891f15de1c742986647d619788c7b16a21909bf9c06c70579a4797c
        type: rasterhash

  - algorithm: saga:fillsinksxxlwangliu
    name: Fill Sinks Wang & Lui XXL
    params:
      ELEV:
        name: dem.tif
        type: raster
      MINSLOPE: 0.1
    results:
      FILLED:
        hash: aa197cdf1b0bac1595bd337bab08ae3cddb82ddb4d06c17b528a1d43
        type: rasterhash

  - algorithm: saga:svmclassification
    name: SVM Classification
    params:
      CACHE_SIZE: 100.0
      COEF0: 0.0
      COST: 1.0
      CROSSVAL: 1
      DEGREE: 3
      EPS: 0.001
      EPS_SVR: 0.1
      GAMMA: 0.0
      GRIDS:
        params:
        - name: dem.tif
          type: raster
        type: multi
      KERNEL_TYPE: 2
      MESSAGE: false
      MODEL_LOAD:
        name: ''
        type: file
      MODEL_SAVE:
        name: ''
        type: file
      MODEL_SRC: 0
      NU: 0.5
      PROBABILITY: false
      ROI:
        name: custom/saga/training_areas.shp
        type: vector
      ROI_ID: class
      SCALING: 2
      SHRINKING: false
      SVM_TYPE: 0
    results:
      CLASSES:
        hash: deeb8769979916ab544a824cd5400d4a4207e7df37fbeaaa6e4830af
        type: rasterhash

  - algorithm: saga:multipleregressionanalysispointsandpredictorgrids
    name: Multi regression points predictor grids
    params:
      ATTRIBUTE: rvalue_1
      COORD_X: false
      COORD_Y: false
      CROSSVAL: 0
      CROSSVAL_K: 10
      INTERCEPT: true
      METHOD: 3
      POINTS:
        name: custom/saga/points_regression.shp
        type: vector
      PREDICTORS:
        params:
        - name: dem.tif
          type: raster
        type: multi
      P_VALUE: 5.0
      RESAMPLING: 3
      RESIDUAL_COR: 0
    results:
      INFO_COEFF:
        name: expected/saga/multiple_regression_points_grids_coef.dbf
        type: vector
        compare:
          fields:
            R:
              precision: 2
            R2:
              precision: 2
            R2_ADJ:
              precision: 2
            STD_ERROR:
              precision: 2
            T:
              precision: 2
            SIG:
              precision: 6
            P:
              precision: 6
      INFO_MODEL:
        name: expected/saga/multiple_regression_points_grids_model.dbf
        type: vector
        compare:
          fields:
            VALUE:
              precision: 2
      INFO_STEPS:
        name: expected/saga/multiple_regression_points_grids_steps.dbf
        type: vector
        compare:
          fields:
            R:
              precision: 2
            R2:
              precision: 2
            R2_ADJ:
              precision: 2
            STD_ERROR:
              precision: 2
            SSR:
              precision: 2
            SSE:
              precision: 2
            MSR:
              precision: 2
            MSE:
              precision: 2
            F:
              precision: 2
            SIG:
              precision: 6
            VAR_F:
              precision: 2
            VAR_SIG:
              precision: 6
      REGRESCORR:
        hash: d70078f0151919949c1e55c1a677f1a7cda6f7514667270af6745c0d
        type: rasterhash
      REGRESSION:
        hash: b3a725ae64eec2aab8de1197f2306a0905c7c38de0dc89d58aadb3cc
        type: rasterhash
      RESIDUALS:
        name: expected/saga/multiple_regression_points_grids_res.shp
        type: vector
        compare:
          fields:
            TREND:
              precision: 2
            RESIDUAL:
              precision: 2
