Hi Ruksana
G'day
I think there is some other way.
I am assuming you are having 4-d variable (lat, lon, time depth)
(1) I think for pattern correlation you have to select equal size boxes for the variable e.g. box1 (of 10 lat grids * 10 lon grids * 12 time steps and 12 depth levels) and same size of box2.
(2) then you have to arrange this 4-d array in to 1-d array using sequence or sequence or sequence etc. So this sequence function will convert your n-d variable to 1-d variable. Apply it to both fields.
(3) then you will have two 1-d variables of size (10*10*12*12 = 14400 e.g.) that you can use for regression or/and correlation
Cheers, Saurabh