# [ncl-talk] Conform a multi-dimensional array to another multi-dimensional array

Dennis Shea shea at ucar.edu
Fri Apr 21 12:35:23 MDT 2023

```Maybe this is a start:

=================
a(12,100),  b(11,100)     ? meta data
=================
dima = dimsizes(a)
dimb = dimsizes(b)

na0   = dima(0)
nb0   = dimb(0)

c       = new(dima, typeof(a))
c(0:nb0-1) = (/  b /)    ;   (/ ... /) means no meta data

; meta data

copy_VatAtts(a,c)

; If necessary, coordinate info (named dimensions and coordinate values)
will hav e to be added

On Fri, Apr 21, 2023 at 6:21 AM Giorgio Graffino via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Dear NCL folks,
>
>
>
> I have two multi-dimensional arrays: array a is 12x100 and array b is
> 11x100. I want to conform them to make their dimensions the same. I'm sure
> there is an easy way to do it, but so far I failed all attempts.
>
>
>
> For now, I mainly tried to add a row of missing values to array b to get
> an array c with dimensions 12x100 (the same of array a). Here is a list of
> the things I tried with their error message.
>
>
>
> c = conform(a,b,1)                ; fatal:conform: The array to be
> conformed must have the same number of dimensions as indicated by the
> length of the last argument
>
>
>
> c = (/b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue)/)          ;
> fatal:_NclBuildArray: each element of a literal array must have the same
> number of dimensions
>
>
>
> c = array_append_record(b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue),0)
>                  ; array_append_record: ranks not equal: rank_x1=2
>  rank_x2=1
>
>
>
> c = table_attach_rows(b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue),0)
>           ; fatal:Number of dimensions in parameter (1) of
> (table_attach_rows) is (1), (2) dimensions were expected
>
>
>
> Please let me know what else I can try or what I've done wrong.
>
>
>
> Thanks,
>
> Giorgio
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20230421/deb688bd/attachment.htm>
```