wrtsst.f 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. ! ==================================================================
  2. ! ------------------------------------------------------------------
  3. !
  4. subroutine wrtsst(pfield,mon,nye)
  5. use lsgvar
  6. implicit none
  7. !
  8. ! ------------------------------------------------------------------
  9. integer :: mon,nye,kpar,ktape,inum,itim,kkk
  10. real (kind=8) :: anum
  11. real (kind=8) :: pfield(ienjen)
  12. real (kind=8) :: zhead(20),zprel(6)
  13. character(len=12) monthsst
  14. !
  15. ! ??? Attention - this is only valid for ntyear=12
  16. if (ntyear.ne.12) then
  17. write(*,*) ' This form of routine WRTSST runs is not valid!'
  18. write(*,*) ' - only suitable with ntyear=12'
  19. write(*,*) ' ntyear=',ntyear
  20. return
  21. endif
  22. !
  23. !
  24. ! SST file for input to planet simulator, filename with year/month
  25. write (monthsst,"(a5,i5.5,i2.2)") "bsst_",nye,mon
  26. !
  27. open (68,file=monthsst,form="formatted")
  28. rewind 68
  29. !
  30. anum=10.
  31. kpar=-2
  32. ktape=71
  33. zhead(1)=real(kpar) ! field code of the variable
  34. zhead(2)=-100.
  35. zhead(3)=real(ktape)
  36. zhead(4)=real(ien)
  37. zhead(5)=real(jen)
  38. zhead(6)=1.
  39. zhead(7)=0.3750000000e+01
  40. zhead(8)=0.9375000000e+02
  41. zhead(9)=0.2111030000e+06
  42. zhead(10)=0.8806140000e+06
  43. anum=11.
  44. zhead(3)=12.
  45. zhead(9)=204065.
  46. call actdate(idat,itim)
  47. zhead(10)=real(idat)
  48. zhead(11)=real(itim)
  49. write(*,'(3a)') ' WRTSST: SST data written on file ',monthsst
  50. !
  51. write (68,*) anum
  52. !
  53. inum=nint(anum)
  54. inum=min0(inum,20)
  55. inum=max0(inum,8)
  56. !
  57. ! Header.
  58. !
  59. write (68,'(6f6.0,2f6.3,3f8.0)') (zhead(kkk),kkk=1,inum)
  60. !
  61. !
  62. !* 2. Write data
  63. ! ----------
  64. !
  65. zprel(1)=real(kpar) ! field code of the variable
  66. zprel(2)=real(mon)
  67. zprel(3)=0.
  68. zprel(4)=0.
  69. zprel(5)=0.
  70. zprel(6)=0.
  71. write (68,7050) (zprel(kkk),kkk=1,6)
  72. 7050 format (6e12.4)
  73. write (68,7100) (pfield(kkk),kkk=1,ienjen)
  74. 7100 format (4e20.10)
  75. close (68)
  76. 7000 format (e20.10)
  77. return
  78. end subroutine wrtsst