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/2014/dev_r4650_UKMO12_CFL_diags_take2/NEMOGCM/NEMO/OPA_SRC/OBS – NEMO

source: branches/2014/dev_r4650_UKMO12_CFL_diags_take2/NEMOGCM/NEMO/OPA_SRC/OBS/obs_read_altbias.F90 @ 5947

Last change on this file since 5947 was 5947, checked in by timgraham, 8 years ago

Reinstate svn Id keywords before merge

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