!-------------------------------------- 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 --------------------------------------
***s/r e_bmfsplitxy2 - wrapper and call to bmf_splitwritexy
*

      subroutine e_bmfsplitxy2 ( F_s, F_ni, F_nj, F_v_S, F_k, F_gnk,  69
     $                               F_gni, F_hgrid,F_vgrid,F_scat )
#include "impnone.cdk"
*
      character* (*) F_v_S
      integer F_ni,F_nj,F_k,F_gnk,F_gni,F_hgrid,F_vgrid,F_scat
      real    F_s(F_ni,F_nj)
*
*author
*     L. Corbeil    - May 2001
*
*revision
* v2_30 - Corbeil, L.       - initial version
* v3_00 - Desgagne & Lee    - Lam configuration
*
*object
*  See ID section
*
*______________________________________________________________________ 
*                    |                                                 |
* NAME               | DESCRIPTION                                     |
*--------------------|-------------------------------------------------|
* F_v_S (in)         | Name of variable contained in F_fi              |
* F_ni (in)          | Size of variable contained in F_fi              |
* F_nj (in)          | Size of variable contained in F_fi              |
* F_bmf_time1 (in)   | Time tag for bmf_splitwrite (yyyymmdd)          |
* F_bmf_time2 (in)   | Time tag for bmf_splitwrite (hhmmsscc)          |
* F_hgrid (in)       | Horizontal grid descriptor for bmf_splitwrite   |
* F_vgrid (in)       | Vertical grid descriptor for bmf_splitwrite     |
* F_bmf_dtyp  (in)   | Data type for bmf_splitwrite                    |
* F_scat  (in)       | Scatter list tag for bmf_splitwrite             |
* F_s  (in)          | Field to be wrapped and written                 |
*-----------------------------------------------------------------------
*
#include "bmf.cdk"
*
      integer i, j, k, cnt, err
      real wrk (F_gni*F_nj)
*
*     ---------------------------------------------------------------
*
      cnt=0
*     Gathering 
      do j=1,F_nj 
      do i=1,F_gni
         cnt = cnt + 1
         wrk(cnt) = F_s(i,j)
      enddo
      enddo
*
      write(6,1000) F_v_S, F_gni, F_nj
      call bmf_splitwritexy ( F_v_S,F_gni,F_nj,F_gnk,F_k,F_k,
     $                        bmf_time1,bmf_time2,F_hgrid,F_vgrid,
     $                        bmf_dtyp,F_scat,wrk)
*
 1000 format('e_bmfsplitxy for ',A,' ni=',i6,' nj=',i6)
*
      return
      end