!-------------------------------------- LICENCE BEGIN ------------------------------------
!Environment Canada - Atmospheric Science and Technology License/Disclaimer,
! version 3; Last Modified: May 7, 2008.
!This is free but copyrighted software; you can use/redistribute/modify it under the terms
!of the Environment Canada - Atmospheric Science and Technology License/Disclaimer
!version 3 or (at your option) any later version that should be found at:
!http://collaboration.cmc.ec.gc.ca/science/rpn.comm/license.html
!
!This software 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 above mentioned License/Disclaimer for more details.
!You should have received a copy of the License/Disclaimer along with this software;
!if not, you can write to: EC-RPN COMM Group, 2121 TransCanada, suite 500, Dorval (Quebec),
!CANADA, H9P 1J3; or send e-mail to service.rpn@ec.gc.ca
!-------------------------------------- LICENCE END --------------------------------------
!
SUBROUTINE SUMASKLAT 2,8
#if defined (DOC)
*
***s/r SUMASKLAT - Set-up mask used when computing statistics only over
* a restricted latitude band as specified by namelist
* variable NREGION
*
*Author : M. Buehner 2007
*Revision:
*
* -------------------
** Purpose:
* .
*Arguments
#endif
IMPLICIT NONE
*implicits
#include "comdim.cdk"
#include "comlun.cdk"
#include "comcva.cdk"
#include "comcse1.cdk"
#include "comcst.cdk"
C
integer jj,klat1,klat2,klat3,klat4,ISRCHILA
c
klat1=0
klat2=0
klat3=0
klat4=0
if(nregion.eq.0) then
c GLOBAL
do jj=1,nj
masklat(jj)=1.0d0
enddo
elseif(nregion.eq.1) then
c NH
klat1=ISRCHILA
(35.0*rpi/180.0)-1
klat2=ISRCHILA
(10.0*rpi/180.0)-1
do jj=1,(klat1-1)
masklat(jj)=1.0d0
enddo
do jj=klat1,klat2
masklat(jj)=dble(klat2-jj+1)/dble(klat2-klat1+2)
enddo
do jj=(klat2+1),nj
masklat(jj)=0.0d0
enddo
elseif(nregion.eq.2) then
c TR
klat1=ISRCHILA
(35.0*rpi/180.0)-1
klat2=ISRCHILA
(10.0*rpi/180.0)-1
klat3=ISRCHILA
(-10.0*rpi/180.0)-1
klat4=ISRCHILA
(-35.0*rpi/180.0)-1
do jj=1,(klat1-1)
masklat(jj)=0.0d0
enddo
do jj=klat1,klat2
masklat(jj)=dble(jj-klat1+1)/dble(klat2-klat1+2)
enddo
do jj=(klat2+1),(klat3-1)
masklat(jj)=1.0d0
enddo
do jj=klat3,klat4
masklat(jj)=dble(klat4-jj+1)/dble(klat4-klat3+2)
enddo
do jj=(klat4+1),nj
masklat(jj)=0.0d0
enddo
elseif(nregion.eq.3) then
c SH
klat3=ISRCHILA
(-10.0*rpi/180.0)-1
klat4=ISRCHILA
(-35.0*rpi/180.0)-1
do jj=1,(klat3-1)
masklat(jj)=0.0d0
enddo
do jj=klat3,klat4
masklat(jj)=dble(jj-klat3+1)/dble(klat4-klat3+2)
enddo
do jj=(klat4+1),nj
masklat(jj)=1.0d0
enddo
endif
write(nulout,*) 'SUMASKLAT: NREGION=',nregion
write(nulout,*) 'SUMASKLAT: KLAT=',klat1,klat2,klat3,klat4
write(nulout,*) 'SUMASKLAT: MASKLAT=',masklat
RETURN
END