# [ncl-talk] Dimension size, for dimension number 0, of operands does not match

Alan Brammer abrammer at albany.edu
Mon May 11 12:36:35 MDT 2015

```You need to work out/ decide how t and t1 relate to each other.

Is t1 a subset of t?
Is it coarser resolution?
How does t(25,36,10) actually relate to t1 ?

Rhetorical questions for you to answer yourself.  Not sure how one would
compare two geographical grids with such different dimensions unless it is
a subset.  In which case you should subset t to be the same area as t1.

dof1 and dof2 are created from t & t1 so fixing t & t1 will fix dof1 & dof2
issues.

Alan.

On 11 May 2015 at 14:29, Vanúcia Schumacher <vanucia-schumacher at hotmail.com>
wrote:

> NCL users,
>
>
> I need to calculate the correlation between two variables with different
> lat and lon. But when I try to calculate the significance test this
> correlation appears this error:
>
> Dimension size, for dimension number 0, of operands does not match, can't
> continue
>
>
> I understand that the error is due to DOF1 and dof2 have different sizes
> of lat and lon, but how could I solve it in this case?
>
> My code:
>
> ....
>
>  r   = escorc( t, t1 )   ; correlation
> cor= r(:,:,0,0)
> copy_VarCoords(t,cor)
>
> ; Calculate degrees of freedom for each time series pair
> ; This estimates the dof in autocorrelated series.
>
>   siglvl = 0.05
>   dof1   = equiv_sample_size (t, siglvl,0)
>   dof2   = equiv_sample_size (t1, siglvl,0)
>
>  ; For each grid point time series pair, choose the lesser abs value
>
>   dof  = where(abs(dof1).le.abs(dof2), dof1, dof2)   error line
>
>   copy_VarCoords(cor,dof)
>
>   rsig = rtest( cor, round(dof,3), 0)    ; r test NCL
> ...
>
>
> Variable: t
> Type: float
> Total Size: 1944000 bytes
>             486000 values
> Number of Dimensions: 3
> Dimensions and sizes: [lat | 90] x [lon | 180] x [time | 30]
>
> Variable: t1
> Type: float
> Total Size: 7920 bytes
>             1980 values
> Number of Dimensions: 3
> Dimensions and sizes: [lat | 6] x [lon | 11] x [time | 30]
> Coordinates:
>
>   Variable: r
> Type: float
> Total Size: 4276800 bytes
>             1069200 values
> Number of Dimensions: 4
> Dimensions and sizes: [90] x [180] x [6] x [11]
> Coordinates:
> Number Of Attributes: 1
>
> Variable: cor
> Type: float
> Total Size: 64800 bytes
>             16200 values
> Number of Dimensions: 2
> Dimensions and sizes: [lat | 90] x [lon | 180]
>
>
> Variable: dof1
> Type: integer
> Total Size: 64800 bytes
>             16200 values
> Number of Dimensions: 2
> Dimensions and sizes: [90] x [180]
> Coordinates:
>
> Variable: dof2
> Type: integer
> Total Size: 264 bytes
>             66 values
> Number of Dimensions: 2
> Dimensions and sizes: [6] x [11]
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...