I would like to run PCA for different variables from ERA5. I have 4 different variables, 30 years of hourly data and longitude, latitude. How should I transform the data to run PCA?
Asked
Active
Viewed 171 times
0
-
It depends on which PCA function you want to run. With FactoMineR according to what you wrote, you can use your dataframe as it stands (variable in columns, recordings in rows) – Basti Apr 05 '22 at 09:54
-
Thanks for answering. I would like to use the prcomp from the stats packege in r. – les2004 Apr 05 '22 at 11:24
-
converting a large 3d data cube to a data frame would be very inefficient. I would suggest using one of the xarray-based modules in python (e.g. xmca) to perform the PCA directly on the 3d cube. – Matteo De Felice Apr 06 '22 at 19:01