source: branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis4/NEMOGCM/NEMO/OPA_SRC/OBS/obs_level_search.h90 @ 11639

Last change on this file since 11639 was 11639, checked in by rrenshaw, 14 months ago

regional mean and transport diagnostics added for reanalysis

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