m_write_wet_file.F90 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. module m_write_wet_file
  2. contains
  3. subroutine write_wet_file(obs, nrobs)
  4. use mod_measurement
  5. implicit none
  6. type (measurement), intent(inout) :: obs(:)
  7. integer, intent(in):: nrobs
  8. integer j, i, nrshow
  9. logical ex
  10. nrshow = max(nrobs / 10, 1)
  11. print *, '10 observations:'
  12. print '(a)',' # obs var id lon lat depth ipiv jpiv nsup'//&
  13. ' 4-bilin-coeffs active orig (i,j) N age orig_id'
  14. inquire(iolength = i) obs(1)
  15. open (11, file = 'observations.uf', status = 'replace',&
  16. form = 'unformatted', access = 'direct', recl = i)
  17. do j = 1, nrobs
  18. write(11, rec = j) obs(j)
  19. if (obs(j) % d > 1.01 .and. trim(obs(j) % id) == 'ICEC') then
  20. print *, obs(j) % lon, obs(j) % lat, obs(j) % d, obs(j) % var
  21. end if
  22. if (mod(j, nrshow) == 0) then
  23. print '(i6,2g10.2,a6,3f6.1,3i6,4f5.1,l5,2i7,f7.1,i5,i8)', j, obs(j)
  24. end if
  25. enddo
  26. close(11)
  27. print *, 'Observations printed to file observation.uf'
  28. end subroutine write_wet_file
  29. end module m_write_wet_file