David Trethewey's Martian scripts

These are primarily based on my 2014 MSc dissertation
on Martian glaciers. Most of these scripts are highly ad-hoc in
nature and this is an attempt to provide a little more regularised
version of these primarily for my own reuse of code towards related
and other projects.
A couple of Python functions that return a list of points
approximating the drawing of a circle with an N sided polygon

The data file based on the Souness et al. 2012 table as supplementary
data from the paper with details of HRSC and HiRISE coverage added by hand.
This has a small number of changes made in Sept 2016 after I discovered
I had incorrectly assigned a few HRSC tiles

A spreadsheet with some updated notes on the data including the
small number of duplicates and apparent errors in the Souness catalogue.
This has a small number of changes made in Sept 2016 after I discovered
I had incorrectly assigned a few HRSC tiles
A Python script that reprojects the locations of the Souness objects
from lat/long to the 40° equicylindrical system. The above .csv file
is hardcoded as input and the below .csv as output

The Souness objects with locations in the equicylindrical system.
This has a small number of changes made in Sept 2016 after I discovered
I had incorrectly assigned a few HRSC tiles.
Creates region of interest shapefiles based on the data in
The head, terminus, left+right channel points and centre have a circle
of radius 100m defined for them, and an 'extent' is defined from these points
assuming constant channel width, and a 'context' and 'context9' defined
by expanding the extent by factors of 3 and 9 about the centre.
This also now exports the location of the
mid-line of each GLF to ''SounessGLFprofiles.csv'

NOTE - some of the zonal statistics scripts were lost...
Make zonal statistics based on MOLA data for the Souness glacier ROIs
zonal statistics based on a set of randomised ROIs - this looks like the
easiest base to rewrite back to the Souness ROIs one
Collate the files together for the above zonal statistics
rewritten Souness ROIs zonal statistics - not tested yet!
 Souness ROIs for midpoints zonal statistics
rewritten file to collate Souness ROIs zonal statistics - not tested yet!
adapted script of Dan Clewley to do the zonal stats
reads in the Souness GLF profiles, get elevations with GDAL
and makes PNG files of their profiles

PNG files of the output profiles

the main one for the dissertation results
a different version which also does an 0.04kmsq size
for DTM resolutions better than 125m. Also uses raw aspect
rather than abs(aspect from north)
Add the statistics (without +9999) to the clumps file from segmentation
same but for segmentation from rawAsp using both 2e5 and 4e4 sizes.
run gdal_polygonize for all tiles and export RAT to .csv file
same as above but for the newer raw-aspect based 2e5 and 4e4 sqm. segmentations
Subset the HRSC nadir image files to the bounding box of the context of
each Souness GLF. Create rasterized images from context, extent and head
Now also generates DTM images, and layerstacks of HRSC image/DTM/slope.
These are all locally scaled.
Create the index HTML of buttons for each Souness GLF, and the Top Trumps page
for each Souness GLF.
Now also generates a JSON file used by the Javascript version of the Souness Top trumps pages.

the CSS style file that goes with the HTML generated by

a spreadsheet listing all the HiRISE images with a Cornish language title
with their image ID, URL, anaglyphs (as of 14.05.16), description,
longitude (dorhys) and latitude (dorles)
converts a series of greyscale images to pseudocolour.
Used for the output DTM images.