New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
obs_level_search.h90 in branches/UKMO/AMM15_v3_6_STABLE_package_reanalysis4/NEMOGCM/NEMO/OPA_SRC/OBS – NEMO

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

Last change on this file was 12789, checked in by rrenshaw, 4 years ago

adopt one of Rob's profile fixes

File size: 2.4 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  : Will return level associated with T-point below the obs
16      !!              depth, except when observation is in the top box will
17      !!              return level 2. Also, if obs depth greater than depth
18      !!              of last wet T-point (kpk-1) will return level kpk.
19      !!
20      !! History :
21      !!        !  2001-11  (N. Daget, A. Weaver)
22      !!        !  2006-03  (A. Weaver) NEMOVAR migration.
23      !!        !  2006-05  (K. Mogensen) Moved to to separate routine.
24      !!        !  2006-10  (A. Weaver) Cleanup
25      !!        !  2008-10  (K. Mogensen) Remove assumptions on grid.
26      !!        !  2020-04  (R. King/RJR) Add Rob's fix
27      !!        !            https://code.metoffice.gov.uk/trac/utils/ticket/335
28      !!----------------------------------------------------------------------
29
30      !! * Arguments
31      INTEGER, INTENT(IN) :: kgrd     ! Number of gridpoints
32      REAL(KIND=wp), DIMENSION(kgrd), INTENT(INOUT) :: &
33         &   pgrddep  ! Depths of gridpoints
34      INTEGER, INTENT(IN) :: &
35         &   kobs     ! Number of observations
36      REAL(KIND=wp), DIMENSION(kobs), INTENT(INOUT) :: &
37         &   pobsdep  ! Depths of observations
38      INTEGER ,DIMENSION(kobs), INTENT(OUT) :: &
39         &   kobsk    ! Level indices of observations
40 
41      !! * Local declarations
42      INTEGER :: ji
43      INTEGER :: jk
44
45      !------------------------------------------------------------------------
46      ! Search levels for each observations to find matching level
47      !------------------------------------------------------------------------
48      DO ji = 1, kobs
49         kobsk(ji) = 1
50         depk: DO jk = 2, kgrd-1
51            IF ( pgrddep(jk) >= pobsdep(ji) ) EXIT depk
52         END DO depk
53         kobsk(ji) = jk
54      END DO
55
56   END SUBROUTINE obs_level_search
Note: See TracBrowser for help on using the repository browser.