Refactor tools directory

Do some refactoring of the tools directory ahead
of working on radiometric drift:

- Have one unit test file per library, and put
  these all in a "tests" subfolder to keep things
  tidier

- Create a new libtools.py for holding functions
  that will be useful in several tools (such as
  reading reflectance from the geotiffs).

- Move get_angles and read_reflectance from the
  BRDG library into this new shared tools file.
  (And move unit tests to the appropriate new
  test file too)

- Create skeleton file for new radiometric drift
  library and associated test file.
Extract data fields

Start the radiometric drift routine, by reading
data fields from the two JSON object inputs and
storing in dictionaries.

Perform a check to make sure that both datasets
are for the same region of interest (might want
to add other checks here later?)

Also add unit tests for new methods
Add doublet checking methods

Add functions to libtools for checking doublets:
- calc_amc calculates the AMC value for given
  viewing angles

- calc_amc_threshold calculates the AMC value
  corresponding to given angular differences,
  to be used as a threshold value

- check_doublet takes a pair of images and
  tests whether they meet all the matching
  criteria (AMC below threshold value, dates
  within threshold offset, ROI coverage at
  least threshold value)

- Also add a helper tool slice_dictionary to
  enable taking a slice across all keys in a
  dictionary (ie as if doing something like
  dic[:][index])

Also add tests for these new functions
Add some new general functions

Add some new functions to libtools, for use by
the other tools:

- mean_date: return the mean of a list of dates
  (in python datetime format). This was previously
  coded in libbrdf_reoujean, so change that to
  call this libtools function instead.

- get_reflectance_band: Read 2d reflectance array
  from a list of files, but only for a particular
  raster band.
  Also change the name of get_reflectance to
  get_reflectance_mean so the distinction is clear.

Add units tests for these too
Extract doublets

Add function to libtools to extract doublet pairs
(pairs that match AMC, time, and ROI coverage
criteria).

The function loops through all images from the
target sensor, and finds any reference images
that make a valid doublet with that target image.

Returns lists of the indices of the image pairs in
the original arrays, and a list of the mean time
of each pair.
Calculate and plot radiometric drift

Using the new doublet extraction, get list of
doublets, then extract the corresponding
timeseries of reflectances, calculate the ratio
of target/reference reflectance, and plot it.
Fit a straight line and plot that too.

(nb at the moment, the bands are hardcoded)
Add unittest for brdf filter_timeseries method
Radiometric drift for each band

Change radiometric drift routine so that it now
loops over all the bands for the target sensor,
and looks to see if there is a matching band for
the reference sensor (bands are considered matching
if within 10mn). Then calculate the drift for each
band where a match was found.
Save drifts to text file

Write a csv file with the drift for each band.
Also add a unit test for this method.
Changes to rad drift unit test

Make test_plot_drift check the drift return
value. Also, in the main method set a logical
parameter we can use to turn off plotting
commands when running the tests (since the
backend isn't defined on the build server)
Tweaks to plots

Amend calls to plt.savefig to remove all
the excess whitespace round the plot that
gets added by default.

Also use autofmt_date to produce better
x-axis date ticks for the radiometric
drift plot. Without this, the tick labels
tend to run into each other.
Update tools documentation

Add new sections to the tools documentation
for the libtools and librad_drift libraries.
Remove debugging stuff

Remove some lines that were just there
for debugging.
Merge branch 'rad_drift'

Merge in the radiometric drift branch. Also
contains some changes to the tools directory
as a whole - a subdirectory to hold the tests,
and move some commonly used functions to a
separate libtools.py file.