Skip to content
Permalink
Browse files

Improve tests: add external file support into AlgorithmsTest

  • Loading branch information
Médéric Ribreux Médéric RIBREUX
Médéric Ribreux authored and Médéric RIBREUX committed May 6, 2016
1 parent e70f9bc commit 1f21af6672cd3bbaf854cffd3efb48b96009a11a
@@ -136,8 +136,10 @@ def load_param(self, param):
try:
if param['type'] == 'vector' or param['type'] == 'raster':
return self.load_layer(param)
if param['type'] == 'multi':
elif param['type'] == 'multi':
return [self.load_param(p) for p in param['params']]
elif param['type'] == 'file':
return self.filepath_from_param(param)
except TypeError:
# No type specified, use whatever is there
return param
@@ -98,6 +98,20 @@ params:
OTHER: another param
```

### File type parameters

If you need an external file for the algorithm test, you need to specify the 'file' type and the (relative) path to the file in its 'name':

```yaml
params:
PAR: 2
STR: string
EXTFILE:
type: file
name: custom/grass7/extfile.txt
OTHER: another param
```

### Results

Results are specified very similar.
Binary file not shown.
@@ -0,0 +1,20 @@
<PAMDataset>
<PAMRasterBand band="1">
<Histograms>
<HistItem>
<HistMin>-310.575</HistMin>
<HistMax>14854.575</HistMax>
<BucketCount>1000</BucketCount>
<IncludeOutOfRange>0</IncludeOutOfRange>
<Approximate>0</Approximate>
<HistCounts>8|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|15|15|15|16|15|15|8</HistCounts>
</HistItem>
</Histograms>
<Metadata>
<MDI key="STATISTICS_MAXIMUM">14847</MDI>
<MDI key="STATISTICS_MEAN">7272</MDI>
<MDI key="STATISTICS_MINIMUM">-303</MDI>
<MDI key="STATISTICS_STDDEV">4373.7169547194</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>
Binary file not shown.
@@ -0,0 +1,27 @@
<PAMDataset>
<PAMRasterBand band="1">
<Histograms>
<HistItem>
<HistMin>0.6</HistMin>
<HistMax>5.4</HistMax>
<BucketCount>5</BucketCount>
<IncludeOutOfRange>0</IncludeOutOfRange>
<Approximate>0</Approximate>
<HistCounts>2999|921|2110|4010|5000</HistCounts>
</HistItem>
</Histograms>
<Metadata>
<MDI key="COLOR_TABLE_RULES_COUNT">5</MDI>
<MDI key="COLOR_TABLE_RULE_RGB_0">1.000000e+00 1.800000e+00 255 255 0 0 255 0</MDI>
<MDI key="COLOR_TABLE_RULE_RGB_1">1.800000e+00 2.600000e+00 0 255 0 0 255 255</MDI>
<MDI key="COLOR_TABLE_RULE_RGB_2">2.600000e+00 3.400000e+00 0 255 255 0 0 255</MDI>
<MDI key="COLOR_TABLE_RULE_RGB_3">3.400000e+00 4.200000e+00 0 0 255 255 0 255</MDI>
<MDI key="COLOR_TABLE_RULE_RGB_4">4.200000e+00 5.000000e+00 255 0 255 255 0 0</MDI>
<MDI key="Generated_with">GRASS GIS 7.0.3</MDI>
<MDI key="STATISTICS_MAXIMUM">5</MDI>
<MDI key="STATISTICS_MEAN">3.4714760638298</MDI>
<MDI key="STATISTICS_MINIMUM">1</MDI>
<MDI key="STATISTICS_STDDEV">1.4943102023375</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>
Binary file not shown.
@@ -0,0 +1,27 @@
<PAMDataset>
<PAMRasterBand band="1">
<Histograms>
<HistItem>
<HistMin>0.5833333333333333</HistMin>
<HistMax>6.416666666666667</HistMax>
<BucketCount>6</BucketCount>
<IncludeOutOfRange>0</IncludeOutOfRange>
<Approximate>0</Approximate>
<HistCounts>1999|920|2110|3010|1960|5001</HistCounts>
</HistItem>
</Histograms>
<Metadata>
<MDI key="COLOR_TABLE_RULES_COUNT">5</MDI>
<MDI key="COLOR_TABLE_RULE_RGB_0">1.000000e+00 2.000000e+00 255 255 0 0 255 0</MDI>
<MDI key="COLOR_TABLE_RULE_RGB_1">2.000000e+00 3.000000e+00 0 255 0 0 255 255</MDI>
<MDI key="COLOR_TABLE_RULE_RGB_2">3.000000e+00 4.000000e+00 0 255 255 0 0 255</MDI>
<MDI key="COLOR_TABLE_RULE_RGB_3">4.000000e+00 5.000000e+00 0 0 255 255 0 255</MDI>
<MDI key="COLOR_TABLE_RULE_RGB_4">5.000000e+00 6.000000e+00 255 0 255 255 0 0</MDI>
<MDI key="Generated_with">GRASS GIS 7.0.3</MDI>
<MDI key="STATISTICS_MAXIMUM">6</MDI>
<MDI key="STATISTICS_MEAN">4.1343333333333</MDI>
<MDI key="STATISTICS_MINIMUM">1</MDI>
<MDI key="STATISTICS_STDDEV">1.7411551401935</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>
@@ -0,0 +1,17 @@
#
#
300
7043.06
1.89772e+07
#
1700
7405.93
2.01921e+07
#
6000
7287.21
1.90221e+07
#
7000
7246.81
1.90226e+07
@@ -0,0 +1,124 @@
title:
nbands: 1
class:
classnum: 1
classtitle:
classtype: 1
subclass:
pi: 0.22802
means: 9764.5
covar:
3.02234e+06
endsubclass:
subclass:
pi: 0.495197
means: 5208.5
covar:
7.97435e+06
endsubclass:
subclass:
pi: 0.118668
means: 997.979
covar:
686411
endsubclass:
subclass:
pi: 0.158115
means: 13401
covar:
702077
endsubclass:
endclass:
class:
classnum: 2
classtitle:
classtype: 1
subclass:
pi: 0.177696
means: 13267.4
covar:
1.06971e+06
endsubclass:
subclass:
pi: 0.172485
means: 3861.81
covar:
2.35556e+06
endsubclass:
subclass:
pi: 0.48383
means: 8696.48
covar:
7.62681e+06
endsubclass:
subclass:
pi: 0.165989
means: 1052.05
covar:
692627
endsubclass:
endclass:
class:
classnum: 3
classtitle:
classtype: 1
subclass:
pi: 0.135816
means: 1158.36
covar:
934515
endsubclass:
subclass:
pi: 0.187835
means: 11847.9
covar:
1.74438e+06
endsubclass:
subclass:
pi: 0.0829488
means: 14066.2
covar:
268579
endsubclass:
subclass:
pi: 0.5934
means: 6298.74
covar:
8.66516e+06
endsubclass:
endclass:
class:
classnum: 4
classtitle:
classtype: 1
subclass:
pi: 0.278456
means: 3394.59
covar:
2.33337e+06
endsubclass:
subclass:
pi: 0.0849227
means: 13998.4
covar:
256746
endsubclass:
subclass:
pi: 0.102818
means: 686.099
covar:
379342
endsubclass:
subclass:
pi: 0.222279
means: 11683.6
covar:
1.75208e+06
endsubclass:
subclass:
pi: 0.311523
means: 7849.26
covar:
3.21781e+06
endsubclass:
endclass:

0 comments on commit 1f21af6

Please sign in to comment.
You can’t perform that action at this time.