obs_level_search.h90 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. !!----------------------------------------------------------------------
  2. !! NEMO/OPA 3.3 , NEMO Consortium (2010)
  3. !! $Id: obs_level_search.h90 2287 2010-10-18 07:53:52Z smasson $
  4. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  5. !!----------------------------------------------------------------------
  6. SUBROUTINE obs_level_search( kgrd, pgrddep, kobs, pobsdep, kobsk )
  7. !!----------------------------------------------------------------------
  8. !! *** ROUTINE obs_level_search ***
  9. !!
  10. !! ** Purpose : Search levels to find matching level to observed depth
  11. !!
  12. !! ** Method : Straightforward search
  13. !!
  14. !! ** Action :
  15. !!
  16. !! History :
  17. !! ! 2001-11 (N. Daget, A. Weaver)
  18. !! ! 2006-03 (A. Weaver) NEMOVAR migration.
  19. !! ! 2006-05 (K. Mogensen) Moved to to separate routine.
  20. !! ! 2006-10 (A. Weaver) Cleanup
  21. !! ! 2008-10 (K. Mogensen) Remove assumptions on grid.
  22. !!----------------------------------------------------------------------
  23. !! * Arguments
  24. INTEGER, INTENT(IN) :: kgrd ! Number of gridpoints
  25. REAL(KIND=wp), DIMENSION(kgrd), INTENT(INOUT) :: &
  26. & pgrddep ! Depths of gridpoints
  27. INTEGER, INTENT(IN) :: &
  28. & kobs ! Number of observations
  29. REAL(KIND=wp), DIMENSION(kobs), INTENT(INOUT) :: &
  30. & pobsdep ! Depths of observations
  31. INTEGER ,DIMENSION(kobs), INTENT(OUT) :: &
  32. & kobsk ! Level indices of observations
  33. !! * Local declarations
  34. INTEGER :: ji
  35. INTEGER :: jk
  36. !------------------------------------------------------------------------
  37. ! Search levels for each observations to find matching level
  38. !------------------------------------------------------------------------
  39. DO ji = 1, kobs
  40. kobsk(ji) = 1
  41. depk: DO jk = 2, kgrd
  42. IF ( pgrddep(jk) >= pobsdep(ji) ) EXIT depk
  43. END DO depk
  44. kobsk(ji) = jk
  45. END DO
  46. END SUBROUTINE obs_level_search