SantanderMetGroup / transformeR

An R package for climate data post-processing (part of the climate4R bundle)
https://github.com/SantanderMetGroup/climate4R
GNU General Public License v3.0
10 stars 8 forks source link

Error in using prinComp #33

Open xiaoyujiaxyj opened 4 years ago

xiaoyujiaxyj commented 4 years ago

Hi, when I used function "prinComp", I get an error: NOTE: All possible PCs/EOFs retained: This may result in an unnecessarily large object NOTE: Variable subsetting was ignored: Input grid is not a multigrid object [2020-06-01 19:48:10] Performing PC analysis on 1 variable ... Error in prcomp.default(aux) : cannot rescale a constant/zero column to unit variance In addition: Warning message: In prinComp(pr.ens) : Missing data found. Replacing NaN values with the mean value. If you are worried about outliers consider replacing the missing data with the median value instead. This can be done by setting the parameter imputation = 'median'

I see the function "prinComp" replaces missing data with the mean or the median. When the datasets only cover the land and the selected area containing the ocean, it will be a/some constant column(s). How to solve this problem? Could you give me some suggestions? Thanks in advance!

jorgebanomedina commented 4 years ago

Hi,

To date there is no way to handle locations or gridpoints that contain NaNs all over the time dimension, such is the case of datasets where there is only data over land gridpoints. One solution could be to get rid of the sea locations manually (this involves redimensioning the grid from time-lat-lon to time-loc) and then call the prinComp function.

Hope this helps!

Jorge