module mod_hycom_fileio character(len=*), parameter :: flnmgrd='regional.grid' character(len=*), parameter :: flnmdep='regional.depth' contains subroutine dump_regional(plon,plat,ulon,ulat,vlon,vlat,qlon,qlat, & scpx,scpy,scux,scuy,scvx,scvy,scqx,scqy,corio,asp,pang,depths, & mapflg) use mod_xc use mod_za implicit none real, intent(inout),dimension(idm,jdm) :: plon, plat, ulon, ulat, & vlon, vlat, qlon, qlat, scpx, scpy, scux, scuy, scvx, scvy, & scqx, scqy, corio, asp, pang, depths integer, intent(in) :: mapflg integer, dimension(idm,jdm) :: ip real :: hmin, hmax character(len=80) :: cline ip=1 ! Dump bathymetry open (unit=9,file=flnmdep(1:len_trim(flnmdep))//'.b', & status='unknown',position='rewind') write(9,'(a)') 'Depth Grid generated by conformal mapping' write(9,'(a)') ' ' write(9,'(a)') ' ' write(9,'(a)') ' ' write(9,'(a)') ' ' write(9,'(a,2f11.3)') 'min,max depth = ', & minval(depths),maxval(depths) close(9) call zaiopf(flnmdep(1:len_trim(flnmdep))//'.a','replace', 9) call zaiowr(depths,ip,.false.,hmin,hmax,9,.true.) call zaiocl(9) ! Having obtained grids, dump them in a format the "new" hycom will understand write(lp,'(a)') 'Converting grid to new' // & ' hycom format (from version 2.1.03)' open (unit=9,file=flnmgrd(1:len_trim(flnmgrd))//'.b', & status='replace') write(cline,'(i5,4x,a8)') idm, "'idm '" ; write(9,'(a80)') cline write(cline,'(i5,4x,a8)') jdm, "'jdm '" ; write(9,'(a80)') cline write(cline,'(i5,4x,a8)') mapflg, "'mapflg'" ; write(9,'(a80)') cline call zaiopf(flnmgrd(1:len_trim(flnmgrd))//'.a','replace', 9) call zaiowr(plon(1:idm,1:jdm),ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "plon",hmin,hmax call zaiowr(plat(1:idm,1:jdm),ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "plat",hmin,hmax call zaiowr(qlon(1:idm,1:jdm),ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "qlon",hmin,hmax call zaiowr(qlat(1:idm,1:jdm),ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "qlat",hmin,hmax call zaiowr(ulon(1:idm,1:jdm),ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "ulon",hmin,hmax call zaiowr(ulat(1:idm,1:jdm),ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "ulat",hmin,hmax call zaiowr(vlon(1:idm,1:jdm),ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "vlon",hmin,hmax call zaiowr(vlat(1:idm,1:jdm),ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "vlat",hmin,hmax call zaiowr(pang,ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "pang",hmin,hmax call zaiowr(scpx,ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "scpx",hmin,hmax call zaiowr(scpy,ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "scpy",hmin,hmax call zaiowr(scqx,ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "scqx",hmin,hmax call zaiowr(scqy,ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "scqy",hmin,hmax call zaiowr(scux,ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "scux",hmin,hmax call zaiowr(scuy,ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "scuy",hmin,hmax call zaiowr(scvx,ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "scvx",hmin,hmax call zaiowr(scvy,ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "scvy",hmin,hmax call zaiowr(corio,ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.10)') "cori",hmin,hmax call zaiowr(asp,ip,.false.,hmin,hmax,9,.true.) write(9,'(a4,": min,max =",2f16.5)') "pasp",hmin,hmax call zaiocl(9) close(9) end subroutine end module