!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! !! GNU General Public License !! !! !! !! This file is part of the Flexible Modeling System (FMS). !! !! !! !! FMS is free software; you can redistribute it and/or modify !! !! it and are expected to follow the terms of the GNU General Public !! !! License as published by the Free Software Foundation. !! !! !! !! FMS is distributed in the hope that it will be useful, !! !! but WITHOUT ANY WARRANTY; without even the implied warranty of !! !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the !! !! GNU General Public License for more details. !! !! !! !! You should have received a copy of the GNU General Public License !! !! along with FMS; if not, write to: !! !! Free Software Foundation, Inc. !! !! 59 Temple Place, Suite 330 !! !! Boston, MA 02111-1307 USA !! !! or see: !! !! http://www.gnu.org/licenses/gpl.txt !! !! !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !$Id: gridinterpol.F90,v 1.1.2.1 2007/09/11 13:01:46 smg Exp $ #include"cppdefs.h" !----------------------------------------------------------------------- !BOP ! !ROUTINE: Interpolate from observation space to model grid ! ! !INTERFACE: subroutine gridinterpol(N,cols,obs_z,obs_prof,nlev,model_z,model_prof) ! ! !DESCRIPTION: ! ! This is a utility subroutine in which observational data, which might ! be given on an arbitrary, but structured grid, are linearly interpolated and ! extrapolated to the actual (moving) model grid. ! ! !USES: IMPLICIT NONE ! ! !INPUT PARAMETERS: integer, intent(in) :: N,cols REALTYPE, intent(in) :: obs_z(0:N),obs_prof(0:N,cols) integer, intent(in) :: nlev REALTYPE, intent(in) :: model_z(0:nlev) ! ! !OUTPUT PARAMETERS: REALTYPE, intent(out) :: model_prof(0:nlev,cols) ! ! !REVISION HISTORY: ! Original author(s): Karsten Bolding & Hans Burchard ! $Log: gridinterpol.F90,v $ ! Revision 1.1.2.1 2007/09/11 13:01:46 smg ! Add these files to the mom4p1 branch. ! AUTHOR:Griffies ! REVIEWERS: ! TEST STATUS: ! CHANGES PUBLIC INTERFACES? ! CHANGES ANSWERS? ! ! Revision 1.5 2005-11-18 10:59:34 kbk ! removed unused variables - some left in parameter lists ! ! Revision 1.4 2005/06/27 13:44:07 kbk ! modified + removed traling blanks ! ! Revision 1.3 2003/03/28 09:20:36 kbk ! added new copyright to files ! ! Revision 1.2 2003/03/10 08:54:16 gotm ! Improved documentation and cleaned up code ! ! Revision 1.1.1.1 2001/02/12 15:55:58 gotm ! initial import into CVS ! !EOP ! ! !LOCAL VARIABLES: integer :: i,j,ii REALTYPE :: rat !----------------------------------------------------------------------- !BOC ! Set surface values to uppermost input value do i=nlev,1,-1 if(model_z(i) .ge. obs_z(N)) then do j=1,cols model_prof(i,j) = obs_prof(N,j) end do end if end do ! Set bottom values to lowest input value do i=1,nlev if(model_z(i) .le. obs_z(1)) then do j=1,cols model_prof(i,j) = obs_prof(1,j) end do end if end do ! Interpolate inner values linearly do i=1,nlev if ((model_z(i) .lt. obs_z(N)) .and. (model_z(i) .gt. obs_z(1))) then ii=0 224 ii=ii+1 if (obs_z(ii) .le. model_z(i)) goto 224 rat=(model_z(i)-obs_z(ii-1))/(obs_z(ii)-obs_z(ii-1)) do j=1,cols model_prof(i,j)=(1-rat)*obs_prof(ii-1,j)+rat*obs_prof(ii,j) end do end if end do return end !EOC !----------------------------------------------------------------------- ! Copyright by the GOTM-team under the GNU Public License - www.gnu.org !-----------------------------------------------------------------------