How to combine two gridded data?

I have a variable A with the size of 33x168x360. The 2nd dimension is latitude with a range of -77.5 to 89.5. My goal is to expand it to the size of 33x180x360, with the latitude range between -89.5 to 89.5 prefilled with NaN values.

B = fill(NaN, (33, 12, 360));

How do I combine A and B to form the new gridded data with the size of 33x180x360?

Thanks.

How about

B = fill(NaN,(33,180,360))
B[:,1:end-12,:] = A[:,:,:]

?

1 Like

Brilliant! It works well. Thank you so much.