MagicForrest / DGVMTools

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

biome schemes for aDGVM2 #19

Closed sedrickel closed 5 years ago

sedrickel commented 5 years ago

Hello again Matthew,

So we are at a point where our team wishes to create new biome schemes to be used for aDGVM2. What I do for version 0.5 of DGVMTools is that I 'source' the code of aDGVM2 schemes created by Simon in RStudio, as per his instructions when I was there in Frankfurt. In the latest dev version, however, I get this error when I do that:

source('D:/aDGVM/DGVM_Tools_pack/aDGVM2_biome-schemes.R') Error in initialize(value, ...) : invalid name for slot of class “BiomeScheme”: needGDD5

How can I deal with this issue? I am asking because I will use his codes as a template for the scheme I want to create. If you need more information from codes (the schemes that Simon created) to further diagnose this issue, I'll forward them to you.

Thanks!

MagicForrest commented 5 years ago

Hi again Sedricke,

Try just removing any lines which say needGDD5 = TRUE or needGDD5 = FALSE.

If that doesn't work then send me the code from Simon ;-)

sedrickel commented 5 years ago

Okay, that has worked with no errors. :-)

So does this mean that I could now then source a biome scheme, while still being able to use that ones built in with the library? (Related question: Are the other biome schemes which are built in such as Hickler2012 and Forrest2015 currently unavailable to be applied to aDGVM2 outputs?)

Sorry for the rookie questions, and grateful for your patience!

MagicForrest commented 5 years ago

Yes, you should be able to source new BiomeSchemes. Avoid giving them the same names as any pre-existing ones.

And no, the Hickler2012 and Forrest2015 biome schemes won't work for aDGVM2 because the depend on the european tree species or global PFTs too much.

MagicForrest commented 5 years ago

Hi Sedricke. Everything clear, shall I close this issue now?

sedrickel commented 5 years ago

Hi Matt. Sorry but one more question on this: Is it possible to use to replicate runs and apply the biome classifications to their average?

MagicForrest commented 5 years ago

Ah. Yes. That is a good point. You have really hit on something there. It is a bit of an edge case in general, but it is important for aDGVM2.

It is tricky, because getBiomes() now works on Source objects, not Field objects, and the package can average Field objects but not Source objects. There are two potential fixes.

  1. It may be possible to fudge it by saving the averaged Source, and then call getBiome() on it, but that will only work if the STAInfo (spatial-temporal-annual extent) is exactly the same, and even then I am not 100% sure if it will work.

  2. I can probablt modify getBiomes() to work over a list Sources and average them before making the biome Field. It is a bit more work, but probably a better solution.

I'll mull over it, and get back to you in a bit.

MagicForrest commented 5 years ago

Hi Sedricke,

Apparently it has been "17 days ago" since I told you that I would "get back to you in a bit". Sorry about that!

Good news, I implemented option 2 (of my previous comment) in the branch 'average-biomes'. You can now call getBiomes() with a list of Source objects in the source argument. Note that you also need to define the averaged.source argument with an 'empty' Source.

So, check out the branch and let me know if it works for you. I will sneak it into master the next time I do a bug fix or a breaking feature update. The feature is too marginal and unbreaking to get it's own release version.

sedrickel commented 5 years ago

Hi Matt,

Thanks for updating the package. The new getBiomes works well with my aDGVM2 results, and I am able to generate an average of my biome classes with my two replicates.

Sorry for the delay in testing this! I will close this issue now. Cheers.