subroutine switchLatLon (block_size, nj, data_in, data_out) c This subroutine takes data vector and switches the order of c latitude and longitude inputs. cccccccccc c Input: c block_size = size of blocks in degrees c nj = dimension of data vector c data_in = data vector c Output: c data_out = re-ordered data vector cccccccccc c July 29, 1999. c Last Modified: September 03, 1999. real block_size c size of each block in degrees integer nj c length of data vector real data_in(nj), data_out(nj) c data vectors before and after re-ordering integer N_tmp parameter (N_tmp = 180) real tmp(N_tmp,N_tmp) c temporary matrix storing data values for re-ordering integer jmax, imax c maximum values for do loops. integer count c keeps track of data vector position integer i, j c do loop variables c=====================PROGRAM=========================== do i = 1, nj data_out(i) = 0.0 ! cleaning end do ! end i loop if ((360.0/block_size).gt.Float(N_tmp)) then print*, '!!Error: size of tmp matrix must be re-adjusted '// + '(sub_switchLatLon.f)' print*, 'Quitting sub_switchLatLon.f ...' go to 15 end if ! if ((360.0/block_size).gt.Float(N_tmp)) do j = 1, N_tmp do i = 1, N_tmp tmp(j,i) = 0.0 ! cleaning up end do ! end i loop end do ! end j loop jmax = Int(180.0/block_size) imax = Int(360.0/block_size) count = 1 ! initial value for data_in do j = 1, jmax do i = 1, imax tmp(j,i) = data_in(count) count = count + 1 end do ! end j loop end do ! end i loop if ((count-1).ne.nj) then ! checking the length print*, '!!Error: count-1 = ', count-1, ' but nj = ', nj print*, 'Quitting sub_switchLatLon.f ...' go to 15 end if ! if ((count-1).ne.nj) count = 1 ! initial value for data_out do i = 1, imax do j = 1, jmax data_out(count) = tmp(j,i) count = count + 1 end do ! end i loop end do ! end j loop if ((count-1).ne.nj) then ! checking the length print*, '!!Error: count-1 = ', count-1, ' but nj = ', nj print*, 'Quitting sub_switchLatLon.f ...' go to 15 end if ! if ((count-1).ne.nj) 15 return END