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