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

LPJ-Guess output / points comparison against Saatchi dataset #31

Closed antonycastro closed 5 years ago

antonycastro commented 5 years ago

Hi again MagicForrest,

This time I write to you because I want to compare with my simulation output of Above Ground Biomass with the Saatchi dataset in DGVMTools.

I wonder how could I make it right. I have made trials without success (attached the case). I get the error:

Error in compareLayers(field1 = cmass.year.mean, field2 = Saatchi.vegC, : The fields you selected to compare have no common points, so layer comparison can't be done! Check your input data and also note that the 'decimal.places' argument to this function may be useful for truncating coordinates to a common precision.

Magic_forest.zip

MagicForrest commented 5 years ago

Hi Antony,

You will need to make sure that both the Fields are on exactly the same coordinates. The easiest way is to use the 'lonlat.offset' argument to defineSource() when you define the Source. This way you can move the gridcells to the centre of the gridcell (instead of the south-west left corner). This should be set to c(0.25, 0.25) to move the +0.25 up (ie to the north) and +0.25 right (ie to the west). I made the simple modification in the attached script and it works.

This is the correct thing to if the output it from an old LPJ-GUESS run that used the lower-left corner of the gridcell instead of the centre. Is that true in this case? Or did you get those coordinates some other way?

Spatial comparison_points_Saatchi.R.zip

antonycastro commented 5 years ago

Hi Matthew,

Thanks for the orientation. Well, that may be the case. I was given the cmass.out and Brienen datasets.

Many thanks for the explanation of the easiest way. My task is to make a function that automatizes the temporal, spatial and comparison processes and present it. I will include an "if" argument which uses "lonlat.offset" if it is an old version.