Reshape the cube () into a grid with original dimension (opposite of reshape_up)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=xp), | intent(in), | dimension(:,:,:), allocatable | :: | cube | original cube |
|
real(kind=xp), | intent(inout), | dimension(:,:,:), allocatable | :: | data | reshape cube |
|
integer, | intent(in), | dimension(3) | :: | dim_cube | new cube dimension |
|
integer, | intent(in), | dimension(3) | :: | dim_data | original cube dimension |
subroutine reshape_down(cube, data, dim_cube, dim_data)
!! Reshape the cube (\( 2^{nside} \)) into a grid with original dimension (opposite of reshape_up)
implicit none
real(xp), intent(in), dimension(:,:,:), allocatable :: cube !! original cube
real(xp), intent(inout), dimension(:,:,:), allocatable :: data !! reshape cube
integer, intent(in), dimension(3) :: dim_data !! original cube dimension
integer, intent(in), dimension(3) :: dim_cube !! new cube dimension
integer :: offset_w, offset_h
offset_w = (dim_cube(2) - dim_data(2)) / 2
offset_h = (dim_cube(3) - dim_data(3)) / 2
data = cube(:, offset_w+1:offset_w+dim_data(2), offset_h+1:offset_h+dim_data(3))
end subroutine reshape_down