How to concatenate two arrays in Fortran 90 -


i have original array called pres_lev3d, size defined pres_lev3d(im*jm, levsi), im*jm 72960 , levsi 64. corresponds global atmospheric data, size. array allocatable: real (kind=kind_io8), allocatable :: pres_lev3d(:, :). have second array, press_1d, size defined in similar fashion pres_1d(im*jm, levsi), in array levsi 1.

i need concatenate both arrays (technically 2d , 1d array) array of shape (/72960, 65/). in matlab seems simple process, however, can't seem find easy way go around in fortran 90.

i have tried create third array

pres_lev=(/pres_lev3d, pres_1d/) 

and tried use merge, none of these approaches seem work out.

i new fortran.

if i've followed explanation correctly work

   real(kind_io8), dimension(72960,65) :: out_array    ...    out_array(:,1:64) = pres_lev3d    out_array(:,65) = pres_1d 

if that's not easy enough, or if i've misunderstood question, explain further. allocate out_array conform input arrays, try like

   real(kind_io8), dimension(:,:), allocatable :: out_array    ...    allocate(out_array(size(pres_lev3d,1),size(pres_lev3d,2)+1))    ...    out_array(:,1:64) = pres_lev3d    out_array(:,65) = pres_1d 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -