MagicForrest / DGVMTools

R package for processing, analysing and visualising ouput from Dynamic Global Vegetation Models (DGVMs)
GNU General Public License v3.0
29 stars 22 forks source link

Biome class values #64

Closed lukasbaumbach closed 3 years ago

lukasbaumbach commented 3 years ago

Hi,

maybe this is more of a convenience issue, but I realized that the biome classification (getBiomes()) outputs the class values labelled from 1:length(classes). I guess it is implemented that way, so that only the factor levels that are actually used appear in the legend when you plot the classification. However, for further processing or comparisons this is inconvenient since the class values for the biomes can vary (probably determined by the order of their first appearance in the data). In my example I was very surprised that class 1 turned out to be "Dry Grassland", while the Smith2014BiomeScheme lists "Tropical Rain Forest" as the first class. A fixed class-value pair assignment like 1="Tropical Rain Forest", 2="Tropical Deciduous Forest" etc. would be more straightforward in my opinion.

Cheers, Lukas

MagicForrest commented 3 years ago

Hi Lukas,

This is a good idea, I totally see you point. Setting the full range of factor levels is a probably quite a good idea. However, it might mess with the plotting code, so it is not something that I will implement in quickly. Can you work around it and a flag it as "not urgent"?

lukasbaumbach commented 3 years ago

Yep, my current workaround is using a lookup table, where I match the original Haxeltine classes with the DGVMTools-assigned classes based on biome names. You can flag/label it as "not urgent" for sure.

MagicForrest commented 3 years ago

Hi Lukas. I implemented this. In fact it was very simple. I would be grateful if you could test it in the Format-NetCDF branch. Thanks!

lukasbaumbach commented 3 years ago

Cool, thanks for fixing this so soon! I'll let you know the next time I use it.