Skip to content
This repository was archived by the owner on Apr 20, 2026. It is now read-only.

Commit 3cae52c

Browse files
committed
Remove dependency on scipy, numexpr
There were some hidden dependencies on scipy.ndimage and numexpr which were not recorded in the documentation. This update removes those dependencies, and replaces the calculation of the slope and aspect with only numpy functions, based on numpy version 1.6 (which is the standard packaged with ArcGIS 10.2). Because of the way that the scipy.ndimage functions calculated the slope (giving a slightly smoothed result), it was necessary to update the test data sets. We chose this route to avoid the requirement of essentially duplicating the scipy.ndimage.convolve2d code, using only Numpy. Modifications were also made to the way the slope is calculated for cells adjacent to nodata values. The updated approach gives a better representation of the slope in these areas that is of a similar scale to the neighbouring values.
1 parent 6c10a79 commit 3cae52c

140 files changed

Lines changed: 225 additions & 886 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/install.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ For detailed instructions on installation of these dependencies, please see the
2222

2323
* `Python <https://www.python.org/>`_ - v2.7 preferred
2424
* `Numpy <http://www.numpy.org/>`_ - v1.6.2 preferred
25+
* `Nose <http://nose.readthedocs.io/en/latest/index.html>`_
2526
* `Arcpy in ArcGIS 10.2 <http://resources.arcgis.com/en/help/main/10.2/index.html#//000v000000v7000000/>`_
2627

28+
.. note:: ArcGIS 10.2 is packaged with a modified version of `Numpy`. In our experience, attempting to update the `Numpy` package will cause the `arcpy` library to fail catastrophically, and usually without reporting any error message. We recommend not trying to upgrade the version of `Numpy` linked to your `ArcGIS` installation.
29+
2730
Setting the environment
2831
-----------------------
2932
To enable BAL toolbox to run flawlessly, you may need to change some environment settings. The important variable to set is the ``PYTHONPATH`` variable. This should be set to the path where you have extracted the contents of the zip file. A complete discussion on environment variables in Python is given in the `Python documentation <https://docs.python.org/2/using/cmdline.html#environment-variables>`_.
@@ -35,7 +38,7 @@ The Python documentation contains some simple instructions for setting environme
3538
Testing the installation
3639
------------------------
3740

38-
The code includes a suite of unit tests that ensure elements of the code base work as expected. The code should be tested before running the toolbox.
41+
The code includes a suite of unit tests that ensure elements of the code base work as expected. The code should be tested before running the toolbox. Users will need to install the `Nose <http://nose.readthedocs.io/en/latest/index.html>`_ package to run these tests.
3942

4043
The test suite can be run from the main directory. On Windows, run the ``run_test_all.cmd`` script from the main BAL directory.
4144

examples/input/info/arc.dir

0 Bytes
Binary file not shown.

examples/output/bal_e.img

0 Bytes
Binary file not shown.

examples/output/bal_e.img.aux.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
<BucketCount>256</BucketCount>
1212
<IncludeOutOfRange>1</IncludeOutOfRange>
1313
<Approximate>0</Approximate>
14-
<HistCounts>411|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|2154|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|253|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|1337|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|103</HistCounts>
14+
<HistCounts>411|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|2186|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|221|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|1151|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|289</HistCounts>
1515
</HistItem>
1616
</Histograms>
1717
<Metadata>
18-
<MDI key="STATISTICS_COVARIANCES">234.665030108727</MDI>
18+
<MDI key="STATISTICS_COVARIANCES">451.439340329464</MDI>
1919
<MDI key="STATISTICS_MINIMUM">12.5</MDI>
2020
<MDI key="STATISTICS_MAXIMUM">100</MDI>
21-
<MDI key="STATISTICS_MEAN">27.520079849695</MDI>
21+
<MDI key="STATISTICS_MEAN">30.065875998121</MDI>
2222
<MDI key="STATISTICS_MEDIAN">0</MDI>
2323
<MDI key="STATISTICS_MODE">0</MDI>
24-
<MDI key="STATISTICS_STDDEV">15.318780307476</MDI>
24+
<MDI key="STATISTICS_STDDEV">21.24710192778</MDI>
2525
<MDI key="STATISTICS_SKIPFACTORX">1</MDI>
2626
<MDI key="STATISTICS_SKIPFACTORY">1</MDI>
2727
<MDI key="STATISTICS_EXCLUDEDVALUES"></MDI>

examples/output/bal_e.img.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<metadata xml:lang="en"><Esri><CreaDate>20160708</CreaDate><CreaTime>13565300</CreaTime><ArcGISFormat>1.0</ArcGISFormat><ArcGISstyle>ANZLIC</ArcGISstyle><SyncOnce>TRUE</SyncOnce><DataProperties><lineage><Process ToolSource="c:\program files (x86)\arcgis\desktop10.2\ArcToolbox\Toolboxes\Data Management Tools.tbx\DefineProjection" Date="20160708" Time="135653">DefineProjection bal_e.img PROJCS['GDA_1994_MGA_Zone_50',GEOGCS['GCS_GDA_1994',DATUM['D_GDA_1994',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',117.0],PARAMETER['Scale_Factor',0.9996],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]</Process></lineage></DataProperties></Esri></metadata>
2+
<metadata xml:lang="en"><Esri><CreaDate>20170508</CreaDate><CreaTime>14473700</CreaTime><ArcGISFormat>1.0</ArcGISFormat><ArcGISstyle>ANZLIC</ArcGISstyle><SyncOnce>TRUE</SyncOnce><DataProperties><lineage><Process ToolSource="c:\program files (x86)\arcgis\desktop10.2\ArcToolbox\Toolboxes\Data Management Tools.tbx\DefineProjection" Date="20170508" Time="144737">DefineProjection bal_e.img PROJCS['GDA_1994_MGA_Zone_50',GEOGCS['GCS_GDA_1994',DATUM['D_GDA_1994',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',117.0],PARAMETER['Scale_Factor',0.9996],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]</Process></lineage></DataProperties></Esri></metadata>

examples/output/bal_e.rrd

0 Bytes
Binary file not shown.

examples/output/bal_max.img

0 Bytes
Binary file not shown.

examples/output/bal_max.img.aux.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 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0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|733</HistCounts>
1515
</HistItem>
1616
</Histograms>
1717
<Metadata>
18-
<MDI key="STATISTICS_COVARIANCES">766.286164255348</MDI>
18+
<MDI key="STATISTICS_COVARIANCES">760.045107438503</MDI>
1919
<MDI key="STATISTICS_MINIMUM">12.5</MDI>
2020
<MDI key="STATISTICS_MAXIMUM">100</MDI>
21-
<MDI key="STATISTICS_MEAN">35.632324779778</MDI>
21+
<MDI key="STATISTICS_MEAN">35.444657219456</MDI>
2222
<MDI key="STATISTICS_MEDIAN">0</MDI>
2323
<MDI key="STATISTICS_MODE">0</MDI>
24-
<MDI key="STATISTICS_STDDEV">27.681874290867</MDI>
24+
<MDI key="STATISTICS_STDDEV">27.568915601425</MDI>
2525
<MDI key="STATISTICS_SKIPFACTORX">1</MDI>
2626
<MDI key="STATISTICS_SKIPFACTORY">1</MDI>
2727
<MDI key="STATISTICS_EXCLUDEDVALUES"></MDI>

examples/output/bal_max.img.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<metadata xml:lang="en"><Esri><CreaDate>20160708</CreaDate><CreaTime>13565500</CreaTime><ArcGISFormat>1.0</ArcGISFormat><ArcGISstyle>ANZLIC</ArcGISstyle><SyncOnce>TRUE</SyncOnce><DataProperties><lineage><Process ToolSource="c:\program files (x86)\arcgis\desktop10.2\ArcToolbox\Toolboxes\Data Management Tools.tbx\DefineProjection" Date="20160708" Time="135655">DefineProjection bal_max.img PROJCS['GDA_1994_MGA_Zone_50',GEOGCS['GCS_GDA_1994',DATUM['D_GDA_1994',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',117.0],PARAMETER['Scale_Factor',0.9996],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]</Process></lineage></DataProperties></Esri></metadata>
2+
<metadata xml:lang="en"><Esri><CreaDate>20170508</CreaDate><CreaTime>14474200</CreaTime><ArcGISFormat>1.0</ArcGISFormat><ArcGISstyle>ANZLIC</ArcGISstyle><SyncOnce>TRUE</SyncOnce><DataProperties><lineage><Process ToolSource="c:\program files (x86)\arcgis\desktop10.2\ArcToolbox\Toolboxes\Data Management Tools.tbx\DefineProjection" Date="20170508" Time="144742">DefineProjection bal_max.img PROJCS['GDA_1994_MGA_Zone_50',GEOGCS['GCS_GDA_1994',DATUM['D_GDA_1994',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',117.0],PARAMETER['Scale_Factor',0.9996],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]</Process></lineage></DataProperties></Esri></metadata>

examples/output/bal_max.rrd

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)