function encode_binary_dataarray3_rank3_I8P(x, y, z) result(code)
!< Encode (Base64) a dataarray with 3 components of rank 3 (I8P).
integer(I8P), intent(in) :: x(1:,1:,1:) !< X component.
integer(I8P), intent(in) :: y(1:,1:,1:) !< Y component.
integer(I8P), intent(in) :: z(1:,1:,1:) !< Z component.
character(len=:), allocatable :: code !< Encoded base64 dataarray.
integer(I1P), allocatable :: xyz(:) !< Packed data.
integer(I4P) :: nn1 !< Number of elements along dim 1.
integer(I4P) :: nn2 !< Number of elements along dim 2.
integer(I4P) :: nn3 !< Number of elements along dim 3.
integer(I4P) :: nn !< Number of elements.
integer(I4P) :: n1 !< Counter.
integer(I4P) :: n2 !< Counter.
integer(I4P) :: n3 !< Counter.
nn1 = size(x, dim=1)
nn2 = size(x, dim=2)
nn3 = size(x, dim=3)
nn = nn1*nn2*nn3
call pack_data(a1=[int(3*nn*BYI8P, I4P)], a2=[(((x(n1, n2, n3), y(n1, n2, n3), z(n1, n2, n3), n1=1, nn1), &
n2=1, nn2), &
n3=1, nn3)], &
packed=xyz)
call b64_encode(n=xyz,code=code)
endfunction encode_binary_dataarray3_rank3_I8P