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_read_altbias.F90 in branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/OBS – NEMO

source: branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/OBS/obs_read_altbias.F90 @ 2287

Last change on this file since 2287 was 2287, checked in by smasson, 14 years ago

update licence of all NEMO files...

  • Property svn:keywords set to Id
File size: 6.5 KB
Line 
1MODULE obs_read_altbias
2   !!======================================================================
3   !!                       ***  MODULE obs_readaltbias  ***
4   !! Observation diagnostics: Read the bias for SLA data
5   !!======================================================================
6
7   !!----------------------------------------------------------------------
8   !!   obs_rea_altbias : Driver for reading altimeter bias
9   !!----------------------------------------------------------------------
10
11   !! * Modules used   
12   USE par_kind, ONLY : &       ! Precision variables
13      & wp, &
14      & dp, &
15      & sp
16   USE par_oce, ONLY : &        ! Domain parameters
17      & jpi, &
18      & jpj, &
19      & jpim1
20   USE in_out_manager, ONLY : & ! I/O manager
21      & lwp,    &
22      & numout 
23   USE obs_surf_def             ! Surface observation definitions
24   USE dom_oce, ONLY : &        ! Domain variables
25      & tmask, &
26      & tmask_i, &
27      & e1t,   &
28      & e2t,   &
29      & gphit
30   USE oce, ONLY : &           ! Model variables
31      & sshn
32   USE obs_inter_h2d
33   USE obs_utils               ! Various observation tools
34   USE obs_inter_sup
35
36   IMPLICIT NONE
37
38   !! * Routine accessibility
39   PRIVATE
40
41   PUBLIC obs_rea_altbias     ! Read the altimeter bias
42
43   !!----------------------------------------------------------------------
44   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
45   !! $Id$
46   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
47   !!----------------------------------------------------------------------
48
49CONTAINS
50
51   SUBROUTINE obs_rea_altbias( kslano, sladata, k2dint, bias_file )
52      !!---------------------------------------------------------------------
53      !!
54      !!                   *** ROUTINE obs_rea_altbias ***
55      !!
56      !! ** Purpose : Read from file the bias data
57      !!
58      !! ** Method  :
59      !!
60      !! ** Action  :
61      !!
62      !! References :
63      !!
64      !! History : 
65      !!      ! :  2008-02 (D. Lea) Initial version
66      !!----------------------------------------------------------------------
67      !! * Modules used
68      USE iom
69
70      !! * Arguments
71      INTEGER, INTENT(IN) :: kslano      ! Number of SLA Products
72      TYPE(obs_surf), DIMENSION(kslano), INTENT(INOUT) :: &
73         & sladata       ! SLA data
74      INTEGER, INTENT(IN) :: k2dint
75      CHARACTER(LEN=128) :: bias_file
76
77      !! * Local declarations
78
79      CHARACTER(LEN=12), PARAMETER :: cpname = 'obs_rea_altbias'
80
81      INTEGER :: jslano       ! Data set loop variable
82      INTEGER :: jobs         ! Obs loop variable
83      INTEGER :: jpialtbias   ! Number of grid point in latitude for the bias
84      INTEGER :: jpjaltbias   ! Number of grid point in longitude for the bias
85      INTEGER :: iico         ! Grid point indicies
86      INTEGER :: ijco
87      INTEGER :: i_nx_id      ! Index to read the NetCDF file
88      INTEGER :: i_ny_id      !
89      INTEGER :: i_file_id    !
90      INTEGER :: i_var_id
91
92      REAL(wp), DIMENSION(jpi,jpj) :: & 
93         & z_altbias           ! Array to store the alt bias values
94      REAL(wp), DIMENSION(1) :: &
95         & zext, &
96         & zobsmask
97      REAL(wp), DIMENSION(2,2,1) :: &
98         & zweig
99      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: &
100         & zmask, &
101         & zbias, &
102         & zglam, &
103         & zgphi
104      REAL(wp) :: zlam
105      REAL(wp) :: zphi
106      INTEGER, DIMENSION(:,:,:), ALLOCATABLE :: &
107         & igrdi, &
108         & igrdj
109      INTEGER :: numaltbias
110
111      IF(lwp)WRITE(numout,*) 
112      IF(lwp)WRITE(numout,*) ' obs_rea_altbias : '
113      IF(lwp)WRITE(numout,*) ' ------------- '
114      IF(lwp)WRITE(numout,*) '   Read altimeter bias'
115
116      ! Open the file
117
118      z_altbias(:,:)=0.0_wp
119      numaltbias=0
120
121      IF(lwp)WRITE(numout,*) 'Opening ',bias_file
122
123      CALL iom_open( bias_file, numaltbias, ldstop=.FALSE. )
124     
125
126      IF (numaltbias .GT. 0) THEN     
127
128         ! Get the Alt bias data
129         
130         CALL iom_get( numaltbias, jpdom_data, 'altbias', z_altbias(:,:), 1 )
131         
132         ! Close the file
133         
134         CALL iom_close(numaltbias)     
135         
136      ELSE
137
138         IF(lwp)WRITE(numout,*) 'no file found'
139     
140      ENDIF
141
142      ! Intepolate the bias already on the model grid at the observation point
143 
144      DO jslano = 1, kslano
145
146         ALLOCATE( &
147            & igrdi(2,2,sladata(jslano)%nsurf), &
148            & igrdj(2,2,sladata(jslano)%nsurf), &
149            & zglam(2,2,sladata(jslano)%nsurf), &
150            & zgphi(2,2,sladata(jslano)%nsurf), &
151            & zmask(2,2,sladata(jslano)%nsurf), &
152            & zbias(2,2,sladata(jslano)%nsurf)  &
153            & )
154         
155         DO jobs = 1, sladata(jslano)%nsurf
156
157            igrdi(1,1,jobs) = sladata(jslano)%mi(jobs)-1
158            igrdj(1,1,jobs) = sladata(jslano)%mj(jobs)-1
159            igrdi(1,2,jobs) = sladata(jslano)%mi(jobs)-1
160            igrdj(1,2,jobs) = sladata(jslano)%mj(jobs)
161            igrdi(2,1,jobs) = sladata(jslano)%mi(jobs)
162            igrdj(2,1,jobs) = sladata(jslano)%mj(jobs)-1
163            igrdi(2,2,jobs) = sladata(jslano)%mi(jobs)
164            igrdj(2,2,jobs) = sladata(jslano)%mj(jobs)
165
166         END DO
167
168         CALL obs_int_comm_2d( 2, 2, sladata(jslano)%nsurf, &
169            &                  igrdi, igrdj, glamt, zglam )
170         CALL obs_int_comm_2d( 2, 2, sladata(jslano)%nsurf, &
171            &                  igrdi, igrdj, gphit, zgphi )
172         CALL obs_int_comm_2d( 2, 2, sladata(jslano)%nsurf, &
173            &                  igrdi, igrdj, tmask(:,:,1), zmask )
174         CALL obs_int_comm_2d( 2, 2, sladata(jslano)%nsurf, &
175            &                  igrdi, igrdj, z_altbias, zbias )
176
177         DO jobs = 1, sladata(jslano)%nsurf
178
179            zlam = sladata(jslano)%rlam(jobs)
180            zphi = sladata(jslano)%rphi(jobs)
181            iico = sladata(jslano)%mi(jobs)
182            ijco = sladata(jslano)%mj(jobs)
183           
184            CALL obs_int_h2d_init( 1, 1, k2dint, zlam, zphi,         &
185               &                   zglam(:,:,jobs), zgphi(:,:,jobs), &
186               &                   zmask(:,:,jobs), zweig, zobsmask )
187           
188            CALL obs_int_h2d( 1, 1,      &
189               &              zweig, zbias(:,:,jobs),  zext )
190
191            ! adjust mdt with bias field
192            sladata(jslano)%rext(jobs,2) = &
193               sladata(jslano)%rext(jobs,2) - zext(1)
194           
195         END DO
196
197         DEALLOCATE( &
198            & igrdi, &
199            & igrdj, &
200            & zglam, &
201            & zgphi, &
202            & zmask, &
203            & zbias  &
204            & )
205         
206      END DO
207
208   END SUBROUTINE obs_rea_altbias
209
210
211 
212END MODULE obs_read_altbias
Note: See TracBrowser for help on using the repository browser.