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/dev_1784_OBS/NEMO/OPA_SRC/OBS – NEMO

source: branches/dev_1784_OBS/NEMO/OPA_SRC/OBS/obs_level_search.h90 @ 2001

Last change on this file since 2001 was 2001, checked in by djlea, 14 years ago

Adding observation operator code

File size: 1.8 KB
Line 
1   SUBROUTINE obs_level_search( kgrd, pgrddep, kobs, pobsdep, kobsk )
2      !!----------------------------------------------------------------------
3      !!                    ***  ROUTINE obs_level_search ***
4      !!
5      !! ** Purpose : Search levels to find matching level to observed depth
6      !!
7      !! ** Method  : Straightforward search
8      !!
9      !! ** Action  :
10      !!
11      !! History :
12      !!        !  2001-11  (N. Daget, A. Weaver)
13      !!        !  2006-03  (A. Weaver) NEMOVAR migration.
14      !!        !  2006-05  (K. Mogensen) Moved to to separate routine.
15      !!        !  2006-10  (A. Weaver) Cleanup
16      !!        !  2008-10  (K. Mogensen) Remove assumptions on grid.
17      !!----------------------------------------------------------------------
18
19      !! * Arguments
20      INTEGER, INTENT(IN) :: &
21         &   kgrd     ! Number of gridpoints
22      REAL(KIND=wp), DIMENSION(kgrd), INTENT(INOUT) :: &
23         &   pgrddep  ! Depths of gridpoints
24      INTEGER, INTENT(IN) :: &
25         &   kobs     ! Number of observations
26      REAL(KIND=wp), DIMENSION(kobs), INTENT(INOUT) :: &
27         &   pobsdep  ! Depths of observations
28      INTEGER ,DIMENSION(kobs), INTENT(OUT) :: &
29         &   kobsk    ! Level indices of observations
30 
31      !! * Local declarations
32      INTEGER :: &
33         &   ji, &
34         &   jk
35
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
47   END SUBROUTINE obs_level_search
Note: See TracBrowser for help on using the repository browser.