JGCRI / fldgen

Given a global mean temperature pathway, generate random global climate fields consistent with it and with spatial and temporal correlation derived from an ESM
https://jgcri.github.io/fldgen/
GNU General Public License v2.0
12 stars 6 forks source link

globalop field in griddata is incorrect when grid cells are missing #35

Closed rplzzz closed 4 years ago

rplzzz commented 4 years ago

When part of a grid is missing, as, for example, in the land-only data files provided by ISIMIP, we drop all of the grid cells containing NA values: https://github.com/JGCRI/fldgen/blob/c8e220d915e0c9441fe04ade72db2cd89afc2c28/R/handle_NAs.R#L50-L55 The globalop field is the global mean operator; we have to drop the missing values from there too. However, for the global mean operator to do its job, it has to be scaled so that it sums up to 1, and we don't rescale it here. This causes our global mean temperatures to be bogus.

> emu <- train_models('IPSL-CM5A-LR')
> sum(emu$griddataT$globalop)
[1] 0.2869764
> summary(emu$tgav)
       V1       
 Min.   :81.73  
 1st Qu.:82.01  
 Median :82.16  
 Mean   :82.39  
 3rd Qu.:82.73  
 Max.   :84.28