Sense About Science kicked off their Evidence Matters campaign earlier this year and this month held a meeting in parliament to push the importance of policy decisions based upon factual evidence. That is, making decisions that have impact upon society for the benefit of all, not simply to push a political agenda or because it’s what politicians believe but not what evidence shows. And the corollary is ignoring evidence - when it has been collected and presented, don’t make a decision because you don’t like the evidence (the so-called “post-truth society”). It’s critically important for the community we share and the environment we inhabit. There shouldn’t be elitist strongholds on decision making, but egalitarian approaches that value all.
Way back in 2009 I published a paper on the Cookie Cutter which outlined a method (and accompanying script) for calculating the volume of drumlins. This worked in ArcGIS 9.2 using the Python interface to a number of ArcGIS toolbox tools. Fast forward 9 years since I first wrote the script and, not too surprisingly, it doesn’t work (thanks for telling me Arturs!).
I finally sat down a few weeks ago to bug fix the script which was actually easier than I thought it would. It’s actually comprised of two scripts - the first sets up some working directories and takes an input shapefile, splitting into a number of new shapelines (one per drumlin). The second script then performs the volume calculation on each drumlins. It turns out (given Im pretty much only calling Toolbox tools) that there wasn’t much to fix… a third party script splitting the initial shapefile had to be removed, a bug in the command adding a new field and then reference to ArcGIS 10.4 paths. For those wanting to use it, please download the attached files and follow the notes below.
I use WinPython 2.7 and then the excellent Spyder IDE to run the scripts from
in Spyder you need to change the Python console to the path of the one that ArcGIS has installed. Goto Tools -> Preferences -> Console -> Advanced Settings then change “Use the following Python Interpreter”. It should be something like: C:Python27ArcGIS10.4python.exe
at the top of the cookie_setup script set the project_directory to the location of the main input shapefile. For outlines, set the name of the input shapefile
Press F5 to run the setup script, creating the working directories and adding a new field to the shapefile
the next part needs to be performed manually (I haven’t had time to add in and test the Toolbox call)… add a new text field to the outlines attribute table called “split” and consecutively number each row from A1 to An (ie your last row). In QGIS the expression in the field calculator is concat(‘A’, @row_number )
save the file then use the ArcGIS Toolbox tool Analysis Tools->Extract->Split
use this to split the outlines shapefile based upon the “split” field you just created. Specify the “Target Workspace” as the “input” directory that has been created in your project directory
now load Cookie_Cutter into Spyder and again specify the following 5 inputs:
project_directory : the project directory
nextmap_dsm_img : the input DEM
gp.cellSize : the DEM cellsize (in metres)
tension_parameter : leave this as it is
buffer_parameter : the distance to buffer your drumlins (in metres). The example shows 20m, for a 5m DEM
on line 66-68 you might need to change the path to the listed toolboxes. This is specified for 10.4 at the moment
RUN IT! The console pane in Spyder should show you a whole load of information as it processes each drumlin. There will be a counter showing you which drumlin you are on
The key output is the Volume_Master.dbf table. You can open this in excel. It is zonal stats from ArcGIS for each individual drumlin (subtracted from the cookie cut DEM). The critical value is the SUM column that shows the total height for all pixels within the drumlin. Multiply this by 25 (for a 5x5 pixel) to give you drumlin volume.
UPDATE: If you can’t (or don’t want to) use Spyder you can just run the py script directly from the command line using the interpreter that ships with ArcGIS.
This is one of those actions that is incredibly useful every so often… you have a tab open and you actually want to duplicate (so you have an active copy) and then carry on working with the current tab. Except there is no “duplicate tab” (or clone) option when you right click in the window or on the tab. This is actually one of those Unix-esque type daisy-chaining of functions to achieve the same in result. So… middle clicking on a link will load that link in a new tab (very useful itself). Solution:
middle click on the reload page icon (next to the address bar)
Yes, one of the manuscript writing moments where I was using Endnote and wanted to cite a webpage for an organisation. Enter the oranisation name in and the European Geosciences Union gets turned into…
This is one of those annoying diversions where you either go and work and the syntax for citing it or… do it manually.
In this instance I Googled it and found that all that was needed was the humble
at the end of the author field. It’s always easy when you know how!