Skip to content

Latest commit

 

History

History
77 lines (53 loc) · 3.77 KB

Mapping_tools_plan.asc

File metadata and controls

77 lines (53 loc) · 3.77 KB

Thoughts on developing the mapping tools

This document is a place to put thoughts and a plan for developing the plotting tools.

Motivation

[LSDTopoTools] spits out raster data and point data in the form of csv files. In the past, to look at this data we needed to use a GIS. Using GIS is a pain since:

  • It takes a long time to start up.

  • If you are running many analyses and want to just look at results it is a pain to keep loading data layers using mouse clicks.

    • Whenever you load a data later you need to re-do all the styling.

    • The csv import requires many, many mouse clicks.

  • You need to make lots of choices to generate a plot, so it is hard for two users to generate the same plot.

So, we decided that using a programming language to plot the data was better since in might (in the long run) save time and in addition we could get totally reproducible plots. The added benefit would be that we could both give these script to other users and also it would help with teaching.

Our mapping tools were born when SMM finally figured out how to get binary raster data in and out of python using GDAL. It probably would have taken DValts a few hours but this was a major challenge for SMM. But he got there in the end.

Now we have a somewhat unwieldy plotting package that could do with some planning. Below are notes about the plan.

Basic observations

  • There are two time when we generally work on these scripts. We haven’t really got a good balance between these things.

    • When we have a paper or talk and we need a specific figure. This leads to quite specific sorts of code.

    • When we need code for distribution or teaching. This leads to code that is complicated by efforts to stop it from breaking.

  • In making lots of plots for papers, it seems we are narrowing down to some common themes.

    • There needs to be a simple way to plot multiple layers of rasters.

    • There needs to be a simple way of labelling points or shapes.

    • There needs to be a simple way of formatting the size of the figures (and the size of text, line weights, etc.)

    • There needs to be a simple way of adding point data.

    • There needs to be a simple way of having multiple plots.

    • There needs to be a simple way to manage colour scales and colourbars.

Some sort of plan.

  • We should have basic building blocks for adding layers. Instead of many custom plots we should have one plotting function that can have up to X drapes. I have some plots with 4 raster layers (!!) but I can’t see adding more than that without making it impossible to see anything.

  • We should also have basic building blocks for adding point data.

  • Labelling should be automated.

Most of the above is covered in the basic observations topic.

What will these objects look like?

Start writing here!!

Drape plotter

Design from the top down? How do you want the API to work?

# Minimal options should produce a decent looking default plot...
myPlot = LSDplots.Drape(Filename, Directory, Colourmap=cmap, OtherDefaults=blah, etc ...)

# oops I need to add another drape
myplot.addRaster(Filename, other_options=foo)
myplot.addPoints(Filename, options=etc)

# But you can still tweak if you need to:
# Object contains a list of Drapes/Layers that you can access:
# The names are created based on the filename

myPlot.Drape['water'].setCmap("rainbow")
myPlot.Drape['erosion'].setCmap("jet")

# Deafult sizing options
myPlot.saveplot("ESurf_1col", "svg")
myPlot.saveplot("Powerpoint", "png")

# Tweak labels if you don't like the autogen ones
myPlot.fig.setTitle("Blah")

# Higher level functions for simplicity that group commonly used methods
# Can be used for teaching and easy creation of commonly used plots.
myChiPlot = ChiPlot(DirectoryWithAllNeededFiles), options_for_chi_defaults=defaults)
myFloodPlot = FloodPlot(Directory)

Etc....