Tuesday, 21 May 2019

Reproduce spatial plots with the same colours in GIS software

Biodiverse version 3 will allow users to export GeoTIFFs of the display colours for spatial outputs that have been displayed in the GUI.

The format used is RGBA (red, green, blue with a fourth Alpha channel for transparency).  This is a standard image format and is supported by many GIS packages.

This one is best demonstrated with pictures.  The GIS used is QGIS, but the general process is the same in ArcGIS.


The Acacia PD data displayed using a log scale with the default colour scheme. 

The RGB export is in the exports menu, with all the other exports.

The file selection is the usual process.  

And now in the GIS, the file is selected using the normal process.  Note that the file name is updated like the GeoTIFF exports, but with _rgb appended to the main part of the name. 

Biodiverse knows nothing about coordinate systems, so it is up to the user to choose the correct one for their data.  

The default display has all the colours, but the background is black.  To fix that you need to set the fourth band as the transparency layer.

As per the previous image caption, choose band 4 as the transparency layer.  The same general process is needed in ArcGIS (set the alpha channel to be band 4). 

And here is the data with some Open Street Map data in the background.  


And as a bonus, the RGB GeoTIFFs can be exported at the same time as a standard GeoTIFF export using the "Generate RGB Rasters" option.

As the tooltip states, the RGB files are only generated for indices that have been displayed, so you don't get huge numbers of exports if you have not displayed them.   



Shawn Laffan
20-May-2019

If you want to try this out before version 3 is released then the 2.99_004 (or later) development release can be accessed through the downloads page at https://github.com/shawnlaffan/biodiverse/wiki/Downloads

--------

For more details about Biodiverse, see http://shawnlaffan.github.io/biodiverse


To see what Biodiverse has been used for, see https://github.com/shawnlaffan/biodiverse/wiki/PublicationsList




You can also join the Biodiverse-users mailing list at http://groups.google.com/group/Biodiverse-users

Drop label and group axes

On occasion one might load a data set where the labels consist of several levels of the Linnean hierarchy, e.g. the name of a label will be made up of order, family, genus, species and subspecies.  Or you might have packed in extra information for debugging, or you have population ID included.

However, sometimes you want to simplify the records and use them at an different level.  For example, you might want to collapse your genus:species data to the genus level, or remove population and family details.

You might also have generated group names using geographic coordinates, plus additional details about time or region (see Stephenson  et al. 2015 and Laffan et al. 2013 for examples of those), but then want to remove the region or time axes.


One approach is to export the data (labels or groups) and then reimport them using only the axes you need, but this can be tedious as it involved several steps.  You could also use the rename interface with a remap table, but setting up the table can also be tedious.

From Version 3 it can be done directly within Biodiverse.

Some screenshots are probably the best way to explain it.  See captions for details.

The data in this case were used in Cassis et al. (2017) and consist of details downloaded from the Atlas of Living Australia .  Each label comprises the family, genus, scientific name and taxonomic level, joined using a colon (the standard join character used in Biodiverse).  This last column (axis) made it easier to remove records that were not at the species level, but is not needed for many analyses.  All these columns also make it hard to link the data to phylogenies.  (Note that they have no effect on indices like taxon endemism, rarity and richness, as those only need to work with unique identifiers).



Each label comprises four axes of information.  This can be useful, but not for everything.  

The process is done through one of the duplication options.  There is no undo, so it is safer to generate a new data set.



Unsurprisingly, the new basedata needs a name.

The system can work with either groups or labels.  If you need to trim axes from both then run it twice, once for groups and once for labels.  

Select which axes you wish to drop.  In this case only the scientific name will be retained.  Note that the axes are numbered from zero, which is common for many programming languages (but not for R).  

And here are the data with simplified labels.  Note that if, two or more labels collapse down to the same name then their sample counts are merged.  


And that's pretty much it.

The same process applies to groups so there are no screenshots provided for them.

Shawn Laffan
20-May-2019

If you want to try this out before version 3 is released then the 2.99_004 (or later) development release can be accessed through the downloads page at https://github.com/shawnlaffan/biodiverse/wiki/Downloads

--------

For more details about Biodiverse, see http://shawnlaffan.github.io/biodiverse


To see what Biodiverse has been used for, see https://github.com/shawnlaffan/biodiverse/wiki/PublicationsList


You can also join the Biodiverse-users mailing list at http://groups.google.com/group/Biodiverse-users



Unicode file names on Windows

Biodiverse can now handle unicode file names on Windows.



Previously if you had a file with a name like "mexaves 5 años mex.csv", "Havlærskilpadde.shp", "Grönfläckig padda.tif", or "Démonská kachna zkázy.xlsx" then it would fail to import.  This can be a considerable irritation if working on non-English locales.

The underlying details of why are better described elsewhere, but basically the file name passed by the GUI did not match the encoding scheme when the underlying Perl code went looking for it.

Thanks to the Win32::LongPath library we can work around this and use the full windows file name.

There are no screenshots for this post, but the implementation details can be seen here for those who are interested.

This also needs to be tested using CJK (Chinese, Japanese, Korean) characters.  Please report issues if any are found.

Shawn Laffan
20-May-2019

If you want to try this out before version 3 is released then the 2.99_004 (or later) development release can be accessed through the downloads page at https://github.com/shawnlaffan/biodiverse/wiki/Downloads

--------

For more details about Biodiverse, see http://shawnlaffan.github.io/biodiverse


To see what Biodiverse has been used for, see https://github.com/shawnlaffan/biodiverse/wiki/PublicationsList


You can also join the Biodiverse-users mailing list at http://groups.google.com/group/Biodiverse-users