1 | MODULE iom |
---|
2 | !!===================================================================== |
---|
3 | !! *** MODULE iom *** |
---|
4 | !! Input/Output manager : Library to read input files |
---|
5 | !!==================================================================== |
---|
6 | !! History : 2.0 ! 2005-12 (J. Belier) Original code |
---|
7 | !! 2.0 ! 2006-02 (S. Masson) Adaptation to NEMO |
---|
8 | !! 3.0 ! 2007-07 (D. Storkey) Changes to iom_gettime |
---|
9 | !! 3.4 ! 2012-12 (R. Bourdalle-Badie and G. Reffray) add C1D case |
---|
10 | !! 3.6 ! 2014-15 DIMG format removed |
---|
11 | !! 3.6 ! 2015-15 (J. Harle) Added procedure to read REAL attributes |
---|
12 | !!-------------------------------------------------------------------- |
---|
13 | |
---|
14 | !!-------------------------------------------------------------------- |
---|
15 | !! iom_open : open a file read only |
---|
16 | !! iom_close : close a file or all files opened by iom |
---|
17 | !! iom_get : read a field (interfaced to several routines) |
---|
18 | !! iom_gettime : read the time axis cdvar in the file |
---|
19 | !! iom_varid : get the id of a variable in a file |
---|
20 | !! iom_rstput : write a field in a restart file (interfaced to several routines) |
---|
21 | !!-------------------------------------------------------------------- |
---|
22 | USE dom_oce ! ocean space and time domain |
---|
23 | USE c1d ! 1D vertical configuration |
---|
24 | USE flo_oce ! floats module declarations |
---|
25 | USE lbclnk ! lateal boundary condition / mpp exchanges |
---|
26 | USE iom_def ! iom variables definitions |
---|
27 | USE iom_nf90 ! NetCDF format with native NetCDF library |
---|
28 | USE in_out_manager ! I/O manager |
---|
29 | USE lib_mpp ! MPP library |
---|
30 | #if defined key_iomput |
---|
31 | USE sbc_oce, ONLY : nn_fsbc ! ocean space and time domain |
---|
32 | USE trc_oce, ONLY : nn_dttrc ! !: frequency of step on passive tracers |
---|
33 | USE icb_oce, ONLY : nclasses, class_num ! !: iceberg classes |
---|
34 | #if defined key_lim3 |
---|
35 | USE ice , ONLY : jpl |
---|
36 | #elif defined key_lim2 |
---|
37 | USE par_ice_2 |
---|
38 | #endif |
---|
39 | USE domngb ! ocean space and time domain |
---|
40 | USE phycst ! physical constants |
---|
41 | USE dianam ! build name of file |
---|
42 | USE xios |
---|
43 | # endif |
---|
44 | USE ioipsl, ONLY : ju2ymds ! for calendar |
---|
45 | USE crs ! Grid coarsening |
---|
46 | USE lib_fortran |
---|
47 | USE diurnal_bulk, ONLY : ln_diurnal_only, ln_diurnal |
---|
48 | |
---|
49 | IMPLICIT NONE |
---|
50 | PUBLIC ! must be public to be able to access iom_def through iom |
---|
51 | |
---|
52 | #if defined key_iomput |
---|
53 | LOGICAL, PUBLIC, PARAMETER :: lk_iomput = .TRUE. !: iom_put flag |
---|
54 | #else |
---|
55 | LOGICAL, PUBLIC, PARAMETER :: lk_iomput = .FALSE. !: iom_put flag |
---|
56 | #endif |
---|
57 | PUBLIC iom_init, iom_swap, iom_open, iom_close, iom_setkt, iom_varid, iom_get |
---|
58 | PUBLIC iom_getatt, iom_putatt, iom_gettime, iom_rstput, iom_put |
---|
59 | PUBLIC iom_use, iom_context_finalize |
---|
60 | |
---|
61 | PRIVATE iom_rp0d, iom_rp1d, iom_rp2d, iom_rp3d |
---|
62 | PRIVATE iom_g0d, iom_g1d, iom_g2d, iom_g3d, iom_get_123d |
---|
63 | PRIVATE iom_p1d, iom_p2d, iom_p3d |
---|
64 | #if defined key_iomput |
---|
65 | PRIVATE iom_set_domain_attr, iom_set_axis_attr, iom_set_field_attr, iom_set_file_attr, iom_get_file_attr, iom_set_grid_attr |
---|
66 | PRIVATE set_grid, set_grid_bounds, set_scalar, set_xmlatt, set_mooring, iom_update_file_name, iom_sdate |
---|
67 | PRIVATE iom_set_rst_context, iom_set_rstw_active, iom_set_rstr_active |
---|
68 | PUBLIC iom_set_rstw_var_active, iom_set_rst_vars |
---|
69 | # endif |
---|
70 | |
---|
71 | INTERFACE iom_get |
---|
72 | MODULE PROCEDURE iom_g0d, iom_g1d, iom_g2d, iom_g3d |
---|
73 | END INTERFACE |
---|
74 | INTERFACE iom_getatt |
---|
75 | MODULE PROCEDURE iom_g0d_iatt, iom_g0d_ratt, iom_g0d_catt |
---|
76 | END INTERFACE |
---|
77 | INTERFACE iom_putatt |
---|
78 | MODULE PROCEDURE iom_p0d_iatt, iom_p0d_ratt, iom_p0d_catt |
---|
79 | END INTERFACE |
---|
80 | INTERFACE iom_rstput |
---|
81 | MODULE PROCEDURE iom_rp0d, iom_rp1d, iom_rp2d, iom_rp3d |
---|
82 | END INTERFACE |
---|
83 | INTERFACE iom_put |
---|
84 | MODULE PROCEDURE iom_p0d, iom_p1d, iom_p2d, iom_p3d |
---|
85 | END INTERFACE |
---|
86 | |
---|
87 | !!---------------------------------------------------------------------- |
---|
88 | !! NEMO/OPA 3.3 , NEMO Consortium (2010) |
---|
89 | !! $Id$ |
---|
90 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
91 | !!---------------------------------------------------------------------- |
---|
92 | |
---|
93 | CONTAINS |
---|
94 | |
---|
95 | SUBROUTINE iom_init( cdname, fname ) |
---|
96 | !!---------------------------------------------------------------------- |
---|
97 | !! *** ROUTINE *** |
---|
98 | !! |
---|
99 | !! ** Purpose : |
---|
100 | !! |
---|
101 | !!---------------------------------------------------------------------- |
---|
102 | CHARACTER(len=*), INTENT(in) :: cdname |
---|
103 | CHARACTER(len=*), OPTIONAL, INTENT(in) :: fname |
---|
104 | #if defined key_iomput |
---|
105 | |
---|
106 | TYPE(xios_duration) :: dtime = xios_duration(0, 0, 0, 0, 0, 0) |
---|
107 | TYPE(xios_date) :: start_date |
---|
108 | CHARACTER(len=lc) :: clname |
---|
109 | INTEGER :: ji, jkmin |
---|
110 | LOGICAL :: llrst_context ! is context related to restart |
---|
111 | ! |
---|
112 | REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zt_bnds, zw_bnds |
---|
113 | !!---------------------------------------------------------------------- |
---|
114 | |
---|
115 | ALLOCATE( zt_bnds(2,jpk), zw_bnds(2,jpk) ) |
---|
116 | |
---|
117 | clname = cdname |
---|
118 | IF( TRIM(Agrif_CFixed()) /= '0' ) clname = TRIM(Agrif_CFixed())//"_"//TRIM(cdname) |
---|
119 | CALL xios_context_initialize(TRIM(clname), mpi_comm_opa) |
---|
120 | CALL iom_swap( cdname ) |
---|
121 | llrst_context = (TRIM(cdname) == TRIM(crxios_context) .OR. TRIM(cdname) == TRIM(cwxios_context)) |
---|
122 | |
---|
123 | ! Calendar type is now defined in xml file |
---|
124 | SELECT CASE ( nleapy ) ! Choose calendar for IOIPSL |
---|
125 | CASE ( 1) ; CALL xios_define_calendar( TYPE = "Gregorian", time_origin = xios_date(1900,01,01,00,00,00), & |
---|
126 | & start_date = xios_date(nyear,nmonth,nday,0,0,0) ) |
---|
127 | CASE ( 0) ; CALL xios_define_calendar( TYPE = "NoLeap" , time_origin = xios_date(1900,01,01,00,00,00), & |
---|
128 | & start_date = xios_date(nyear,nmonth,nday,0,0,0) ) |
---|
129 | CASE (30) ; CALL xios_define_calendar( TYPE = "D360" , time_origin = xios_date(1900,01,01,00,00,00), & |
---|
130 | & start_date = xios_date(nyear,nmonth,nday,0,0,0) ) |
---|
131 | END SELECT |
---|
132 | |
---|
133 | ! horizontal grid definition |
---|
134 | IF(.NOT.llrst_context) CALL set_scalar |
---|
135 | |
---|
136 | IF( TRIM(cdname) == TRIM(cxios_context) ) THEN |
---|
137 | CALL set_grid( "T", glamt, gphit, .FALSE. ) |
---|
138 | CALL set_grid( "U", glamu, gphiu, .FALSE. ) |
---|
139 | CALL set_grid( "V", glamv, gphiv, .FALSE. ) |
---|
140 | CALL set_grid( "W", glamt, gphit, .FALSE. ) |
---|
141 | CALL set_grid_znl( gphit ) |
---|
142 | ! |
---|
143 | IF( ln_cfmeta ) THEN ! Add additional grid metadata |
---|
144 | CALL iom_set_domain_attr("grid_T", area = e1e2t(nldi:nlei, nldj:nlej)) |
---|
145 | CALL iom_set_domain_attr("grid_U", area = e1e2u(nldi:nlei, nldj:nlej)) |
---|
146 | CALL iom_set_domain_attr("grid_V", area = e1e2v(nldi:nlei, nldj:nlej)) |
---|
147 | CALL iom_set_domain_attr("grid_W", area = e1e2t(nldi:nlei, nldj:nlej)) |
---|
148 | CALL set_grid_bounds( "T", glamf, gphif, glamt, gphit ) |
---|
149 | CALL set_grid_bounds( "U", glamv, gphiv, glamu, gphiu ) |
---|
150 | CALL set_grid_bounds( "V", glamu, gphiu, glamv, gphiv ) |
---|
151 | CALL set_grid_bounds( "W", glamf, gphif, glamt, gphit ) |
---|
152 | ENDIF |
---|
153 | ENDIF |
---|
154 | |
---|
155 | IF( TRIM(cdname) == TRIM(cxios_context)//"_crs" ) THEN |
---|
156 | CALL dom_grid_crs ! Save the parent grid information & Switch to coarse grid domain |
---|
157 | ! |
---|
158 | CALL set_grid( "T", glamt_crs, gphit_crs, .FALSE. ) |
---|
159 | CALL set_grid( "U", glamu_crs, gphiu_crs, .FALSE. ) |
---|
160 | CALL set_grid( "V", glamv_crs, gphiv_crs, .FALSE. ) |
---|
161 | CALL set_grid( "W", glamt_crs, gphit_crs, .FALSE. ) |
---|
162 | CALL set_grid_znl( gphit_crs ) |
---|
163 | ! |
---|
164 | CALL dom_grid_glo ! Return to parent grid domain |
---|
165 | ! |
---|
166 | IF( ln_cfmeta .AND. .NOT. llrst_context) THEN ! Add additional grid metadata |
---|
167 | CALL iom_set_domain_attr("grid_T", area = e1e2t_crs(nldi:nlei, nldj:nlej)) |
---|
168 | CALL iom_set_domain_attr("grid_U", area = e1u_crs(nldi:nlei, nldj:nlej) * e2u_crs(nldi:nlei, nldj:nlej)) |
---|
169 | CALL iom_set_domain_attr("grid_V", area = e1v_crs(nldi:nlei, nldj:nlej) * e2v_crs(nldi:nlei, nldj:nlej)) |
---|
170 | CALL iom_set_domain_attr("grid_W", area = e1e2t_crs(nldi:nlei, nldj:nlej)) |
---|
171 | CALL set_grid_bounds( "T", glamf_crs, gphif_crs, glamt_crs, gphit_crs ) |
---|
172 | CALL set_grid_bounds( "U", glamv_crs, gphiv_crs, glamu_crs, gphiu_crs ) |
---|
173 | CALL set_grid_bounds( "V", glamu_crs, gphiu_crs, glamv_crs, gphiv_crs ) |
---|
174 | CALL set_grid_bounds( "W", glamf_crs, gphif_crs, glamt_crs, gphit_crs ) |
---|
175 | ENDIF |
---|
176 | ENDIF |
---|
177 | |
---|
178 | ! vertical grid definition |
---|
179 | IF(.NOT.llrst_context) THEN |
---|
180 | CALL iom_set_axis_attr( "deptht", paxis = gdept_1d ) |
---|
181 | CALL iom_set_axis_attr( "depthu", paxis = gdept_1d ) |
---|
182 | CALL iom_set_axis_attr( "depthv", paxis = gdept_1d ) |
---|
183 | CALL iom_set_axis_attr( "depthw", paxis = gdepw_1d ) |
---|
184 | |
---|
185 | ! Add vertical grid bounds |
---|
186 | jkmin = MIN(2,jpk) ! in case jpk=1 (i.e. sas2D) |
---|
187 | zt_bnds(2,: ) = gdept_1d(:) |
---|
188 | zt_bnds(1,jkmin:jpk) = gdept_1d(1:jpkm1) |
---|
189 | zt_bnds(1,1 ) = gdept_1d(1) - e3w_1d(1) |
---|
190 | zw_bnds(1,: ) = gdepw_1d(:) |
---|
191 | zw_bnds(2,1:jpkm1 ) = gdepw_1d(jkmin:jpk) |
---|
192 | zw_bnds(2,jpk: ) = gdepw_1d(jpk) + e3t_1d(jpk) |
---|
193 | CALL iom_set_axis_attr( "deptht", bounds=zt_bnds ) |
---|
194 | CALL iom_set_axis_attr( "depthu", bounds=zt_bnds ) |
---|
195 | CALL iom_set_axis_attr( "depthv", bounds=zt_bnds ) |
---|
196 | CALL iom_set_axis_attr( "depthw", bounds=zw_bnds ) |
---|
197 | |
---|
198 | |
---|
199 | # if defined key_floats |
---|
200 | CALL iom_set_axis_attr( "nfloat", (/ (REAL(ji,wp), ji=1,nfloat) /) ) |
---|
201 | # endif |
---|
202 | #if defined key_lim3 || defined key_lim2 |
---|
203 | CALL iom_set_axis_attr( "ncatice", (/ (REAL(ji,wp), ji=1,jpl) /) ) |
---|
204 | #endif |
---|
205 | CALL iom_set_axis_attr( "icbcla", class_num ) |
---|
206 | CALL iom_set_axis_attr( "iax_20C", (/ REAL(20,wp) /) ) |
---|
207 | CALL iom_set_axis_attr( "iax_28C", (/ REAL(28,wp) /) ) |
---|
208 | ENDIF |
---|
209 | ! automatic definitions of some of the xml attributs |
---|
210 | IF( TRIM(cdname) == TRIM(crxios_context) ) THEN |
---|
211 | !set names of the fields in restart file IF using XIOS to read data |
---|
212 | CALL iom_set_rst_context() |
---|
213 | CALL iom_set_rst_vars(rst_rfields) |
---|
214 | !set which fields are to be read from restart file |
---|
215 | CALL iom_set_rstr_active() |
---|
216 | ELSE IF( TRIM(cdname) == TRIM(cwxios_context) ) THEN |
---|
217 | !set names of the fields in restart file IF using XIOS to write data |
---|
218 | CALL iom_set_rst_context() |
---|
219 | CALL iom_set_rst_vars(rst_wfields) |
---|
220 | !set which fields are to be read from restart file |
---|
221 | CALL iom_set_rstw_active(fname) |
---|
222 | ELSE |
---|
223 | CALL set_xmlatt |
---|
224 | ENDIF |
---|
225 | |
---|
226 | ! end file definition |
---|
227 | dtime%second = rdt |
---|
228 | CALL xios_set_timestep(dtime) |
---|
229 | CALL xios_close_context_definition() |
---|
230 | |
---|
231 | CALL xios_update_calendar(0) |
---|
232 | |
---|
233 | DEALLOCATE( zt_bnds, zw_bnds ) |
---|
234 | |
---|
235 | #endif |
---|
236 | |
---|
237 | END SUBROUTINE iom_init |
---|
238 | |
---|
239 | SUBROUTINE iom_set_rstw_var_active(field) |
---|
240 | !!--------------------------------------------------------------------- |
---|
241 | !! *** SUBROUTINE iom_set_rstw_var_active *** |
---|
242 | !! |
---|
243 | !! ** Purpose : enable variable in restart file when writing with XIOS |
---|
244 | !!--------------------------------------------------------------------- |
---|
245 | CHARACTER(len = *), INTENT(IN) :: field |
---|
246 | INTEGER :: i |
---|
247 | LOGICAL :: llis_set |
---|
248 | |
---|
249 | llis_set = .FALSE. |
---|
250 | |
---|
251 | DO i = 1, max_rst_fields |
---|
252 | IF(TRIM(rst_wfields(i)%vname) == field) THEN |
---|
253 | rst_wfields(i)%active = .TRUE. |
---|
254 | llis_set = .TRUE. |
---|
255 | EXIT |
---|
256 | ENDIF |
---|
257 | ENDDO |
---|
258 | !Warn if variable is not in defined in rst_wfields |
---|
259 | IF(.NOT.llis_set) THEN |
---|
260 | IF(lwp) THEN |
---|
261 | write(numout,cform_err) |
---|
262 | write(numout,*) 'iom_set_rstw_var_active: variable ', field ,' is available for writing but not defined' |
---|
263 | ENDIF |
---|
264 | nstop = nstop + 1 |
---|
265 | ENDIF |
---|
266 | |
---|
267 | END SUBROUTINE iom_set_rstw_var_active |
---|
268 | |
---|
269 | SUBROUTINE iom_set_rstr_active() |
---|
270 | !!--------------------------------------------------------------------- |
---|
271 | !! *** SUBROUTINE iom_set_rstr_active *** |
---|
272 | !! |
---|
273 | !! ** Purpose : define file name in XIOS context for reading restart file, |
---|
274 | !! enable variables present in restart file for reading with XIOS |
---|
275 | !!--------------------------------------------------------------------- |
---|
276 | |
---|
277 | !sets enabled = .TRUE. for each field in restart file |
---|
278 | CHARACTER(len=256) :: rst_file |
---|
279 | TYPE(xios_field) :: field_hdl |
---|
280 | TYPE(xios_file) :: file_hdl |
---|
281 | TYPE(xios_filegroup) :: filegroup_hdl |
---|
282 | INTEGER :: i |
---|
283 | CHARACTER(lc) :: clpath |
---|
284 | |
---|
285 | clpath = TRIM(cn_ocerst_indir) |
---|
286 | IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' |
---|
287 | IF( TRIM(Agrif_CFixed()) == '0' ) THEN |
---|
288 | rst_file = TRIM(clpath)//TRIM(cn_ocerst_in) |
---|
289 | ELSE |
---|
290 | rst_file = TRIM(clpath)//'1_'//TRIM(cn_ocerst_in) |
---|
291 | ENDIF |
---|
292 | !set name of the restart file and enable available fields |
---|
293 | if(lwp) WRITE(numout,*) 'Setting restart filename (for XIOS) to: ',rst_file |
---|
294 | CALL xios_get_handle("file_definition", filegroup_hdl ) |
---|
295 | CALL xios_add_child(filegroup_hdl, file_hdl, 'rrestart') |
---|
296 | CALL xios_set_file_attr( "rrestart", name=trim(rst_file), type="one_file", & |
---|
297 | par_access="collective", enabled=.TRUE., mode="read", & |
---|
298 | output_freq=xios_timestep) |
---|
299 | !define variables for restart context |
---|
300 | DO i = 1, max_rst_fields |
---|
301 | IF( TRIM(rst_rfields(i)%vname) /= "NO_NAME") THEN |
---|
302 | IF( iom_varid( numror, TRIM(rst_rfields(i)%vname), ldstop = .FALSE. ) > 0 ) THEN |
---|
303 | CALL xios_add_child(file_hdl, field_hdl, TRIM(rst_rfields(i)%vname)) |
---|
304 | SELECT CASE (TRIM(rst_rfields(i)%grid)) |
---|
305 | CASE ("grid_N_3D") |
---|
306 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_rfields(i)%vname), & |
---|
307 | domain_ref="grid_N", axis_ref="deptht", operation = "instant") |
---|
308 | CASE ("grid_N") |
---|
309 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_rfields(i)%vname), & |
---|
310 | domain_ref="grid_N", operation = "instant") |
---|
311 | CASE ("grid_vector") |
---|
312 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_rfields(i)%vname), & |
---|
313 | axis_ref="deptht", operation = "instant") |
---|
314 | CASE ("grid_scalar") |
---|
315 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_rfields(i)%vname), & |
---|
316 | scalar_ref = "grid_scalar", operation = "instant") |
---|
317 | END SELECT |
---|
318 | IF(lwp) WRITE(numout,*) 'XIOS read: ', TRIM(rst_rfields(i)%vname), ' enabled in ', TRIM(rst_file) |
---|
319 | ENDIF |
---|
320 | ENDIF |
---|
321 | END DO |
---|
322 | END SUBROUTINE iom_set_rstr_active |
---|
323 | |
---|
324 | SUBROUTINE iom_set_rstw_core(cdmdl) |
---|
325 | !!--------------------------------------------------------------------- |
---|
326 | !! *** SUBROUTINE iom_set_rstw_core *** |
---|
327 | !! |
---|
328 | !! ** Purpose : set variables which are always in restart file |
---|
329 | !!--------------------------------------------------------------------- |
---|
330 | CHARACTER (len=*), INTENT (IN) :: cdmdl ! model OPA or SAS |
---|
331 | |
---|
332 | IF(cdmdl == "OPA") THEN |
---|
333 | !from restart.F90 |
---|
334 | CALL iom_set_rstw_var_active("rdt") |
---|
335 | IF ( .NOT. ln_diurnal_only ) THEN |
---|
336 | CALL iom_set_rstw_var_active('ub' ) |
---|
337 | CALL iom_set_rstw_var_active('vb' ) |
---|
338 | CALL iom_set_rstw_var_active('tb' ) |
---|
339 | CALL iom_set_rstw_var_active('sb' ) |
---|
340 | CALL iom_set_rstw_var_active('sshb') |
---|
341 | ! |
---|
342 | CALL iom_set_rstw_var_active('un' ) |
---|
343 | CALL iom_set_rstw_var_active('vn' ) |
---|
344 | CALL iom_set_rstw_var_active('tn' ) |
---|
345 | CALL iom_set_rstw_var_active('sn' ) |
---|
346 | CALL iom_set_rstw_var_active('sshn') |
---|
347 | CALL iom_set_rstw_var_active('rhop') |
---|
348 | ! extra variable needed for the ice sheet coupling |
---|
349 | IF ( ln_iscpl ) THEN |
---|
350 | CALL iom_set_rstw_var_active('tmask') |
---|
351 | CALL iom_set_rstw_var_active('umask') |
---|
352 | CALL iom_set_rstw_var_active('vmask') |
---|
353 | CALL iom_set_rstw_var_active('smask') |
---|
354 | CALL iom_set_rstw_var_active('e3t_n') |
---|
355 | CALL iom_set_rstw_var_active('e3u_n') |
---|
356 | CALL iom_set_rstw_var_active('e3v_n') |
---|
357 | CALL iom_set_rstw_var_active('gdepw_n') |
---|
358 | END IF |
---|
359 | ENDIF |
---|
360 | IF(ln_diurnal) CALL iom_set_rstw_var_active('Dsst') |
---|
361 | !from trasbc.F90 |
---|
362 | CALL iom_set_rstw_var_active('sbc_hc_b') |
---|
363 | CALL iom_set_rstw_var_active('sbc_sc_b') |
---|
364 | ENDIF |
---|
365 | END SUBROUTINE iom_set_rstw_core |
---|
366 | |
---|
367 | SUBROUTINE iom_set_rst_vars(fields) |
---|
368 | !!--------------------------------------------------------------------- |
---|
369 | !! *** SUBROUTINE iom_set_rstr_active *** |
---|
370 | !! |
---|
371 | !! ** Purpose : Fill array fields with the information about all |
---|
372 | !! possible variables and corresponding grids definition |
---|
373 | !! for reading/writing restart with XIOS |
---|
374 | !!--------------------------------------------------------------------- |
---|
375 | TYPE(RST_FIELD), INTENT(INOUT) :: fields(max_rst_fields) |
---|
376 | |
---|
377 | INTEGER :: i |
---|
378 | i = 0 |
---|
379 | i = i + 1; fields(i)%vname="rdt"; fields(i)%grid="grid_scalar" |
---|
380 | i = i + 1; fields(i)%vname="un"; fields(i)%grid="grid_N_3D" |
---|
381 | i = i + 1; fields(i)%vname="ub"; fields(i)%grid="grid_N_3D" |
---|
382 | i = i + 1; fields(i)%vname="vn"; fields(i)%grid="grid_N_3D" |
---|
383 | i = i + 1; fields(i)%vname="vb"; fields(i)%grid="grid_N_3D" |
---|
384 | i = i + 1; fields(i)%vname="tn"; fields(i)%grid="grid_N_3D" |
---|
385 | i = i + 1; fields(i)%vname="tb"; fields(i)%grid="grid_N_3D" |
---|
386 | i = i + 1; fields(i)%vname="sn"; fields(i)%grid="grid_N_3D" |
---|
387 | i = i + 1; fields(i)%vname="sb"; fields(i)%grid="grid_N_3D" |
---|
388 | i = i + 1; fields(i)%vname="sshn"; fields(i)%grid="grid_N" |
---|
389 | i = i + 1; fields(i)%vname="sshb"; fields(i)%grid="grid_N" |
---|
390 | i = i + 1; fields(i)%vname="rhop"; fields(i)%grid="grid_N_3D" |
---|
391 | i = i + 1; fields(i)%vname="kt"; fields(i)%grid="grid_scalar" |
---|
392 | i = i + 1; fields(i)%vname="ndastp"; fields(i)%grid="grid_scalar" |
---|
393 | i = i + 1; fields(i)%vname="adatrj"; fields(i)%grid="grid_scalar" |
---|
394 | i = i + 1; fields(i)%vname="utau_b"; fields(i)%grid="grid_N" |
---|
395 | i = i + 1; fields(i)%vname="vtau_b"; fields(i)%grid="grid_N" |
---|
396 | i = i + 1; fields(i)%vname="qns_b"; fields(i)%grid="grid_N" |
---|
397 | i = i + 1; fields(i)%vname="emp_b"; fields(i)%grid="grid_N" |
---|
398 | i = i + 1; fields(i)%vname="sfx_b"; fields(i)%grid="grid_N" |
---|
399 | i = i + 1; fields(i)%vname="en" ; fields(i)%grid="grid_N_3D" |
---|
400 | i = i + 1; fields(i)%vname="avt"; fields(i)%grid="grid_N_3D" |
---|
401 | i = i + 1; fields(i)%vname="avm"; fields(i)%grid="grid_N_3D" |
---|
402 | i = i + 1; fields(i)%vname="avmu"; fields(i)%grid="grid_N_3D" |
---|
403 | i = i + 1; fields(i)%vname="avmv"; fields(i)%grid="grid_N_3D" |
---|
404 | i = i + 1; fields(i)%vname="dissl"; fields(i)%grid="grid_N_3D" |
---|
405 | i = i + 1; fields(i)%vname="sbc_hc_b"; fields(i)%grid="grid_N" |
---|
406 | i = i + 1; fields(i)%vname="sbc_sc_b"; fields(i)%grid="grid_N" |
---|
407 | i = i + 1; fields(i)%vname="qsr_hc_b"; fields(i)%grid="grid_N_3D" |
---|
408 | i = i + 1; fields(i)%vname="fraqsr_1lev"; fields(i)%grid="grid_N" |
---|
409 | i = i + 1; fields(i)%vname="frc_v"; fields(i)%grid="grid_scalar" |
---|
410 | i = i + 1; fields(i)%vname="frc_t"; fields(i)%grid="grid_scalar" |
---|
411 | i = i + 1; fields(i)%vname="frc_s"; fields(i)%grid="grid_scalar" |
---|
412 | i = i + 1; fields(i)%vname="frc_wn_t"; fields(i)%grid="grid_scalar" |
---|
413 | i = i + 1; fields(i)%vname="frc_wn_s"; fields(i)%grid="grid_scalar" |
---|
414 | i = i + 1; fields(i)%vname="ssh_ini"; fields(i)%grid="grid_N" |
---|
415 | i = i + 1; fields(i)%vname="e3t_ini"; fields(i)%grid="grid_N_3D" |
---|
416 | i = i + 1; fields(i)%vname="hc_loc_ini"; fields(i)%grid="grid_N_3D" |
---|
417 | i = i + 1; fields(i)%vname="sc_loc_ini"; fields(i)%grid="grid_N_3D" |
---|
418 | i = i + 1; fields(i)%vname="ssh_hc_loc_ini"; fields(i)%grid="grid_N" |
---|
419 | i = i + 1; fields(i)%vname="ssh_sc_loc_ini"; fields(i)%grid="grid_N" |
---|
420 | i = i + 1; fields(i)%vname="tilde_e3t_b"; fields(i)%grid="grid_N" |
---|
421 | i = i + 1; fields(i)%vname="tilde_e3t_n"; fields(i)%grid="grid_N" |
---|
422 | i = i + 1; fields(i)%vname="hdiv_lf"; fields(i)%grid="grid_N" |
---|
423 | i = i + 1; fields(i)%vname="ub2_b"; fields(i)%grid="grid_N" |
---|
424 | i = i + 1; fields(i)%vname="vb2_b"; fields(i)%grid="grid_N" |
---|
425 | i = i + 1; fields(i)%vname="sshbb_e"; fields(i)%grid="grid_N" |
---|
426 | i = i + 1; fields(i)%vname="ubb_e"; fields(i)%grid="grid_N" |
---|
427 | i = i + 1; fields(i)%vname="vbb_e"; fields(i)%grid="grid_N" |
---|
428 | i = i + 1; fields(i)%vname="sshb_e"; fields(i)%grid="grid_N" |
---|
429 | i = i + 1; fields(i)%vname="ub_e"; fields(i)%grid="grid_N" |
---|
430 | i = i + 1; fields(i)%vname="vb_e"; fields(i)%grid="grid_N" |
---|
431 | i = i + 1; fields(i)%vname="fwf_isf_b"; fields(i)%grid="grid_N" |
---|
432 | i = i + 1; fields(i)%vname="isf_sc_b"; fields(i)%grid="grid_N" |
---|
433 | i = i + 1; fields(i)%vname="isf_hc_b"; fields(i)%grid="grid_N" |
---|
434 | i = i + 1; fields(i)%vname="ssh_ibb"; fields(i)%grid="grid_N" |
---|
435 | i = i + 1; fields(i)%vname="rnf_b"; fields(i)%grid="grid_N" |
---|
436 | i = i + 1; fields(i)%vname="rnf_hc_b"; fields(i)%grid="grid_N" |
---|
437 | i = i + 1; fields(i)%vname="rnf_sc_b"; fields(i)%grid="grid_N" |
---|
438 | i = i + 1; fields(i)%vname="nn_fsbc"; fields(i)%grid="grid_scalar" |
---|
439 | i = i + 1; fields(i)%vname="ssu_m"; fields(i)%grid="grid_N" |
---|
440 | i = i + 1; fields(i)%vname="ssv_m"; fields(i)%grid="grid_N" |
---|
441 | i = i + 1; fields(i)%vname="sst_m"; fields(i)%grid="grid_N" |
---|
442 | i = i + 1; fields(i)%vname="sss_m"; fields(i)%grid="grid_N" |
---|
443 | i = i + 1; fields(i)%vname="ssh_m"; fields(i)%grid="grid_N" |
---|
444 | i = i + 1; fields(i)%vname="e3t_m"; fields(i)%grid="grid_N" |
---|
445 | i = i + 1; fields(i)%vname="frq_m"; fields(i)%grid="grid_N" |
---|
446 | i = i + 1; fields(i)%vname="avmb"; fields(i)%grid="grid_vector" |
---|
447 | i = i + 1; fields(i)%vname="avtb"; fields(i)%grid="grid_vector" |
---|
448 | i = i + 1; fields(i)%vname="ub2_i_b"; fields(i)%grid="grid_N" |
---|
449 | i = i + 1; fields(i)%vname="vb2_i_b"; fields(i)%grid="grid_N" |
---|
450 | i = i + 1; fields(i)%vname="ntime"; fields(i)%grid="grid_scalar" |
---|
451 | i = i + 1; fields(i)%vname="Dsst"; fields(i)%grid="grid_scalar" |
---|
452 | i = i + 1; fields(i)%vname="tmask"; fields(i)%grid="grid_N_3D" |
---|
453 | i = i + 1; fields(i)%vname="umask"; fields(i)%grid="grid_N_3D" |
---|
454 | i = i + 1; fields(i)%vname="vmask"; fields(i)%grid="grid_N_3D" |
---|
455 | i = i + 1; fields(i)%vname="smask"; fields(i)%grid="grid_N_3D" |
---|
456 | i = i + 1; fields(i)%vname="gdepw_n"; fields(i)%grid="grid_N_3D" |
---|
457 | i = i + 1; fields(i)%vname="e3t_n"; fields(i)%grid="grid_N_3D" |
---|
458 | i = i + 1; fields(i)%vname="e3u_n"; fields(i)%grid="grid_N_3D" |
---|
459 | i = i + 1; fields(i)%vname="e3v_n"; fields(i)%grid="grid_N_3D" |
---|
460 | i = i + 1; fields(i)%vname="surf_ini"; fields(i)%grid="grid_N" |
---|
461 | i = i + 1; fields(i)%vname="e3t_b"; fields(i)%grid="grid_N_3D" |
---|
462 | i = i + 1; fields(i)%vname="mxln"; fields(i)%grid="grid_N_3D" |
---|
463 | |
---|
464 | IF( i-1 > max_rst_fields) THEN |
---|
465 | IF(lwp) write(numout,*) 'E R R O R : iom_set_rst_vars SIZE of RST_FIELD array is too small' |
---|
466 | nstop = nstop + 1 |
---|
467 | ENDIF |
---|
468 | |
---|
469 | END SUBROUTINE iom_set_rst_vars |
---|
470 | |
---|
471 | |
---|
472 | SUBROUTINE iom_set_rstw_active(cdrst_file) |
---|
473 | !!--------------------------------------------------------------------- |
---|
474 | !! *** SUBROUTINE iom_set_rstr_active *** |
---|
475 | !! |
---|
476 | !! ** Purpose : define file name in XIOS context for writing restart |
---|
477 | !! enable variables present in restart file for writing |
---|
478 | !!--------------------------------------------------------------------- |
---|
479 | !sets enabled = .TRUE. for each field in restart file |
---|
480 | CHARACTER(len=*) :: cdrst_file |
---|
481 | #if defined key_iomput |
---|
482 | TYPE(xios_field) :: field_hdl |
---|
483 | TYPE(xios_file) :: file_hdl |
---|
484 | TYPE(xios_filegroup) :: filegroup_hdl |
---|
485 | INTEGER :: i |
---|
486 | CHARACTER(lc) :: clpath |
---|
487 | |
---|
488 | !set name of the restart file and enable available fields |
---|
489 | IF(lwp) WRITE(numout,*) 'Setting restart filename (for XIOS write) to: ',cdrst_file |
---|
490 | CALL xios_get_handle("file_definition", filegroup_hdl ) |
---|
491 | CALL xios_add_child(filegroup_hdl, file_hdl, 'wrestart') |
---|
492 | IF(nxioso.eq.1) THEN |
---|
493 | CALL xios_set_file_attr( "wrestart", type="one_file", enabled=.TRUE.,& |
---|
494 | mode="write", output_freq=xios_timestep) |
---|
495 | if(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in one_file mode' |
---|
496 | ELSE |
---|
497 | CALL xios_set_file_attr( "wrestart", type="multiple_file", enabled=.TRUE.,& |
---|
498 | mode="write", output_freq=xios_timestep) |
---|
499 | if(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in multiple_file mode' |
---|
500 | ENDIF |
---|
501 | CALL xios_set_file_attr( "wrestart", name=trim(cdrst_file)) |
---|
502 | !defin files for restart context |
---|
503 | DO i = 1, max_rst_fields |
---|
504 | IF( rst_wfields(i)%active ) THEN |
---|
505 | CALL xios_add_child(file_hdl, field_hdl, TRIM(rst_wfields(i)%vname)) |
---|
506 | SELECT CASE (TRIM(rst_wfields(i)%grid)) |
---|
507 | CASE ("grid_N_3D") |
---|
508 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_wfields(i)%vname), & |
---|
509 | domain_ref="grid_N", axis_ref="deptht", prec = 8, operation = "instant") |
---|
510 | CASE ("grid_N") |
---|
511 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_wfields(i)%vname), & |
---|
512 | domain_ref="grid_N", prec = 8, operation = "instant") |
---|
513 | CASE ("grid_vector") |
---|
514 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_wfields(i)%vname), & |
---|
515 | axis_ref="deptht", prec = 8, operation = "instant") |
---|
516 | CASE ("grid_scalar") |
---|
517 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_wfields(i)%vname), & |
---|
518 | scalar_ref = "grid_scalar", prec = 8, operation = "instant") |
---|
519 | END SELECT |
---|
520 | ENDIF |
---|
521 | END DO |
---|
522 | #endif |
---|
523 | END SUBROUTINE iom_set_rstw_active |
---|
524 | |
---|
525 | SUBROUTINE iom_set_rst_context( ) |
---|
526 | !!--------------------------------------------------------------------- |
---|
527 | !! *** SUBROUTINE iom_set_rstr_active *** |
---|
528 | !! |
---|
529 | !! ** Purpose : Define domain, axis and grid for restart (read/write) |
---|
530 | !! context |
---|
531 | !! |
---|
532 | !!--------------------------------------------------------------------- |
---|
533 | #if defined key_iomput |
---|
534 | TYPE(xios_domaingroup) :: domaingroup_hdl |
---|
535 | TYPE(xios_domain) :: domain_hdl |
---|
536 | TYPE(xios_axisgroup) :: axisgroup_hdl |
---|
537 | TYPE(xios_axis) :: axis_hdl |
---|
538 | TYPE(xios_scalar) :: scalar_hdl |
---|
539 | TYPE(xios_scalargroup) :: scalargroup_hdl |
---|
540 | |
---|
541 | CALL xios_get_handle("domain_definition",domaingroup_hdl) |
---|
542 | CALL xios_add_child(domaingroup_hdl, domain_hdl, "grid_N") |
---|
543 | CALL set_grid("N", glamt, gphit, .TRUE.) |
---|
544 | |
---|
545 | CALL xios_get_handle("axis_definition",axisgroup_hdl) |
---|
546 | CALL xios_add_child(axisgroup_hdl, axis_hdl, "deptht") |
---|
547 | !AGRIF fails to compile when unit= is in call to xios_set_axis_attr |
---|
548 | ! CALL xios_set_axis_attr( "deptht", long_name="Vertical levels", unit="m", positive="down") |
---|
549 | CALL xios_set_axis_attr( "deptht", long_name="Vertical levels in meters", positive="down") |
---|
550 | CALL iom_set_axis_attr( "deptht", paxis = gdept_1d ) |
---|
551 | |
---|
552 | CALL xios_get_handle("scalar_definition", scalargroup_hdl) |
---|
553 | CALL xios_add_child(scalargroup_hdl, scalar_hdl, "grid_scalar") |
---|
554 | #endif |
---|
555 | END SUBROUTINE iom_set_rst_context |
---|
556 | |
---|
557 | SUBROUTINE iom_swap( cdname ) |
---|
558 | !!--------------------------------------------------------------------- |
---|
559 | !! *** SUBROUTINE iom_swap *** |
---|
560 | !! |
---|
561 | !! ** Purpose : swap context between different agrif grid for xmlio_server |
---|
562 | !!--------------------------------------------------------------------- |
---|
563 | CHARACTER(len=*), INTENT(in) :: cdname |
---|
564 | #if defined key_iomput |
---|
565 | TYPE(xios_context) :: nemo_hdl |
---|
566 | IF( TRIM(Agrif_CFixed()) == '0' ) THEN |
---|
567 | CALL xios_get_handle(TRIM(cdname),nemo_hdl) |
---|
568 | ELSE |
---|
569 | CALL xios_get_handle(TRIM(Agrif_CFixed())//"_"//TRIM(cdname),nemo_hdl) |
---|
570 | ENDIF |
---|
571 | ! |
---|
572 | CALL xios_set_current_context(nemo_hdl) |
---|
573 | #endif |
---|
574 | ! |
---|
575 | END SUBROUTINE iom_swap |
---|
576 | |
---|
577 | |
---|
578 | SUBROUTINE iom_open( cdname, kiomid, ldwrt, kdom, kiolib, ldstop, ldiof ) |
---|
579 | !!--------------------------------------------------------------------- |
---|
580 | !! *** SUBROUTINE iom_open *** |
---|
581 | !! |
---|
582 | !! ** Purpose : open an input file (return 0 if not found) |
---|
583 | !!--------------------------------------------------------------------- |
---|
584 | CHARACTER(len=*), INTENT(in ) :: cdname ! File name |
---|
585 | INTEGER , INTENT( out) :: kiomid ! iom identifier of the opened file |
---|
586 | LOGICAL , INTENT(in ), OPTIONAL :: ldwrt ! open in write modeb (default = .FALSE.) |
---|
587 | INTEGER , INTENT(in ), OPTIONAL :: kdom ! Type of domain to be written (default = jpdom_local_noovlap) |
---|
588 | INTEGER , INTENT(in ), OPTIONAL :: kiolib ! library used to open the file (default = jpnf90) |
---|
589 | LOGICAL , INTENT(in ), OPTIONAL :: ldstop ! stop if open to read a non-existing file (default = .TRUE.) |
---|
590 | LOGICAL , INTENT(in ), OPTIONAL :: ldiof ! Interp On the Fly, needed for AGRIF (default = .FALSE.) |
---|
591 | |
---|
592 | CHARACTER(LEN=256) :: clname ! the name of the file based on cdname [[+clcpu]+clcpu] |
---|
593 | CHARACTER(LEN=256) :: cltmpn ! tempory name to store clname (in writting mode) |
---|
594 | CHARACTER(LEN=10) :: clsuffix ! ".nc" |
---|
595 | CHARACTER(LEN=15) :: clcpu ! the cpu number (max jpmax_digits digits) |
---|
596 | CHARACTER(LEN=256) :: clinfo ! info character |
---|
597 | LOGICAL :: llok ! check the existence |
---|
598 | LOGICAL :: llwrt ! local definition of ldwrt |
---|
599 | LOGICAL :: llnoov ! local definition to read overlap |
---|
600 | LOGICAL :: llstop ! local definition of ldstop |
---|
601 | LOGICAL :: lliof ! local definition of ldiof |
---|
602 | INTEGER :: iolib ! library do we use to open the file |
---|
603 | INTEGER :: icnt ! counter for digits in clcpu (max = jpmax_digits) |
---|
604 | INTEGER :: iln, ils ! lengths of character |
---|
605 | INTEGER :: idom ! type of domain |
---|
606 | INTEGER :: istop ! |
---|
607 | INTEGER, DIMENSION(2,5) :: idompar ! domain parameters: |
---|
608 | ! local number of points for x,y dimensions |
---|
609 | ! position of first local point for x,y dimensions |
---|
610 | ! position of last local point for x,y dimensions |
---|
611 | ! start halo size for x,y dimensions |
---|
612 | ! end halo size for x,y dimensions |
---|
613 | !--------------------------------------------------------------------- |
---|
614 | ! Initializations and control |
---|
615 | ! ============= |
---|
616 | kiomid = -1 |
---|
617 | clinfo = ' iom_open ~~~ ' |
---|
618 | istop = nstop |
---|
619 | ! if iom_open is called for the first time: initialize iom_file(:)%nfid to 0 |
---|
620 | ! (could be done when defining iom_file in f95 but not in f90) |
---|
621 | IF( Agrif_Root() ) THEN |
---|
622 | IF( iom_open_init == 0 ) THEN |
---|
623 | iom_file(:)%nfid = 0 |
---|
624 | iom_open_init = 1 |
---|
625 | ENDIF |
---|
626 | ENDIF |
---|
627 | ! do we read or write the file? |
---|
628 | IF( PRESENT(ldwrt) ) THEN ; llwrt = ldwrt |
---|
629 | ELSE ; llwrt = .FALSE. |
---|
630 | ENDIF |
---|
631 | ! do we call ctl_stop if we try to open a non-existing file in read mode? |
---|
632 | IF( PRESENT(ldstop) ) THEN ; llstop = ldstop |
---|
633 | ELSE ; llstop = .TRUE. |
---|
634 | ENDIF |
---|
635 | ! what library do we use to open the file? |
---|
636 | IF( PRESENT(kiolib) ) THEN ; iolib = kiolib |
---|
637 | ELSE ; iolib = jpnf90 |
---|
638 | ENDIF |
---|
639 | ! are we using interpolation on the fly? |
---|
640 | IF( PRESENT(ldiof) ) THEN ; lliof = ldiof |
---|
641 | ELSE ; lliof = .FALSE. |
---|
642 | ENDIF |
---|
643 | ! do we read the overlap |
---|
644 | ! ugly patch SM+JMM+RB to overwrite global definition in some cases |
---|
645 | llnoov = (jpni * jpnj ) == jpnij .AND. .NOT. lk_agrif |
---|
646 | ! create the file name by added, if needed, TRIM(Agrif_CFixed()) and TRIM(clsuffix) |
---|
647 | ! ============= |
---|
648 | clname = trim(cdname) |
---|
649 | IF ( .NOT. Agrif_Root() .AND. .NOT. lliof ) THEN |
---|
650 | iln = INDEX(clname,'/') |
---|
651 | cltmpn = clname(1:iln) |
---|
652 | clname = clname(iln+1:LEN_TRIM(clname)) |
---|
653 | clname=TRIM(cltmpn)//TRIM(Agrif_CFixed())//'_'//TRIM(clname) |
---|
654 | ENDIF |
---|
655 | ! which suffix should we use? |
---|
656 | SELECT CASE (iolib) |
---|
657 | CASE (jpnf90 ) ; clsuffix = '.nc' |
---|
658 | CASE DEFAULT ; clsuffix = '' |
---|
659 | CALL ctl_stop( TRIM(clinfo), 'accepted IO library is only jpnf90 (jpioipsl option has been removed) ' ) |
---|
660 | END SELECT |
---|
661 | ! Add the suffix if needed |
---|
662 | iln = LEN_TRIM(clname) |
---|
663 | ils = LEN_TRIM(clsuffix) |
---|
664 | IF( iln <= ils .OR. INDEX( TRIM(clname), TRIM(clsuffix), back = .TRUE. ) /= iln - ils + 1 ) & |
---|
665 | & clname = TRIM(clname)//TRIM(clsuffix) |
---|
666 | cltmpn = clname ! store this name |
---|
667 | ! try to find if the file to be opened already exist |
---|
668 | ! ============= |
---|
669 | INQUIRE( FILE = clname, EXIST = llok ) |
---|
670 | IF( .NOT.llok ) THEN |
---|
671 | ! we try to add the cpu number to the name |
---|
672 | WRITE(clcpu,*) narea-1 |
---|
673 | |
---|
674 | clcpu = TRIM(ADJUSTL(clcpu)) |
---|
675 | iln = INDEX(clname,TRIM(clsuffix), back = .TRUE.) |
---|
676 | clname = clname(1:iln-1)//'_'//TRIM(clcpu)//TRIM(clsuffix) |
---|
677 | icnt = 0 |
---|
678 | INQUIRE( FILE = clname, EXIST = llok ) |
---|
679 | ! we try different formats for the cpu number by adding 0 |
---|
680 | DO WHILE( .NOT.llok .AND. icnt < jpmax_digits ) |
---|
681 | clcpu = "0"//trim(clcpu) |
---|
682 | clname = clname(1:iln-1)//'_'//TRIM(clcpu)//TRIM(clsuffix) |
---|
683 | INQUIRE( FILE = clname, EXIST = llok ) |
---|
684 | icnt = icnt + 1 |
---|
685 | END DO |
---|
686 | ELSE |
---|
687 | lxios_sini = .TRUE. |
---|
688 | ENDIF |
---|
689 | IF( llwrt ) THEN |
---|
690 | ! check the domain definition |
---|
691 | ! JMM + SM: ugly patch before getting the new version of lib_mpp) |
---|
692 | ! idom = jpdom_local_noovlap ! default definition |
---|
693 | IF( llnoov ) THEN ; idom = jpdom_local_noovlap ! default definition |
---|
694 | ELSE ; idom = jpdom_local_full ! default definition |
---|
695 | ENDIF |
---|
696 | IF( PRESENT(kdom) ) idom = kdom |
---|
697 | ! create the domain informations |
---|
698 | ! ============= |
---|
699 | SELECT CASE (idom) |
---|
700 | CASE (jpdom_local_full) |
---|
701 | idompar(:,1) = (/ jpi , jpj /) |
---|
702 | idompar(:,2) = (/ nimpp , njmpp /) |
---|
703 | idompar(:,3) = (/ nimpp + jpi - 1 , njmpp + jpj - 1 /) |
---|
704 | idompar(:,4) = (/ nldi - 1 , nldj - 1 /) |
---|
705 | idompar(:,5) = (/ jpi - nlei , jpj - nlej /) |
---|
706 | CASE (jpdom_local_noextra) |
---|
707 | idompar(:,1) = (/ nlci , nlcj /) |
---|
708 | idompar(:,2) = (/ nimpp , njmpp /) |
---|
709 | idompar(:,3) = (/ nimpp + nlci - 1, njmpp + nlcj - 1 /) |
---|
710 | idompar(:,4) = (/ nldi - 1 , nldj - 1 /) |
---|
711 | idompar(:,5) = (/ nlci - nlei , nlcj - nlej /) |
---|
712 | CASE (jpdom_local_noovlap) |
---|
713 | idompar(:,1) = (/ nlei - nldi + 1, nlej - nldj + 1 /) |
---|
714 | idompar(:,2) = (/ nimpp + nldi - 1, njmpp + nldj - 1 /) |
---|
715 | idompar(:,3) = (/ nimpp + nlei - 1, njmpp + nlej - 1 /) |
---|
716 | idompar(:,4) = (/ 0 , 0 /) |
---|
717 | idompar(:,5) = (/ 0 , 0 /) |
---|
718 | CASE DEFAULT |
---|
719 | CALL ctl_stop( TRIM(clinfo), 'wrong value of kdom, only jpdom_local* cases are accepted' ) |
---|
720 | END SELECT |
---|
721 | ENDIF |
---|
722 | ! Open the NetCDF file |
---|
723 | ! ============= |
---|
724 | ! do we have some free file identifier? |
---|
725 | IF( MINVAL(iom_file(:)%nfid) /= 0 ) & |
---|
726 | & CALL ctl_stop( TRIM(clinfo), 'No more free file identifier', 'increase jpmax_files in iom_def' ) |
---|
727 | ! if no file was found... |
---|
728 | IF( .NOT. llok ) THEN |
---|
729 | IF( .NOT. llwrt ) THEN ! we are in read mode |
---|
730 | IF( llstop ) THEN ; CALL ctl_stop( TRIM(clinfo), 'File '//TRIM(cltmpn)//'* not found' ) |
---|
731 | ELSE ; istop = nstop + 1 ! make sure that istop /= nstop so we don't open the file |
---|
732 | ENDIF |
---|
733 | ELSE ! we are in write mode so we |
---|
734 | clname = cltmpn ! get back the file name without the cpu number |
---|
735 | ENDIF |
---|
736 | ELSE |
---|
737 | IF( llwrt .AND. .NOT. ln_clobber ) THEN ! we stop as we want to write in a new file |
---|
738 | CALL ctl_stop( TRIM(clinfo), 'We want to write in a new file but '//TRIM(clname)//' already exists...' ) |
---|
739 | istop = nstop + 1 ! make sure that istop /= nstop so we don't open the file |
---|
740 | ELSEIF( llwrt ) THEN ! the file exists and we are in write mode with permission to |
---|
741 | clname = cltmpn ! overwrite so get back the file name without the cpu number |
---|
742 | ENDIF |
---|
743 | ENDIF |
---|
744 | IF( istop == nstop ) THEN ! no error within this routine |
---|
745 | SELECT CASE (iolib) |
---|
746 | CASE (jpnf90 ) ; CALL iom_nf90_open( clname, kiomid, llwrt, llok, idompar ) |
---|
747 | CASE DEFAULT |
---|
748 | CALL ctl_stop( TRIM(clinfo)//' accepted IO library is only jpnf90 (jpioipsl option has been removed) ' ) |
---|
749 | END SELECT |
---|
750 | ENDIF |
---|
751 | ! |
---|
752 | END SUBROUTINE iom_open |
---|
753 | |
---|
754 | |
---|
755 | SUBROUTINE iom_close( kiomid ) |
---|
756 | !!-------------------------------------------------------------------- |
---|
757 | !! *** SUBROUTINE iom_close *** |
---|
758 | !! |
---|
759 | !! ** Purpose : close an input file, or all files opened by iom |
---|
760 | !!-------------------------------------------------------------------- |
---|
761 | INTEGER, INTENT(inout), OPTIONAL :: kiomid ! iom identifier of the file to be closed |
---|
762 | ! ! return 0 when file is properly closed |
---|
763 | ! ! No argument: all files opened by iom are closed |
---|
764 | |
---|
765 | INTEGER :: jf ! dummy loop indices |
---|
766 | INTEGER :: i_s, i_e ! temporary integer |
---|
767 | CHARACTER(LEN=100) :: clinfo ! info character |
---|
768 | !--------------------------------------------------------------------- |
---|
769 | ! |
---|
770 | clinfo = ' iom_close ~~~ ' |
---|
771 | IF( PRESENT(kiomid) ) THEN |
---|
772 | i_s = kiomid |
---|
773 | i_e = kiomid |
---|
774 | ELSE |
---|
775 | i_s = 1 |
---|
776 | i_e = jpmax_files |
---|
777 | ENDIF |
---|
778 | |
---|
779 | IF( i_s > 0 ) THEN |
---|
780 | DO jf = i_s, i_e |
---|
781 | IF( iom_file(jf)%nfid > 0 ) THEN |
---|
782 | SELECT CASE (iom_file(jf)%iolib) |
---|
783 | CASE (jpnf90 ) ; CALL iom_nf90_close( jf ) |
---|
784 | CASE DEFAULT |
---|
785 | CALL ctl_stop( TRIM(clinfo)//' accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) |
---|
786 | END SELECT |
---|
787 | iom_file(jf)%nfid = 0 ! free the id |
---|
788 | IF( PRESENT(kiomid) ) kiomid = 0 ! return 0 as id to specify that the file was closed |
---|
789 | IF(lwp) WRITE(numout,*) TRIM(clinfo)//' close file: '//TRIM(iom_file(jf)%name)//' ok' |
---|
790 | ELSEIF( PRESENT(kiomid) ) THEN |
---|
791 | WRITE(ctmp1,*) '--->', kiomid |
---|
792 | CALL ctl_stop( TRIM(clinfo)//' Invalid file identifier', ctmp1 ) |
---|
793 | ENDIF |
---|
794 | END DO |
---|
795 | ENDIF |
---|
796 | ! |
---|
797 | END SUBROUTINE iom_close |
---|
798 | |
---|
799 | |
---|
800 | FUNCTION iom_varid ( kiomid, cdvar, kdimsz, kndims, ldstop ) |
---|
801 | !!----------------------------------------------------------------------- |
---|
802 | !! *** FUNCTION iom_varid *** |
---|
803 | !! |
---|
804 | !! ** Purpose : get the id of a variable in a file (return 0 if not found) |
---|
805 | !!----------------------------------------------------------------------- |
---|
806 | INTEGER , INTENT(in ) :: kiomid ! file Identifier |
---|
807 | CHARACTER(len=*) , INTENT(in ) :: cdvar ! name of the variable |
---|
808 | INTEGER, DIMENSION(:), INTENT( out), OPTIONAL :: kdimsz ! size of the dimensions |
---|
809 | INTEGER, INTENT( out), OPTIONAL :: kndims ! size of the dimensions |
---|
810 | LOGICAL , INTENT(in ), OPTIONAL :: ldstop ! stop if looking for non-existing variable (default = .TRUE.) |
---|
811 | ! |
---|
812 | INTEGER :: iom_varid, iiv, i_nvd |
---|
813 | LOGICAL :: ll_fnd |
---|
814 | CHARACTER(LEN=100) :: clinfo ! info character |
---|
815 | LOGICAL :: llstop ! local definition of ldstop |
---|
816 | !!----------------------------------------------------------------------- |
---|
817 | iom_varid = 0 ! default definition |
---|
818 | ! do we call ctl_stop if we look for non-existing variable? |
---|
819 | IF( PRESENT(ldstop) ) THEN ; llstop = ldstop |
---|
820 | ELSE ; llstop = .TRUE. |
---|
821 | ENDIF |
---|
822 | ! |
---|
823 | IF( kiomid > 0 ) THEN |
---|
824 | clinfo = 'iom_varid, file: '//trim(iom_file(kiomid)%name)//', var: '//trim(cdvar) |
---|
825 | IF( iom_file(kiomid)%nfid == 0 ) THEN |
---|
826 | CALL ctl_stop( trim(clinfo), 'the file is not open' ) |
---|
827 | ELSE |
---|
828 | ll_fnd = .FALSE. |
---|
829 | iiv = 0 |
---|
830 | ! |
---|
831 | DO WHILE ( .NOT.ll_fnd .AND. iiv < iom_file(kiomid)%nvars ) |
---|
832 | iiv = iiv + 1 |
---|
833 | ll_fnd = ( TRIM(cdvar) == TRIM(iom_file(kiomid)%cn_var(iiv)) ) |
---|
834 | END DO |
---|
835 | ! |
---|
836 | IF( .NOT.ll_fnd ) THEN |
---|
837 | iiv = iiv + 1 |
---|
838 | IF( iiv <= jpmax_vars ) THEN |
---|
839 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
840 | CASE (jpnf90 ) ; iom_varid = iom_nf90_varid ( kiomid, cdvar, iiv, kdimsz, kndims ) |
---|
841 | CASE DEFAULT |
---|
842 | CALL ctl_stop( TRIM(clinfo)//' accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) |
---|
843 | END SELECT |
---|
844 | ELSE |
---|
845 | CALL ctl_stop( trim(clinfo), 'Too many variables in the file '//iom_file(kiomid)%name, & |
---|
846 | & 'increase the parameter jpmax_vars') |
---|
847 | ENDIF |
---|
848 | IF( llstop .AND. iom_varid == -1 ) CALL ctl_stop( TRIM(clinfo)//' not found' ) |
---|
849 | ELSE |
---|
850 | iom_varid = iiv |
---|
851 | IF( PRESENT(kdimsz) ) THEN |
---|
852 | i_nvd = iom_file(kiomid)%ndims(iiv) |
---|
853 | IF( i_nvd == size(kdimsz) ) THEN |
---|
854 | kdimsz(:) = iom_file(kiomid)%dimsz(1:i_nvd,iiv) |
---|
855 | ELSE |
---|
856 | WRITE(ctmp1,*) i_nvd, size(kdimsz) |
---|
857 | CALL ctl_stop( trim(clinfo), 'error in kdimsz size'//trim(ctmp1) ) |
---|
858 | ENDIF |
---|
859 | ENDIF |
---|
860 | IF( PRESENT(kndims) ) kndims = iom_file(kiomid)%ndims(iiv) |
---|
861 | ENDIF |
---|
862 | ENDIF |
---|
863 | ENDIF |
---|
864 | ! |
---|
865 | END FUNCTION iom_varid |
---|
866 | |
---|
867 | |
---|
868 | !!---------------------------------------------------------------------- |
---|
869 | !! INTERFACE iom_get |
---|
870 | !!---------------------------------------------------------------------- |
---|
871 | SUBROUTINE iom_g0d( kiomid, cdvar, pvar, ktime, ldxios ) |
---|
872 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
873 | CHARACTER(len=*), INTENT(in ) :: cdvar ! Name of the variable |
---|
874 | REAL(wp) , INTENT( out) :: pvar ! read field |
---|
875 | INTEGER , INTENT(in ), OPTIONAL :: ktime ! record number |
---|
876 | LOGICAL , INTENT(in ), OPTIONAL :: ldxios ! use xios to read restart |
---|
877 | ! |
---|
878 | INTEGER :: idvar ! variable id |
---|
879 | INTEGER :: idmspc ! number of spatial dimensions |
---|
880 | INTEGER , DIMENSION(1) :: itime ! record number |
---|
881 | CHARACTER(LEN=100) :: clinfo ! info character |
---|
882 | CHARACTER(LEN=100) :: clname ! file name |
---|
883 | CHARACTER(LEN=1) :: cldmspc ! |
---|
884 | LOGICAL :: llxios |
---|
885 | ! |
---|
886 | llxios = .FALSE. |
---|
887 | IF( PRESENT(ldxios) ) llxios = ldxios |
---|
888 | |
---|
889 | IF(.NOT.llxios) THEN ! read data using default library |
---|
890 | itime = 1 |
---|
891 | IF( PRESENT(ktime) ) itime = ktime |
---|
892 | ! |
---|
893 | clname = iom_file(kiomid)%name |
---|
894 | clinfo = ' iom_g0d, file: '//trim(clname)//', var: '//trim(cdvar) |
---|
895 | ! |
---|
896 | IF( kiomid > 0 ) THEN |
---|
897 | idvar = iom_varid( kiomid, cdvar ) |
---|
898 | IF( iom_file(kiomid)%nfid > 0 .AND. idvar > 0 ) THEN |
---|
899 | idmspc = iom_file ( kiomid )%ndims( idvar ) |
---|
900 | IF( iom_file(kiomid)%luld(idvar) ) idmspc = idmspc - 1 |
---|
901 | WRITE(cldmspc , fmt='(i1)') idmspc |
---|
902 | IF( idmspc > 0 ) CALL ctl_stop( TRIM(clinfo), 'When reading to a 0D array, we do not accept data', & |
---|
903 | & 'with 1 or more spatial dimensions: '//cldmspc//' were found.' , & |
---|
904 | & 'Use ncwa -a to suppress the unnecessary dimensions' ) |
---|
905 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
906 | CASE (jpnf90 ) ; CALL iom_nf90_get( kiomid, idvar, pvar, itime ) |
---|
907 | CASE DEFAULT |
---|
908 | CALL ctl_stop( 'iom_g0d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) |
---|
909 | END SELECT |
---|
910 | ENDIF |
---|
911 | ENDIF |
---|
912 | ELSE |
---|
913 | IF(lwp) WRITE(numout,*) 'XIOS RST READ (0D): ', trim(cdvar) |
---|
914 | CALL iom_swap( TRIM(crxios_context) ) |
---|
915 | CALL xios_recv_field( trim(cdvar), pvar) |
---|
916 | CALL iom_swap( TRIM(cxios_context) ) |
---|
917 | ENDIF |
---|
918 | END SUBROUTINE iom_g0d |
---|
919 | |
---|
920 | SUBROUTINE iom_g1d( kiomid, kdom, cdvar, pvar, ktime, kstart, kcount, ldxios ) |
---|
921 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
922 | INTEGER , INTENT(in ) :: kdom ! Type of domain to be read |
---|
923 | CHARACTER(len=*), INTENT(in ) :: cdvar ! Name of the variable |
---|
924 | REAL(wp) , INTENT( out), DIMENSION(:) :: pvar ! read field |
---|
925 | INTEGER , INTENT(in ) , OPTIONAL :: ktime ! record number |
---|
926 | INTEGER , INTENT(in ), DIMENSION(1), OPTIONAL :: kstart ! start axis position of the reading |
---|
927 | INTEGER , INTENT(in ), DIMENSION(1), OPTIONAL :: kcount ! number of points in each axis |
---|
928 | LOGICAL , INTENT(in ), OPTIONAL :: ldxios ! read data using XIOS |
---|
929 | ! |
---|
930 | IF( kiomid > 0 ) THEN |
---|
931 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_get_123d( kiomid, kdom , cdvar , pv_r1d=pvar, & |
---|
932 | & ktime=ktime, kstart=kstart, kcount=kcount, & |
---|
933 | & ldxios=ldxios ) |
---|
934 | ENDIF |
---|
935 | END SUBROUTINE iom_g1d |
---|
936 | |
---|
937 | SUBROUTINE iom_g2d( kiomid, kdom, cdvar, pvar, ktime, kstart, kcount, lrowattr, ldxios) |
---|
938 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
939 | INTEGER , INTENT(in ) :: kdom ! Type of domain to be read |
---|
940 | CHARACTER(len=*), INTENT(in ) :: cdvar ! Name of the variable |
---|
941 | REAL(wp) , INTENT( out), DIMENSION(:,:) :: pvar ! read field |
---|
942 | INTEGER , INTENT(in ) , OPTIONAL :: ktime ! record number |
---|
943 | INTEGER , INTENT(in ), DIMENSION(2) , OPTIONAL :: kstart ! start axis position of the reading |
---|
944 | INTEGER , INTENT(in ), DIMENSION(2) , OPTIONAL :: kcount ! number of points in each axis |
---|
945 | LOGICAL , INTENT(in ) , OPTIONAL :: lrowattr ! logical flag telling iom_get to |
---|
946 | ! look for and use a file attribute |
---|
947 | ! called open_ocean_jstart to set the start |
---|
948 | ! value for the 2nd dimension (netcdf only) |
---|
949 | LOGICAL , INTENT(in ), OPTIONAL :: ldxios ! read data using XIOS |
---|
950 | ! |
---|
951 | IF( kiomid > 0 ) THEN |
---|
952 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_get_123d( kiomid, kdom , cdvar , pv_r2d=pvar, & |
---|
953 | & ktime=ktime, kstart=kstart, kcount=kcount, & |
---|
954 | & lrowattr=lrowattr, ldxios=ldxios) |
---|
955 | ENDIF |
---|
956 | END SUBROUTINE iom_g2d |
---|
957 | |
---|
958 | SUBROUTINE iom_g3d( kiomid, kdom, cdvar, pvar, ktime, kstart, kcount, lrowattr, ldxios ) |
---|
959 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
960 | INTEGER , INTENT(in ) :: kdom ! Type of domain to be read |
---|
961 | CHARACTER(len=*), INTENT(in ) :: cdvar ! Name of the variable |
---|
962 | REAL(wp) , INTENT( out), DIMENSION(:,:,:) :: pvar ! read field |
---|
963 | INTEGER , INTENT(in ) , OPTIONAL :: ktime ! record number |
---|
964 | INTEGER , INTENT(in ), DIMENSION(3) , OPTIONAL :: kstart ! start axis position of the reading |
---|
965 | INTEGER , INTENT(in ), DIMENSION(3) , OPTIONAL :: kcount ! number of points in each axis |
---|
966 | LOGICAL , INTENT(in ) , OPTIONAL :: lrowattr ! logical flag telling iom_get to |
---|
967 | ! look for and use a file attribute |
---|
968 | ! called open_ocean_jstart to set the start |
---|
969 | ! value for the 2nd dimension (netcdf only) |
---|
970 | LOGICAL , INTENT(in ), OPTIONAL :: ldxios ! read data using XIOS |
---|
971 | ! |
---|
972 | IF( kiomid > 0 ) THEN |
---|
973 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_get_123d( kiomid, kdom , cdvar , pv_r3d=pvar, & |
---|
974 | & ktime=ktime, kstart=kstart, kcount=kcount, & |
---|
975 | & lrowattr=lrowattr, ldxios=ldxios ) |
---|
976 | ENDIF |
---|
977 | END SUBROUTINE iom_g3d |
---|
978 | !!---------------------------------------------------------------------- |
---|
979 | |
---|
980 | SUBROUTINE iom_get_123d( kiomid, kdom , cdvar , & |
---|
981 | & pv_r1d, pv_r2d, pv_r3d, & |
---|
982 | & ktime , kstart, kcount, & |
---|
983 | & lrowattr, ldxios ) |
---|
984 | !!----------------------------------------------------------------------- |
---|
985 | !! *** ROUTINE iom_get_123d *** |
---|
986 | !! |
---|
987 | !! ** Purpose : read a 1D/2D/3D variable |
---|
988 | !! |
---|
989 | !! ** Method : read ONE record at each CALL |
---|
990 | !!----------------------------------------------------------------------- |
---|
991 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
992 | INTEGER , INTENT(in ) :: kdom ! Type of domain to be read |
---|
993 | CHARACTER(len=*) , INTENT(in ) :: cdvar ! Name of the variable |
---|
994 | REAL(wp), DIMENSION(:) , INTENT( out), OPTIONAL :: pv_r1d ! read field (1D case) |
---|
995 | REAL(wp), DIMENSION(:,:) , INTENT( out), OPTIONAL :: pv_r2d ! read field (2D case) |
---|
996 | REAL(wp), DIMENSION(:,:,:) , INTENT( out), OPTIONAL :: pv_r3d ! read field (3D case) |
---|
997 | INTEGER , INTENT(in ), OPTIONAL :: ktime ! record number |
---|
998 | INTEGER , DIMENSION(:) , INTENT(in ), OPTIONAL :: kstart ! start position of the reading in each axis |
---|
999 | INTEGER , DIMENSION(:) , INTENT(in ), OPTIONAL :: kcount ! number of points to be read in each axis |
---|
1000 | LOGICAL , INTENT(in ), OPTIONAL :: lrowattr ! logical flag telling iom_get to |
---|
1001 | ! look for and use a file attribute |
---|
1002 | ! called open_ocean_jstart to set the start |
---|
1003 | ! value for the 2nd dimension (netcdf only) |
---|
1004 | LOGICAL , INTENT(in ), OPTIONAL :: ldxios ! use XIOS to read restart |
---|
1005 | ! |
---|
1006 | LOGICAL :: llxios ! local definition for XIOS read |
---|
1007 | LOGICAL :: llnoov ! local definition to read overlap |
---|
1008 | LOGICAL :: luse_jattr ! local definition to read open_ocean_jstart file attribute |
---|
1009 | INTEGER :: jstartrow ! start point for 2nd dimension optionally set by file attribute |
---|
1010 | INTEGER :: jl ! loop on number of dimension |
---|
1011 | INTEGER :: idom ! type of domain |
---|
1012 | INTEGER :: idvar ! id of the variable |
---|
1013 | INTEGER :: inbdim ! number of dimensions of the variable |
---|
1014 | INTEGER :: idmspc ! number of spatial dimensions |
---|
1015 | INTEGER :: itime ! record number |
---|
1016 | INTEGER :: istop ! temporary value of nstop |
---|
1017 | INTEGER :: ix1, ix2, iy1, iy2 ! subdomain indexes |
---|
1018 | INTEGER :: ji, jj ! loop counters |
---|
1019 | INTEGER :: irankpv ! |
---|
1020 | INTEGER :: ind1, ind2 ! substring index |
---|
1021 | INTEGER, DIMENSION(jpmax_dims) :: istart ! starting point to read for each axis |
---|
1022 | INTEGER, DIMENSION(jpmax_dims) :: icnt ! number of value to read along each axis |
---|
1023 | INTEGER, DIMENSION(jpmax_dims) :: idimsz ! size of the dimensions of the variable |
---|
1024 | INTEGER, DIMENSION(jpmax_dims) :: ishape ! size of the dimensions of the variable |
---|
1025 | REAL(wp) :: zscf, zofs ! sacle_factor and add_offset |
---|
1026 | INTEGER :: itmp ! temporary integer |
---|
1027 | CHARACTER(LEN=256) :: clinfo ! info character |
---|
1028 | CHARACTER(LEN=256) :: clname ! file name |
---|
1029 | CHARACTER(LEN=1) :: clrankpv, cldmspc ! |
---|
1030 | LOGICAL :: ll_depth_spec ! T => if kstart, kcount present then *only* use values for 3rd spatial dimension. |
---|
1031 | !--------------------------------------------------------------------- |
---|
1032 | ! |
---|
1033 | REAL(wp) :: gma, gmi |
---|
1034 | llxios = .FALSE. |
---|
1035 | if(PRESENT(ldxios)) llxios = ldxios |
---|
1036 | idvar = iom_varid( kiomid, cdvar ) |
---|
1037 | idom = kdom |
---|
1038 | |
---|
1039 | IF(.NOT.llxios) THEN |
---|
1040 | clname = iom_file(kiomid)%name ! esier to read |
---|
1041 | clinfo = ' iom_get_123d, file: '//trim(clname)//', var: '//trim(cdvar) |
---|
1042 | ! local definition of the domain ? |
---|
1043 | ! do we read the overlap |
---|
1044 | ! ugly patch SM+JMM+RB to overwrite global definition in some cases |
---|
1045 | llnoov = (jpni * jpnj ) == jpnij .AND. .NOT. lk_agrif |
---|
1046 | ! check kcount and kstart optionals parameters... |
---|
1047 | IF( PRESENT(kcount) .AND. (.NOT. PRESENT(kstart)) ) CALL ctl_stop(trim(clinfo), 'kcount present needs kstart present') |
---|
1048 | IF( PRESENT(kstart) .AND. (.NOT. PRESENT(kcount)) ) CALL ctl_stop(trim(clinfo), 'kstart present needs kcount present') |
---|
1049 | IF( PRESENT(kstart) .AND. idom /= jpdom_unknown .AND. idom /= jpdom_autoglo_xy ) & |
---|
1050 | & CALL ctl_stop(trim(clinfo), 'kstart present needs kdom = jpdom_unknown or kdom = jpdom_autoglo_xy') |
---|
1051 | |
---|
1052 | luse_jattr = .false. |
---|
1053 | IF( PRESENT(lrowattr) ) THEN |
---|
1054 | IF( lrowattr .AND. idom /= jpdom_data ) CALL ctl_stop(trim(clinfo), 'lrowattr present and true needs kdom = jpdom_data') |
---|
1055 | IF( lrowattr .AND. idom == jpdom_data ) luse_jattr = .true. |
---|
1056 | ENDIF |
---|
1057 | IF( luse_jattr ) THEN |
---|
1058 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
1059 | CASE (jpnf90 ) |
---|
1060 | ! Ok |
---|
1061 | CASE DEFAULT |
---|
1062 | CALL ctl_stop( TRIM(clinfo)//' accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) |
---|
1063 | END SELECT |
---|
1064 | ENDIF |
---|
1065 | |
---|
1066 | ! Search for the variable in the data base (eventually actualize data) |
---|
1067 | istop = nstop |
---|
1068 | ! |
---|
1069 | IF( idvar > 0 ) THEN |
---|
1070 | ! to write iom_file(kiomid)%dimsz in a shorter way ! |
---|
1071 | idimsz(:) = iom_file(kiomid)%dimsz(:, idvar) |
---|
1072 | inbdim = iom_file(kiomid)%ndims(idvar) ! number of dimensions in the file |
---|
1073 | idmspc = inbdim ! number of spatial dimensions in the file |
---|
1074 | IF( iom_file(kiomid)%luld(idvar) ) idmspc = inbdim - 1 |
---|
1075 | IF( idmspc > 3 ) CALL ctl_stop(trim(clinfo), 'the file has more than 3 spatial dimensions this case is not coded...') |
---|
1076 | ! |
---|
1077 | ! update idom definition... |
---|
1078 | ! Identify the domain in case of jpdom_auto(glo/dta) definition |
---|
1079 | IF( idom == jpdom_autoglo_xy ) THEN |
---|
1080 | ll_depth_spec = .TRUE. |
---|
1081 | idom = jpdom_autoglo |
---|
1082 | ELSE |
---|
1083 | ll_depth_spec = .FALSE. |
---|
1084 | ENDIF |
---|
1085 | IF( idom == jpdom_autoglo .OR. idom == jpdom_autodta ) THEN |
---|
1086 | IF( idom == jpdom_autoglo ) THEN ; idom = jpdom_global |
---|
1087 | ELSE ; idom = jpdom_data |
---|
1088 | ENDIF |
---|
1089 | ind1 = INDEX( clname, '_', back = .TRUE. ) + 1 |
---|
1090 | ind2 = INDEX( clname, '.', back = .TRUE. ) - 1 |
---|
1091 | IF( ind2 > ind1 ) THEN ; IF( VERIFY( clname(ind1:ind2), '0123456789' ) == 0 ) idom = jpdom_local ; ENDIF |
---|
1092 | ENDIF |
---|
1093 | ! Identify the domain in case of jpdom_local definition |
---|
1094 | IF( idom == jpdom_local ) THEN |
---|
1095 | IF( idimsz(1) == jpi .AND. idimsz(2) == jpj ) THEN ; idom = jpdom_local_full |
---|
1096 | ELSEIF( idimsz(1) == nlci .AND. idimsz(2) == nlcj ) THEN ; idom = jpdom_local_noextra |
---|
1097 | ELSEIF( idimsz(1) == (nlei - nldi + 1) .AND. idimsz(2) == (nlej - nldj + 1) ) THEN ; idom = jpdom_local_noovlap |
---|
1098 | ELSE ; CALL ctl_stop( trim(clinfo), 'impossible to identify the local domain' ) |
---|
1099 | ENDIF |
---|
1100 | ENDIF |
---|
1101 | ! |
---|
1102 | ! check the consistency between input array and data rank in the file |
---|
1103 | ! |
---|
1104 | ! initializations |
---|
1105 | itime = 1 |
---|
1106 | IF( PRESENT(ktime) ) itime = ktime |
---|
1107 | |
---|
1108 | irankpv = 1 * COUNT( (/PRESENT(pv_r1d)/) ) + 2 * COUNT( (/PRESENT(pv_r2d)/) ) + 3 * COUNT( (/PRESENT(pv_r3d)/) ) |
---|
1109 | WRITE(clrankpv, fmt='(i1)') irankpv |
---|
1110 | WRITE(cldmspc , fmt='(i1)') idmspc |
---|
1111 | ! |
---|
1112 | IF( idmspc < irankpv ) THEN |
---|
1113 | CALL ctl_stop( TRIM(clinfo), 'The file has only '//cldmspc//' spatial dimension', & |
---|
1114 | & 'it is impossible to read a '//clrankpv//'D array from this file...' ) |
---|
1115 | ELSEIF( idmspc == irankpv ) THEN |
---|
1116 | IF( PRESENT(pv_r1d) .AND. idom /= jpdom_unknown ) & |
---|
1117 | & CALL ctl_stop( TRIM(clinfo), 'case not coded...You must use jpdom_unknown' ) |
---|
1118 | ELSEIF( idmspc > irankpv ) THEN |
---|
1119 | IF( PRESENT(pv_r2d) .AND. itime == 1 .AND. idimsz(3) == 1 .AND. idmspc == 3 ) THEN |
---|
1120 | CALL ctl_warn( trim(clinfo), '2D array but 3 spatial dimensions for the data...' , & |
---|
1121 | & 'As the size of the z dimension is 1 and as we try to read the first record, ', & |
---|
1122 | & 'we accept this case, even if there is a possible mix-up between z and time dimension' ) |
---|
1123 | idmspc = idmspc - 1 |
---|
1124 | ELSE |
---|
1125 | CALL ctl_stop( TRIM(clinfo), 'To keep iom lisibility, when reading a '//clrankpv//'D array,' , & |
---|
1126 | & 'we do not accept data with '//cldmspc//' spatial dimensions', & |
---|
1127 | & 'Use ncwa -a to suppress the unnecessary dimensions' ) |
---|
1128 | ENDIF |
---|
1129 | ENDIF |
---|
1130 | |
---|
1131 | ! |
---|
1132 | ! definition of istart and icnt |
---|
1133 | ! |
---|
1134 | icnt (:) = 1 |
---|
1135 | istart(:) = 1 |
---|
1136 | istart(idmspc+1) = itime |
---|
1137 | |
---|
1138 | IF( PRESENT(kstart) .AND. .NOT. ll_depth_spec ) THEN |
---|
1139 | istart(1:idmspc) = kstart(1:idmspc) ; icnt(1:idmspc) = kcount(1:idmspc) |
---|
1140 | ELSE |
---|
1141 | IF(idom == jpdom_unknown ) THEN |
---|
1142 | icnt(1:idmspc) = idimsz(1:idmspc) |
---|
1143 | ELSE |
---|
1144 | IF( .NOT. PRESENT(pv_r1d) ) THEN ! not a 1D array |
---|
1145 | IF( idom == jpdom_data ) THEN |
---|
1146 | jstartrow = 1 |
---|
1147 | IF( luse_jattr ) THEN |
---|
1148 | CALL iom_getatt(kiomid, 'open_ocean_jstart', jstartrow ) ! -999 is returned if the attribute is not found |
---|
1149 | jstartrow = MAX(1,jstartrow) |
---|
1150 | ENDIF |
---|
1151 | istart(1:2) = (/ mig(1), mjg(1) + jstartrow - 1 /) ! icnt(1:2) done below |
---|
1152 | ELSEIF( idom == jpdom_global ) THEN ; istart(1:2) = (/ nimpp , njmpp /) ! icnt(1:2) done below |
---|
1153 | ENDIF |
---|
1154 | ! we do not read the overlap -> we start to read at nldi, nldj |
---|
1155 | ! JMM + SM: ugly patch before getting the new version of lib_mpp) |
---|
1156 | ! IF( idom /= jpdom_local_noovlap ) istart(1:2) = istart(1:2) + (/ nldi - 1, nldj - 1 /) |
---|
1157 | IF( llnoov .AND. idom /= jpdom_local_noovlap ) istart(1:2) = istart(1:2) + (/ nldi - 1, nldj - 1 /) |
---|
1158 | ! we do not read the overlap and the extra-halos -> from nldi to nlei and from nldj to nlej |
---|
1159 | ! JMM + SM: ugly patch before getting the new version of lib_mpp) |
---|
1160 | ! icnt(1:2) = (/ nlei - nldi + 1, nlej - nldj + 1 /) |
---|
1161 | IF( llnoov ) THEN ; icnt(1:2) = (/ nlei - nldi + 1, nlej - nldj + 1 /) |
---|
1162 | ELSE ; icnt(1:2) = (/ nlci , nlcj /) |
---|
1163 | ENDIF |
---|
1164 | IF( PRESENT(pv_r3d) ) THEN |
---|
1165 | IF( idom == jpdom_data ) THEN ; icnt(3) = jpkglo |
---|
1166 | ELSE IF( ll_depth_spec .AND. PRESENT(kstart) ) THEN ; istart(3) = kstart(3); icnt(3) = kcount(3) |
---|
1167 | ELSE ; icnt(3) = jpk |
---|
1168 | ENDIF |
---|
1169 | ENDIF |
---|
1170 | ENDIF |
---|
1171 | ENDIF |
---|
1172 | ENDIF |
---|
1173 | |
---|
1174 | ! check that istart and icnt can be used with this file |
---|
1175 | !- |
---|
1176 | DO jl = 1, jpmax_dims |
---|
1177 | itmp = istart(jl)+icnt(jl)-1 |
---|
1178 | IF( itmp > idimsz(jl) .AND. idimsz(jl) /= 0 ) THEN |
---|
1179 | WRITE( ctmp1, FMT="('(istart(', i1, ') + icnt(', i1, ') - 1) = ', i5)" ) jl, jl, itmp |
---|
1180 | WRITE( ctmp2, FMT="(' is larger than idimsz(', i1,') = ', i5)" ) jl, idimsz(jl) |
---|
1181 | CALL ctl_stop( trim(clinfo), 'start and count too big regarding to the size of the data, ', ctmp1, ctmp2 ) |
---|
1182 | ENDIF |
---|
1183 | END DO |
---|
1184 | |
---|
1185 | ! check that icnt matches the input array |
---|
1186 | !- |
---|
1187 | IF( idom == jpdom_unknown ) THEN |
---|
1188 | IF( irankpv == 1 ) ishape(1:1) = SHAPE(pv_r1d) |
---|
1189 | IF( irankpv == 2 ) ishape(1:2) = SHAPE(pv_r2d) |
---|
1190 | IF( irankpv == 3 ) ishape(1:3) = SHAPE(pv_r3d) |
---|
1191 | ctmp1 = 'd' |
---|
1192 | ELSE |
---|
1193 | IF( irankpv == 2 ) THEN |
---|
1194 | ! JMM + SM: ugly patch before getting the new version of lib_mpp) |
---|
1195 | ! ishape(1:2) = SHAPE(pv_r2d(nldi:nlei,nldj:nlej )) ; ctmp1 = 'd(nldi:nlei,nldj:nlej)' |
---|
1196 | IF( llnoov ) THEN ; ishape(1:2)=SHAPE(pv_r2d(nldi:nlei,nldj:nlej )) ; ctmp1='d(nldi:nlei,nldj:nlej)' |
---|
1197 | ELSE ; ishape(1:2)=SHAPE(pv_r2d(1 :nlci,1 :nlcj )) ; ctmp1='d(1:nlci,1:nlcj)' |
---|
1198 | ENDIF |
---|
1199 | ENDIF |
---|
1200 | IF( irankpv == 3 ) THEN |
---|
1201 | ! JMM + SM: ugly patch before getting the new version of lib_mpp) |
---|
1202 | ! ishape(1:3) = SHAPE(pv_r3d(nldi:nlei,nldj:nlej,:)) ; ctmp1 = 'd(nldi:nlei,nldj:nlej,:)' |
---|
1203 | IF( llnoov ) THEN ; ishape(1:3)=SHAPE(pv_r3d(nldi:nlei,nldj:nlej,:)) ; ctmp1='d(nldi:nlei,nldj:nlej,:)' |
---|
1204 | ELSE ; ishape(1:3)=SHAPE(pv_r3d(1 :nlci,1 :nlcj,:)) ; ctmp1='d(1:nlci,1:nlcj,:)' |
---|
1205 | ENDIF |
---|
1206 | ENDIF |
---|
1207 | ENDIF |
---|
1208 | |
---|
1209 | DO jl = 1, irankpv |
---|
1210 | WRITE( ctmp2, FMT="(', ', i1,'): ', i5,' /= icnt(', i1,'):', i5)" ) jl, ishape(jl), jl, icnt(jl) |
---|
1211 | IF( ishape(jl) /= icnt(jl) ) CALL ctl_stop( TRIM(clinfo), 'size(pv_r'//clrankpv//TRIM(ctmp1)//TRIM(ctmp2) ) |
---|
1212 | END DO |
---|
1213 | |
---|
1214 | ENDIF |
---|
1215 | |
---|
1216 | ! read the data |
---|
1217 | !- |
---|
1218 | IF( idvar > 0 .AND. istop == nstop ) THEN ! no additional errors until this point... |
---|
1219 | ! |
---|
1220 | ! find the right index of the array to be read |
---|
1221 | ! JMM + SM: ugly patch before getting the new version of lib_mpp) |
---|
1222 | ! IF( idom /= jpdom_unknown ) THEN ; ix1 = nldi ; ix2 = nlei ; iy1 = nldj ; iy2 = nlej |
---|
1223 | ! ELSE ; ix1 = 1 ; ix2 = icnt(1) ; iy1 = 1 ; iy2 = icnt(2) |
---|
1224 | ! ENDIF |
---|
1225 | IF( llnoov ) THEN |
---|
1226 | IF( idom /= jpdom_unknown ) THEN ; ix1 = nldi ; ix2 = nlei ; iy1 = nldj ; iy2 = nlej |
---|
1227 | ELSE ; ix1 = 1 ; ix2 = icnt(1) ; iy1 = 1 ; iy2 = icnt(2) |
---|
1228 | ENDIF |
---|
1229 | ELSE |
---|
1230 | IF( idom /= jpdom_unknown ) THEN ; ix1 = 1 ; ix2 = nlci ; iy1 = 1 ; iy2 = nlcj |
---|
1231 | ELSE ; ix1 = 1 ; ix2 = icnt(1) ; iy1 = 1 ; iy2 = icnt(2) |
---|
1232 | ENDIF |
---|
1233 | ENDIF |
---|
1234 | |
---|
1235 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
1236 | CASE (jpnf90 ) ; CALL iom_nf90_get( kiomid, idvar, inbdim, istart, icnt, ix1, ix2, iy1, iy2, & |
---|
1237 | & pv_r1d, pv_r2d, pv_r3d ) |
---|
1238 | CASE DEFAULT |
---|
1239 | CALL ctl_stop( TRIM(clinfo)//' accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) |
---|
1240 | END SELECT |
---|
1241 | |
---|
1242 | IF( istop == nstop ) THEN ! no additional errors until this point... |
---|
1243 | IF(lwp) WRITE(numout,"(10x,' read ',a,' (rec: ',i6,') in ',a,' ok')") TRIM(cdvar), itime, TRIM(iom_file(kiomid)%name) |
---|
1244 | |
---|
1245 | !--- overlap areas and extra hallows (mpp) |
---|
1246 | IF( PRESENT(pv_r2d) .AND. idom /= jpdom_unknown ) THEN |
---|
1247 | CALL lbc_lnk( pv_r2d,'Z',-999.,'no0' ) |
---|
1248 | ELSEIF( PRESENT(pv_r3d) .AND. idom /= jpdom_unknown ) THEN |
---|
1249 | ! this if could be simplified with the new lbc_lnk that works with any size of the 3rd dimension |
---|
1250 | IF( icnt(3) == jpk ) THEN |
---|
1251 | CALL lbc_lnk( pv_r3d,'Z',-999.,'no0' ) |
---|
1252 | ELSE ! put some arbitrary value (a call to lbc_lnk will be done later...) |
---|
1253 | DO jj = nlcj+1, jpj ; pv_r3d(1:nlci, jj, :) = pv_r3d(1:nlci, nlej, :) ; END DO |
---|
1254 | DO ji = nlci+1, jpi ; pv_r3d(ji , : , :) = pv_r3d(nlei , : , :) ; END DO |
---|
1255 | ENDIF |
---|
1256 | ENDIF |
---|
1257 | ! |
---|
1258 | ELSE |
---|
1259 | ! return if istop == nstop is false |
---|
1260 | RETURN |
---|
1261 | ENDIF |
---|
1262 | ELSE |
---|
1263 | ! return if statment idvar > 0 .AND. istop == nstop is false |
---|
1264 | RETURN |
---|
1265 | ENDIF |
---|
1266 | ! |
---|
1267 | ELSE ! read using XIOS. Only if KEY_IOMPUT is defined |
---|
1268 | #if defined key_iomput |
---|
1269 | !would be good to be able to check which context is active and swap only if current is not restart |
---|
1270 | CALL iom_swap( TRIM(crxios_context) ) |
---|
1271 | IF( PRESENT(pv_r3d) ) THEN |
---|
1272 | if(lwp) write(numout,*) 'XIOS RST READ (3D): ',trim(cdvar) |
---|
1273 | CALL xios_recv_field( trim(cdvar), pv_r3d) |
---|
1274 | IF(idom /= jpdom_unknown ) then |
---|
1275 | CALL lbc_lnk( pv_r3d,'Z',-999.,'no0' ) |
---|
1276 | ENDIF |
---|
1277 | ELSEIF( PRESENT(pv_r2d) ) THEN |
---|
1278 | if(lwp) write(numout,*) 'XIOS RST READ (2D): ', trim(cdvar) |
---|
1279 | CALL xios_recv_field( trim(cdvar), pv_r2d) |
---|
1280 | IF(idom /= jpdom_unknown ) THEN |
---|
1281 | CALL lbc_lnk(pv_r2d,'Z',-999.,'no0') |
---|
1282 | ENDIF |
---|
1283 | ELSEIF( PRESENT(pv_r1d) ) THEN |
---|
1284 | if(lwp) write(numout,*) 'XIOS RST READ (1D): ', trim(cdvar) |
---|
1285 | CALL xios_recv_field( trim(cdvar), pv_r1d) |
---|
1286 | ENDIF |
---|
1287 | CALL iom_swap( TRIM(cxios_context) ) |
---|
1288 | #else |
---|
1289 | istop = istop + 1 |
---|
1290 | clinfo = 'Can not use XIOS in iom_get_123d, file: '//trim(clname)//', var:'//trim(cdvar) |
---|
1291 | #endif |
---|
1292 | ENDIF |
---|
1293 | !some final adjustments |
---|
1294 | ! C1D case : always call lbc_lnk to replicate the central value over the whole 3X3 domain |
---|
1295 | IF( lk_c1d .AND. PRESENT(pv_r2d) ) CALL lbc_lnk( pv_r2d,'Z',1. ) |
---|
1296 | IF( lk_c1d .AND. PRESENT(pv_r3d) ) CALL lbc_lnk( pv_r3d,'Z',1. ) |
---|
1297 | |
---|
1298 | !--- Apply scale_factor and offset |
---|
1299 | zscf = iom_file(kiomid)%scf(idvar) ! scale factor |
---|
1300 | zofs = iom_file(kiomid)%ofs(idvar) ! offset |
---|
1301 | IF( PRESENT(pv_r1d) ) THEN |
---|
1302 | IF( zscf /= 1. ) pv_r1d(:) = pv_r1d(:) * zscf |
---|
1303 | IF( zofs /= 0. ) pv_r1d(:) = pv_r1d(:) + zofs |
---|
1304 | ELSEIF( PRESENT(pv_r2d) ) THEN |
---|
1305 | IF( zscf /= 1.) pv_r2d(:,:) = pv_r2d(:,:) * zscf |
---|
1306 | IF( zofs /= 0.) pv_r2d(:,:) = pv_r2d(:,:) + zofs |
---|
1307 | ELSEIF( PRESENT(pv_r3d) ) THEN |
---|
1308 | IF( zscf /= 1.) pv_r3d(:,:,:) = pv_r3d(:,:,:) * zscf |
---|
1309 | IF( zofs /= 0.) pv_r3d(:,:,:) = pv_r3d(:,:,:) + zofs |
---|
1310 | ENDIF |
---|
1311 | END SUBROUTINE iom_get_123d |
---|
1312 | |
---|
1313 | |
---|
1314 | SUBROUTINE iom_gettime( kiomid, ptime, cdvar, kntime, cdunits, cdcalendar ) |
---|
1315 | !!-------------------------------------------------------------------- |
---|
1316 | !! *** SUBROUTINE iom_gettime *** |
---|
1317 | !! |
---|
1318 | !! ** Purpose : read the time axis cdvar in the file |
---|
1319 | !!-------------------------------------------------------------------- |
---|
1320 | INTEGER , INTENT(in ) :: kiomid ! file Identifier |
---|
1321 | REAL(wp), DIMENSION(:) , INTENT( out) :: ptime ! the time axis |
---|
1322 | CHARACTER(len=*), OPTIONAL , INTENT(in ) :: cdvar ! time axis name |
---|
1323 | INTEGER , OPTIONAL , INTENT( out) :: kntime ! number of times in file |
---|
1324 | CHARACTER(len=*), OPTIONAL , INTENT( out) :: cdunits ! units attribute of time coordinate |
---|
1325 | CHARACTER(len=*), OPTIONAL , INTENT( out) :: cdcalendar ! calendar attribute of |
---|
1326 | ! |
---|
1327 | INTEGER, DIMENSION(1) :: kdimsz |
---|
1328 | INTEGER :: idvar ! id of the variable |
---|
1329 | CHARACTER(LEN=32) :: tname ! local name of time coordinate |
---|
1330 | CHARACTER(LEN=100) :: clinfo ! info character |
---|
1331 | !--------------------------------------------------------------------- |
---|
1332 | ! |
---|
1333 | IF ( PRESENT(cdvar) ) THEN |
---|
1334 | tname = cdvar |
---|
1335 | ELSE |
---|
1336 | tname = iom_file(kiomid)%uldname |
---|
1337 | ENDIF |
---|
1338 | IF( kiomid > 0 ) THEN |
---|
1339 | clinfo = 'iom_gettime, file: '//trim(iom_file(kiomid)%name)//', var: '//trim(tname) |
---|
1340 | IF ( PRESENT(kntime) ) THEN |
---|
1341 | idvar = iom_varid( kiomid, tname, kdimsz = kdimsz ) |
---|
1342 | kntime = kdimsz(1) |
---|
1343 | ELSE |
---|
1344 | idvar = iom_varid( kiomid, tname ) |
---|
1345 | ENDIF |
---|
1346 | ! |
---|
1347 | ptime(:) = 0. ! default definition |
---|
1348 | IF( idvar > 0 ) THEN |
---|
1349 | IF( iom_file(kiomid)%ndims(idvar) == 1 ) THEN |
---|
1350 | IF( iom_file(kiomid)%luld(idvar) ) THEN |
---|
1351 | IF( iom_file(kiomid)%dimsz(1,idvar) <= size(ptime) ) THEN |
---|
1352 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
1353 | CASE (jpnf90 ) ; CALL iom_nf90_gettime( kiomid, idvar, ptime, cdunits, cdcalendar ) |
---|
1354 | CASE DEFAULT |
---|
1355 | CALL ctl_stop( TRIM(clinfo)//' accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) |
---|
1356 | END SELECT |
---|
1357 | ELSE |
---|
1358 | WRITE(ctmp1,*) 'error with the size of ptime ',size(ptime),iom_file(kiomid)%dimsz(1,idvar) |
---|
1359 | CALL ctl_stop( trim(clinfo), trim(ctmp1) ) |
---|
1360 | ENDIF |
---|
1361 | ELSE |
---|
1362 | CALL ctl_stop( trim(clinfo), 'variable dimension is not unlimited... use iom_get' ) |
---|
1363 | ENDIF |
---|
1364 | ELSE |
---|
1365 | CALL ctl_stop( trim(clinfo), 'the variable has more than 1 dimension' ) |
---|
1366 | ENDIF |
---|
1367 | ELSE |
---|
1368 | CALL ctl_stop( trim(clinfo), 'variable not found in '//iom_file(kiomid)%name ) |
---|
1369 | ENDIF |
---|
1370 | ENDIF |
---|
1371 | ! |
---|
1372 | END SUBROUTINE iom_gettime |
---|
1373 | |
---|
1374 | |
---|
1375 | !!---------------------------------------------------------------------- |
---|
1376 | !! INTERFACE iom_getatt |
---|
1377 | !!---------------------------------------------------------------------- |
---|
1378 | SUBROUTINE iom_g0d_iatt( kiomid, cdatt, pvar, cdvar ) |
---|
1379 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
1380 | CHARACTER(len=*), INTENT(in ) :: cdatt ! Name of the attribute |
---|
1381 | INTEGER , INTENT( out) :: pvar ! read field |
---|
1382 | CHARACTER(len=*), INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
1383 | ! |
---|
1384 | IF( kiomid > 0 ) THEN |
---|
1385 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
1386 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
1387 | CASE (jpnf90 ) ; IF( PRESENT(cdvar) ) THEN |
---|
1388 | CALL iom_nf90_getatt( kiomid, cdatt, pvar, cdvar=cdvar ) |
---|
1389 | ELSE |
---|
1390 | CALL iom_nf90_getatt( kiomid, cdatt, pvar ) |
---|
1391 | ENDIF |
---|
1392 | CASE DEFAULT |
---|
1393 | CALL ctl_stop( 'iom_g0d_iatt: accepted IO library is only jpnf90' ) |
---|
1394 | END SELECT |
---|
1395 | ENDIF |
---|
1396 | ENDIF |
---|
1397 | END SUBROUTINE iom_g0d_iatt |
---|
1398 | |
---|
1399 | SUBROUTINE iom_g0d_ratt( kiomid, cdatt, pvar, cdvar ) |
---|
1400 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
1401 | CHARACTER(len=*), INTENT(in ) :: cdatt ! Name of the attribute |
---|
1402 | REAL(wp) , INTENT( out) :: pvar ! written field |
---|
1403 | CHARACTER(len=*), INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
1404 | ! |
---|
1405 | IF( kiomid > 0 ) THEN |
---|
1406 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
1407 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
1408 | CASE (jpnf90 ) ; IF( PRESENT(cdvar) ) THEN |
---|
1409 | CALL iom_nf90_getatt( kiomid, cdatt, pvar, cdvar=cdvar ) |
---|
1410 | ELSE |
---|
1411 | CALL iom_nf90_getatt( kiomid, cdatt, pvar ) |
---|
1412 | ENDIF |
---|
1413 | CASE DEFAULT |
---|
1414 | CALL ctl_stop( 'iom_g0d_ratt: accepted IO library is only jpnf90' ) |
---|
1415 | END SELECT |
---|
1416 | ENDIF |
---|
1417 | ENDIF |
---|
1418 | END SUBROUTINE iom_g0d_ratt |
---|
1419 | |
---|
1420 | SUBROUTINE iom_g0d_catt( kiomid, cdatt, pvar, cdvar ) |
---|
1421 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
1422 | CHARACTER(len=*), INTENT(in ) :: cdatt ! Name of the attribute |
---|
1423 | CHARACTER(len=*), INTENT( out) :: pvar ! written field |
---|
1424 | CHARACTER(len=*), INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
1425 | ! |
---|
1426 | IF( kiomid > 0 ) THEN |
---|
1427 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
1428 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
1429 | CASE (jpnf90 ) ; IF( PRESENT(cdvar) ) THEN |
---|
1430 | CALL iom_nf90_getatt( kiomid, cdatt, pvar, cdvar=cdvar ) |
---|
1431 | ELSE |
---|
1432 | CALL iom_nf90_getatt( kiomid, cdatt, pvar ) |
---|
1433 | ENDIF |
---|
1434 | CASE DEFAULT |
---|
1435 | CALL ctl_stop( 'iom_g0d_ratt: accepted IO library is only jpnf90' ) |
---|
1436 | END SELECT |
---|
1437 | ENDIF |
---|
1438 | ENDIF |
---|
1439 | END SUBROUTINE iom_g0d_catt |
---|
1440 | |
---|
1441 | !!---------------------------------------------------------------------- |
---|
1442 | !! INTERFACE iom_putatt |
---|
1443 | !!---------------------------------------------------------------------- |
---|
1444 | SUBROUTINE iom_p0d_iatt( kiomid, cdatt, pvar, cdvar ) |
---|
1445 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
1446 | CHARACTER(len=*), INTENT(in ) :: cdatt ! Name of the attribute |
---|
1447 | INTEGER , INTENT(in ) :: pvar ! write field |
---|
1448 | CHARACTER(len=*), INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
1449 | ! |
---|
1450 | IF( kiomid > 0 ) THEN |
---|
1451 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
1452 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
1453 | CASE (jpnf90 ) ; IF( PRESENT(cdvar) ) THEN |
---|
1454 | CALL iom_nf90_putatt( kiomid, cdatt, pvar, cdvar=cdvar ) |
---|
1455 | ELSE |
---|
1456 | CALL iom_nf90_putatt( kiomid, cdatt, pvar ) |
---|
1457 | ENDIF |
---|
1458 | CASE DEFAULT |
---|
1459 | CALL ctl_stop( 'iom_p0d_iatt: accepted IO library is only jpnf90' ) |
---|
1460 | END SELECT |
---|
1461 | ENDIF |
---|
1462 | ENDIF |
---|
1463 | END SUBROUTINE iom_p0d_iatt |
---|
1464 | |
---|
1465 | SUBROUTINE iom_p0d_ratt( kiomid, cdatt, pvar, cdvar ) |
---|
1466 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
1467 | CHARACTER(len=*), INTENT(in ) :: cdatt ! Name of the attribute |
---|
1468 | REAL(wp) , INTENT(in ) :: pvar ! write field |
---|
1469 | CHARACTER(len=*), INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
1470 | ! |
---|
1471 | IF( kiomid > 0 ) THEN |
---|
1472 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
1473 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
1474 | CASE (jpnf90 ) ; IF( PRESENT(cdvar) ) THEN |
---|
1475 | CALL iom_nf90_putatt( kiomid, cdatt, pvar, cdvar=cdvar ) |
---|
1476 | ELSE |
---|
1477 | CALL iom_nf90_putatt( kiomid, cdatt, pvar ) |
---|
1478 | ENDIF |
---|
1479 | CASE DEFAULT |
---|
1480 | CALL ctl_stop( 'iom_p0d_ratt: accepted IO library is only jpnf90' ) |
---|
1481 | END SELECT |
---|
1482 | ENDIF |
---|
1483 | ENDIF |
---|
1484 | END SUBROUTINE iom_p0d_ratt |
---|
1485 | |
---|
1486 | SUBROUTINE iom_p0d_catt( kiomid, cdatt, pvar, cdvar ) |
---|
1487 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
1488 | CHARACTER(len=*), INTENT(in ) :: cdatt ! Name of the attribute |
---|
1489 | CHARACTER(len=*), INTENT(in ) :: pvar ! write field |
---|
1490 | CHARACTER(len=*), INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
1491 | ! |
---|
1492 | IF( kiomid > 0 ) THEN |
---|
1493 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
1494 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
1495 | CASE (jpnf90 ) ; IF( PRESENT(cdvar) ) THEN |
---|
1496 | CALL iom_nf90_putatt( kiomid, cdatt, pvar, cdvar=cdvar ) |
---|
1497 | ELSE |
---|
1498 | CALL iom_nf90_putatt( kiomid, cdatt, pvar ) |
---|
1499 | ENDIF |
---|
1500 | CASE DEFAULT |
---|
1501 | CALL ctl_stop( 'iom_p0d_ratt: accepted IO library is only jpnf90' ) |
---|
1502 | END SELECT |
---|
1503 | ENDIF |
---|
1504 | ENDIF |
---|
1505 | END SUBROUTINE iom_p0d_catt |
---|
1506 | |
---|
1507 | !!---------------------------------------------------------------------- |
---|
1508 | !! INTERFACE iom_rstput |
---|
1509 | !!---------------------------------------------------------------------- |
---|
1510 | SUBROUTINE iom_rp0d( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) |
---|
1511 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
1512 | INTEGER , INTENT(in) :: kwrite ! writing time-step |
---|
1513 | INTEGER , INTENT(in) :: kiomid ! Identifier of the file |
---|
1514 | CHARACTER(len=*), INTENT(in) :: cdvar ! time axis name |
---|
1515 | REAL(wp) , INTENT(in) :: pvar ! written field |
---|
1516 | INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type |
---|
1517 | LOGICAL, OPTIONAL :: ldxios ! xios write flag |
---|
1518 | LOGICAL :: llx ! local xios write flag |
---|
1519 | INTEGER :: ivid ! variable id |
---|
1520 | |
---|
1521 | llx = .FALSE. |
---|
1522 | IF(PRESENT(ldxios)) llx = ldxios |
---|
1523 | IF( llx ) THEN |
---|
1524 | #ifdef key_iomput |
---|
1525 | IF( kt == kwrite ) THEN |
---|
1526 | IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar) |
---|
1527 | CALL xios_send_field(trim(cdvar), pvar) |
---|
1528 | ENDIF |
---|
1529 | #endif |
---|
1530 | ELSE |
---|
1531 | IF( kiomid > 0 ) THEN |
---|
1532 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
1533 | ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) |
---|
1534 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
1535 | CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r0d = pvar ) |
---|
1536 | CASE DEFAULT |
---|
1537 | CALL ctl_stop( 'iom_rp0d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) |
---|
1538 | END SELECT |
---|
1539 | ENDIF |
---|
1540 | ENDIF |
---|
1541 | ENDIF |
---|
1542 | END SUBROUTINE iom_rp0d |
---|
1543 | |
---|
1544 | SUBROUTINE iom_rp1d( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) |
---|
1545 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
1546 | INTEGER , INTENT(in) :: kwrite ! writing time-step |
---|
1547 | INTEGER , INTENT(in) :: kiomid ! Identifier of the file |
---|
1548 | CHARACTER(len=*), INTENT(in) :: cdvar ! time axis name |
---|
1549 | REAL(wp) , INTENT(in), DIMENSION( :) :: pvar ! written field |
---|
1550 | INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type |
---|
1551 | LOGICAL, OPTIONAL :: ldxios ! xios write flag |
---|
1552 | LOGICAL :: llx ! local xios write flag |
---|
1553 | INTEGER :: ivid ! variable id |
---|
1554 | |
---|
1555 | llx = .FALSE. |
---|
1556 | IF(PRESENT(ldxios)) llx = ldxios |
---|
1557 | IF( llx ) THEN |
---|
1558 | #ifdef key_iomput |
---|
1559 | IF( kt == kwrite ) THEN |
---|
1560 | IF(lwp) write(numout,*) 'RESTART: write (XIOS 1D) ',trim(cdvar) |
---|
1561 | CALL xios_send_field(trim(cdvar), pvar) |
---|
1562 | ENDIF |
---|
1563 | #endif |
---|
1564 | ELSE |
---|
1565 | IF( kiomid > 0 ) THEN |
---|
1566 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
1567 | ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) |
---|
1568 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
1569 | CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r1d = pvar ) |
---|
1570 | CASE DEFAULT |
---|
1571 | CALL ctl_stop( 'iom_rp1d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) |
---|
1572 | END SELECT |
---|
1573 | ENDIF |
---|
1574 | ENDIF |
---|
1575 | ENDIF |
---|
1576 | END SUBROUTINE iom_rp1d |
---|
1577 | |
---|
1578 | SUBROUTINE iom_rp2d( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) |
---|
1579 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
1580 | INTEGER , INTENT(in) :: kwrite ! writing time-step |
---|
1581 | INTEGER , INTENT(in) :: kiomid ! Identifier of the file |
---|
1582 | CHARACTER(len=*), INTENT(in) :: cdvar ! time axis name |
---|
1583 | REAL(wp) , INTENT(in), DIMENSION(:, : ) :: pvar ! written field |
---|
1584 | INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type |
---|
1585 | LOGICAL, OPTIONAL :: ldxios ! xios write flag |
---|
1586 | LOGICAL :: llx |
---|
1587 | INTEGER :: ivid ! variable id |
---|
1588 | |
---|
1589 | llx = .FALSE. |
---|
1590 | IF(PRESENT(ldxios)) llx = ldxios |
---|
1591 | IF( llx ) THEN |
---|
1592 | #ifdef key_iomput |
---|
1593 | IF( kt == kwrite ) THEN |
---|
1594 | IF(lwp) write(numout,*) 'RESTART: write (XIOS 2D) ',trim(cdvar) |
---|
1595 | CALL xios_send_field(trim(cdvar), pvar) |
---|
1596 | ENDIF |
---|
1597 | #endif |
---|
1598 | ELSE |
---|
1599 | IF( kiomid > 0 ) THEN |
---|
1600 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
1601 | ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) |
---|
1602 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
1603 | CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r2d = pvar ) |
---|
1604 | CASE DEFAULT |
---|
1605 | CALL ctl_stop( 'iom_rp2d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) |
---|
1606 | END SELECT |
---|
1607 | ENDIF |
---|
1608 | ENDIF |
---|
1609 | ENDIF |
---|
1610 | END SUBROUTINE iom_rp2d |
---|
1611 | |
---|
1612 | SUBROUTINE iom_rp3d( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) |
---|
1613 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
1614 | INTEGER , INTENT(in) :: kwrite ! writing time-step |
---|
1615 | INTEGER , INTENT(in) :: kiomid ! Identifier of the file |
---|
1616 | CHARACTER(len=*), INTENT(in) :: cdvar ! time axis name |
---|
1617 | REAL(wp) , INTENT(in), DIMENSION(:,:,:) :: pvar ! written field |
---|
1618 | INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type |
---|
1619 | LOGICAL, OPTIONAL :: ldxios ! xios write flag |
---|
1620 | LOGICAL :: llx ! local xios write flag |
---|
1621 | INTEGER :: ivid ! variable id |
---|
1622 | |
---|
1623 | llx = .FALSE. |
---|
1624 | IF(PRESENT(ldxios)) llx = ldxios |
---|
1625 | IF( llx ) THEN |
---|
1626 | #ifdef key_iomput |
---|
1627 | IF( kt == kwrite ) THEN |
---|
1628 | IF(lwp) write(numout,*) 'RESTART: write (XIOS 3D) ',trim(cdvar) |
---|
1629 | CALL xios_send_field(trim(cdvar), pvar) |
---|
1630 | ENDIF |
---|
1631 | #endif |
---|
1632 | ELSE |
---|
1633 | IF( kiomid > 0 ) THEN |
---|
1634 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
1635 | ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) |
---|
1636 | SELECT CASE (iom_file(kiomid)%iolib) |
---|
1637 | CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r3d = pvar ) |
---|
1638 | CASE DEFAULT |
---|
1639 | CALL ctl_stop( 'iom_rp3d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) |
---|
1640 | END SELECT |
---|
1641 | ENDIF |
---|
1642 | ENDIF |
---|
1643 | ENDIF |
---|
1644 | END SUBROUTINE iom_rp3d |
---|
1645 | |
---|
1646 | |
---|
1647 | !!---------------------------------------------------------------------- |
---|
1648 | !! INTERFACE iom_put |
---|
1649 | !!---------------------------------------------------------------------- |
---|
1650 | SUBROUTINE iom_p0d( cdname, pfield0d ) |
---|
1651 | CHARACTER(LEN=*), INTENT(in) :: cdname |
---|
1652 | REAL(wp) , INTENT(in) :: pfield0d |
---|
1653 | REAL(wp) , DIMENSION(jpi,jpj) :: zz ! masson |
---|
1654 | #if defined key_iomput |
---|
1655 | zz(:,:)=pfield0d |
---|
1656 | CALL xios_send_field(cdname, zz) |
---|
1657 | !CALL xios_send_field(cdname, (/pfield0d/)) |
---|
1658 | #else |
---|
1659 | IF( .FALSE. ) WRITE(numout,*) cdname, pfield0d ! useless test to avoid compilation warnings |
---|
1660 | #endif |
---|
1661 | END SUBROUTINE iom_p0d |
---|
1662 | |
---|
1663 | SUBROUTINE iom_p1d( cdname, pfield1d ) |
---|
1664 | CHARACTER(LEN=*) , INTENT(in) :: cdname |
---|
1665 | REAL(wp), DIMENSION(:), INTENT(in) :: pfield1d |
---|
1666 | #if defined key_iomput |
---|
1667 | CALL xios_send_field( cdname, RESHAPE( (/pfield1d/), (/1,1,SIZE(pfield1d)/) ) ) |
---|
1668 | #else |
---|
1669 | IF( .FALSE. ) WRITE(numout,*) cdname, pfield1d ! useless test to avoid compilation warnings |
---|
1670 | #endif |
---|
1671 | END SUBROUTINE iom_p1d |
---|
1672 | |
---|
1673 | SUBROUTINE iom_p2d( cdname, pfield2d ) |
---|
1674 | CHARACTER(LEN=*) , INTENT(in) :: cdname |
---|
1675 | REAL(wp), DIMENSION(:,:), INTENT(in) :: pfield2d |
---|
1676 | #if defined key_iomput |
---|
1677 | CALL xios_send_field(cdname, pfield2d) |
---|
1678 | #else |
---|
1679 | IF( .FALSE. ) WRITE(numout,*) cdname, pfield2d ! useless test to avoid compilation warnings |
---|
1680 | #endif |
---|
1681 | END SUBROUTINE iom_p2d |
---|
1682 | |
---|
1683 | SUBROUTINE iom_p3d( cdname, pfield3d ) |
---|
1684 | CHARACTER(LEN=*) , INTENT(in) :: cdname |
---|
1685 | REAL(wp), DIMENSION(:,:,:), INTENT(in) :: pfield3d |
---|
1686 | #if defined key_iomput |
---|
1687 | CALL xios_send_field(cdname, pfield3d) |
---|
1688 | #else |
---|
1689 | IF( .FALSE. ) WRITE(numout,*) cdname, pfield3d ! useless test to avoid compilation warnings |
---|
1690 | #endif |
---|
1691 | END SUBROUTINE iom_p3d |
---|
1692 | !!---------------------------------------------------------------------- |
---|
1693 | |
---|
1694 | #if defined key_iomput |
---|
1695 | |
---|
1696 | SUBROUTINE iom_set_domain_attr( cdid, ni_glo, nj_glo, ibegin, jbegin, ni, nj, zoom_ibegin, zoom_jbegin, zoom_ni, zoom_nj, & |
---|
1697 | & data_dim, data_ibegin, data_ni, data_jbegin, data_nj, lonvalue, latvalue, mask, & |
---|
1698 | & nvertex, bounds_lon, bounds_lat, area ) |
---|
1699 | CHARACTER(LEN=*) , INTENT(in) :: cdid |
---|
1700 | INTEGER , OPTIONAL, INTENT(in) :: ni_glo, nj_glo, ibegin, jbegin, ni, nj |
---|
1701 | INTEGER , OPTIONAL, INTENT(in) :: data_dim, data_ibegin, data_ni, data_jbegin, data_nj |
---|
1702 | INTEGER , OPTIONAL, INTENT(in) :: zoom_ibegin, zoom_jbegin, zoom_ni, zoom_nj, nvertex |
---|
1703 | REAL(wp), DIMENSION(:) , OPTIONAL, INTENT(in) :: lonvalue, latvalue |
---|
1704 | REAL(wp), DIMENSION(:,:) , OPTIONAL, INTENT(in) :: bounds_lon, bounds_lat, area |
---|
1705 | LOGICAL, DIMENSION(:) , OPTIONAL, INTENT(in) :: mask |
---|
1706 | |
---|
1707 | |
---|
1708 | IF ( xios_is_valid_domain (cdid) ) THEN |
---|
1709 | CALL xios_set_domain_attr ( cdid, ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj, & |
---|
1710 | & data_dim=data_dim, data_ibegin=data_ibegin, data_ni=data_ni, data_jbegin=data_jbegin, data_nj=data_nj , & |
---|
1711 | & lonvalue_1D=lonvalue, latvalue_1D=latvalue, mask_1D=mask, nvertex=nvertex, bounds_lon_1D=bounds_lon, & |
---|
1712 | & bounds_lat_1D=bounds_lat, area=area, type='curvilinear') |
---|
1713 | ENDIF |
---|
1714 | IF ( xios_is_valid_domaingroup(cdid) ) THEN |
---|
1715 | CALL xios_set_domaingroup_attr( cdid, ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj, & |
---|
1716 | & data_dim=data_dim, data_ibegin=data_ibegin, data_ni=data_ni, data_jbegin=data_jbegin, data_nj=data_nj , & |
---|
1717 | & lonvalue_1D=lonvalue, latvalue_1D=latvalue, mask_1D=mask, nvertex=nvertex, bounds_lon_1D=bounds_lon, & |
---|
1718 | & bounds_lat_1D=bounds_lat, area=area, type='curvilinear' ) |
---|
1719 | ENDIF |
---|
1720 | |
---|
1721 | CALL xios_solve_inheritance() |
---|
1722 | |
---|
1723 | END SUBROUTINE iom_set_domain_attr |
---|
1724 | |
---|
1725 | |
---|
1726 | SUBROUTINE iom_set_zoom_domain_attr( cdid, ibegin, jbegin, ni, nj) |
---|
1727 | CHARACTER(LEN=*) , INTENT(in) :: cdid |
---|
1728 | INTEGER , OPTIONAL, INTENT(in) :: ibegin, jbegin, ni, nj |
---|
1729 | |
---|
1730 | IF ( xios_is_valid_zoom_domain (cdid) ) THEN |
---|
1731 | CALL xios_set_zoom_domain_attr ( cdid, ibegin=ibegin, jbegin=jbegin, ni=ni, & |
---|
1732 | & nj=nj) |
---|
1733 | ENDIF |
---|
1734 | END SUBROUTINE iom_set_zoom_domain_attr |
---|
1735 | |
---|
1736 | |
---|
1737 | SUBROUTINE iom_set_axis_attr( cdid, paxis, bounds ) |
---|
1738 | CHARACTER(LEN=*) , INTENT(in) :: cdid |
---|
1739 | REAL(wp), DIMENSION(:) , OPTIONAL, INTENT(in) :: paxis |
---|
1740 | REAL(wp), DIMENSION(:,:), OPTIONAL, INTENT(in) :: bounds |
---|
1741 | |
---|
1742 | IF ( PRESENT(paxis) ) THEN |
---|
1743 | IF ( xios_is_valid_axis (cdid) ) CALL xios_set_axis_attr ( cdid, n_glo=SIZE(paxis), value=paxis ) |
---|
1744 | IF ( xios_is_valid_axisgroup(cdid) ) CALL xios_set_axisgroup_attr( cdid, n_glo=SIZE(paxis), value=paxis ) |
---|
1745 | ENDIF |
---|
1746 | IF ( xios_is_valid_axis (cdid) ) CALL xios_set_axis_attr ( cdid, bounds=bounds ) |
---|
1747 | IF ( xios_is_valid_axisgroup(cdid) ) CALL xios_set_axisgroup_attr( cdid, bounds=bounds ) |
---|
1748 | CALL xios_solve_inheritance() |
---|
1749 | END SUBROUTINE iom_set_axis_attr |
---|
1750 | |
---|
1751 | |
---|
1752 | SUBROUTINE iom_set_field_attr( cdid, freq_op, freq_offset ) |
---|
1753 | CHARACTER(LEN=*) , INTENT(in) :: cdid |
---|
1754 | TYPE(xios_duration),OPTIONAL , INTENT(in) :: freq_op |
---|
1755 | TYPE(xios_duration),OPTIONAL , INTENT(in) :: freq_offset |
---|
1756 | IF ( xios_is_valid_field (cdid) ) CALL xios_set_field_attr & |
---|
1757 | & ( cdid, freq_op=freq_op, freq_offset=freq_offset ) |
---|
1758 | IF ( xios_is_valid_fieldgroup(cdid) ) CALL xios_set_fieldgroup_attr & |
---|
1759 | & ( cdid, freq_op=freq_op, freq_offset=freq_offset ) |
---|
1760 | CALL xios_solve_inheritance() |
---|
1761 | END SUBROUTINE iom_set_field_attr |
---|
1762 | |
---|
1763 | |
---|
1764 | SUBROUTINE iom_set_file_attr( cdid, name, name_suffix ) |
---|
1765 | CHARACTER(LEN=*) , INTENT(in) :: cdid |
---|
1766 | CHARACTER(LEN=*),OPTIONAL , INTENT(in) :: name, name_suffix |
---|
1767 | IF ( xios_is_valid_file (cdid) ) CALL xios_set_file_attr ( cdid, name=name, name_suffix=name_suffix ) |
---|
1768 | IF ( xios_is_valid_filegroup(cdid) ) CALL xios_set_filegroup_attr( cdid, name=name, name_suffix=name_suffix ) |
---|
1769 | CALL xios_solve_inheritance() |
---|
1770 | END SUBROUTINE iom_set_file_attr |
---|
1771 | |
---|
1772 | |
---|
1773 | SUBROUTINE iom_get_file_attr( cdid, name, name_suffix, output_freq ) |
---|
1774 | CHARACTER(LEN=*) , INTENT(in ) :: cdid |
---|
1775 | CHARACTER(LEN=*),OPTIONAL , INTENT(out) :: name, name_suffix |
---|
1776 | TYPE(xios_duration), OPTIONAL , INTENT(out) :: output_freq |
---|
1777 | LOGICAL :: llexist1,llexist2,llexist3 |
---|
1778 | !--------------------------------------------------------------------- |
---|
1779 | IF( PRESENT( name ) ) name = '' ! default values |
---|
1780 | IF( PRESENT( name_suffix ) ) name_suffix = '' |
---|
1781 | IF( PRESENT( output_freq ) ) output_freq = xios_duration(0,0,0,0,0,0) |
---|
1782 | IF ( xios_is_valid_file (cdid) ) THEN |
---|
1783 | CALL xios_solve_inheritance() |
---|
1784 | CALL xios_is_defined_file_attr ( cdid, name = llexist1, name_suffix = llexist2, output_freq = llexist3) |
---|
1785 | IF(llexist1) CALL xios_get_file_attr ( cdid, name = name ) |
---|
1786 | IF(llexist2) CALL xios_get_file_attr ( cdid, name_suffix = name_suffix ) |
---|
1787 | IF(llexist3) CALL xios_get_file_attr ( cdid, output_freq = output_freq ) |
---|
1788 | ENDIF |
---|
1789 | IF ( xios_is_valid_filegroup(cdid) ) THEN |
---|
1790 | CALL xios_solve_inheritance() |
---|
1791 | CALL xios_is_defined_filegroup_attr( cdid, name = llexist1, name_suffix = llexist2, output_freq = llexist3) |
---|
1792 | IF(llexist1) CALL xios_get_filegroup_attr( cdid, name = name ) |
---|
1793 | IF(llexist2) CALL xios_get_filegroup_attr( cdid, name_suffix = name_suffix ) |
---|
1794 | IF(llexist3) CALL xios_get_filegroup_attr( cdid, output_freq = output_freq ) |
---|
1795 | ENDIF |
---|
1796 | END SUBROUTINE iom_get_file_attr |
---|
1797 | |
---|
1798 | |
---|
1799 | SUBROUTINE iom_set_grid_attr( cdid, mask ) |
---|
1800 | CHARACTER(LEN=*) , INTENT(in) :: cdid |
---|
1801 | LOGICAL, DIMENSION(:,:,:), OPTIONAL, INTENT(in) :: mask |
---|
1802 | IF ( xios_is_valid_grid (cdid) ) CALL xios_set_grid_attr ( cdid, mask_3D=mask ) |
---|
1803 | IF ( xios_is_valid_gridgroup(cdid) ) CALL xios_set_gridgroup_attr( cdid, mask_3D=mask ) |
---|
1804 | CALL xios_solve_inheritance() |
---|
1805 | END SUBROUTINE iom_set_grid_attr |
---|
1806 | |
---|
1807 | SUBROUTINE iom_setkt( kt, cdname ) |
---|
1808 | INTEGER , INTENT(in) :: kt |
---|
1809 | CHARACTER(LEN=*), INTENT(in) :: cdname |
---|
1810 | ! |
---|
1811 | CALL iom_swap( cdname ) ! swap to cdname context |
---|
1812 | CALL xios_update_calendar(kt) |
---|
1813 | IF( cdname /= TRIM(cxios_context) ) CALL iom_swap( TRIM(cxios_context) ) ! return back to nemo context |
---|
1814 | ! |
---|
1815 | END SUBROUTINE iom_setkt |
---|
1816 | |
---|
1817 | SUBROUTINE iom_context_finalize( cdname ) |
---|
1818 | CHARACTER(LEN=*), INTENT(in) :: cdname |
---|
1819 | CHARACTER(LEN=120) :: clname |
---|
1820 | ! |
---|
1821 | clname = cdname |
---|
1822 | IF( TRIM(Agrif_CFixed()) .NE. '0' ) clname = TRIM(Agrif_CFixed())//"_"//clname |
---|
1823 | |
---|
1824 | IF( xios_is_valid_context(clname) ) THEN |
---|
1825 | CALL iom_swap( cdname ) ! swap to cdname context |
---|
1826 | CALL xios_context_finalize() ! finalize the context |
---|
1827 | IF( cdname /= TRIM(cxios_context) ) CALL iom_swap( TRIM(cxios_context) ) ! return back to nemo context |
---|
1828 | ENDIF |
---|
1829 | ! |
---|
1830 | END SUBROUTINE iom_context_finalize |
---|
1831 | |
---|
1832 | |
---|
1833 | SUBROUTINE set_grid( cdgrd, plon, plat, ldxios ) |
---|
1834 | !!---------------------------------------------------------------------- |
---|
1835 | !! *** ROUTINE set_grid *** |
---|
1836 | !! |
---|
1837 | !! ** Purpose : define horizontal grids |
---|
1838 | !! |
---|
1839 | !!---------------------------------------------------------------------- |
---|
1840 | CHARACTER(LEN=1) , INTENT(in) :: cdgrd |
---|
1841 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: plon |
---|
1842 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: plat |
---|
1843 | ! |
---|
1844 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: zmask |
---|
1845 | INTEGER :: ni,nj |
---|
1846 | LOGICAL, INTENT(IN) :: ldxios |
---|
1847 | |
---|
1848 | ni=nlei-nldi+1 ; nj=nlej-nldj+1 |
---|
1849 | |
---|
1850 | CALL iom_set_domain_attr("grid_"//cdgrd, ni_glo=jpiglo, nj_glo=jpjglo, ibegin=nimpp+nldi-2, jbegin=njmpp+nldj-2, ni=ni, nj=nj) |
---|
1851 | CALL iom_set_domain_attr("grid_"//cdgrd, data_dim=2, data_ibegin = 1-nldi, data_ni = jpi, data_jbegin = 1-nldj, data_nj = jpj) |
---|
1852 | if(.NOT.ldxios) CALL iom_set_domain_attr("grid_"//cdgrd, lonvalue = RESHAPE(plon(nldi:nlei, nldj:nlej),(/ ni*nj /)), & |
---|
1853 | & latvalue = RESHAPE(plat(nldi:nlei, nldj:nlej),(/ ni*nj /))) |
---|
1854 | |
---|
1855 | IF ( ln_mskland.AND.(.NOT.ldxios) ) THEN |
---|
1856 | ! mask land points, keep values on coast line -> specific mask for U, V and W points |
---|
1857 | SELECT CASE ( cdgrd ) |
---|
1858 | CASE('T') ; zmask(:,:,:) = tmask(:,:,:) |
---|
1859 | CASE('U') ; zmask(2:jpim1,:,:) = tmask(2:jpim1,:,:) + tmask(3:jpi,:,:) ; CALL lbc_lnk( zmask, 'U', 1. ) |
---|
1860 | CASE('V') ; zmask(:,2:jpjm1,:) = tmask(:,2:jpjm1,:) + tmask(:,3:jpj,:) ; CALL lbc_lnk( zmask, 'V', 1. ) |
---|
1861 | CASE('W') ; zmask(:,:,2:jpk ) = tmask(:,:,1:jpkm1) + tmask(:,:,2:jpk) ; zmask(:,:,1) = tmask(:,:,1) |
---|
1862 | END SELECT |
---|
1863 | ! |
---|
1864 | CALL iom_set_domain_attr( "grid_"//cdgrd , mask = RESHAPE(zmask(nldi:nlei,nldj:nlej,1),(/ni*nj /)) /= 0. ) |
---|
1865 | CALL iom_set_grid_attr ( "grid_"//cdgrd//"_3D", mask = RESHAPE(zmask(nldi:nlei,nldj:nlej,:),(/ni,nj,jpk/)) /= 0. ) |
---|
1866 | ENDIF |
---|
1867 | |
---|
1868 | END SUBROUTINE set_grid |
---|
1869 | |
---|
1870 | |
---|
1871 | SUBROUTINE set_grid_bounds( cdgrd, plon_cnr, plat_cnr, plon_pnt, plat_pnt ) |
---|
1872 | !!---------------------------------------------------------------------- |
---|
1873 | !! *** ROUTINE set_grid_bounds *** |
---|
1874 | !! |
---|
1875 | !! ** Purpose : define horizontal grid corners |
---|
1876 | !! |
---|
1877 | !!---------------------------------------------------------------------- |
---|
1878 | CHARACTER(LEN=1) , INTENT(in) :: cdgrd |
---|
1879 | ! |
---|
1880 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: plon_cnr, plat_cnr ! Lat/lon coordinates of a contiguous vertex of cell (i,j) |
---|
1881 | REAL(wp), DIMENSION(jpi,jpj), OPTIONAL, INTENT(in) :: plon_pnt, plat_pnt ! Lat/lon coordinates of the point of cell (i,j) |
---|
1882 | ! |
---|
1883 | REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) :: z_bnds ! Lat/lon coordinates of the vertices of cell (i,j) |
---|
1884 | REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: z_fld ! Working array to determine where to rotate cells |
---|
1885 | REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: z_rot ! Lat/lon working array for rotation of cells |
---|
1886 | ! |
---|
1887 | INTEGER :: icnr, jcnr ! Offset such that the vertex coordinate (i+icnr,j+jcnr) |
---|
1888 | ! ! represents the bottom-left corner of cell (i,j) |
---|
1889 | INTEGER :: ji, jj, jn, ni, nj |
---|
1890 | |
---|
1891 | ALLOCATE( z_bnds(4,jpi,jpj,2), z_fld(jpi,jpj), z_rot(4,2) ) |
---|
1892 | |
---|
1893 | ! Offset of coordinate representing bottom-left corner |
---|
1894 | SELECT CASE ( TRIM(cdgrd) ) |
---|
1895 | CASE ('T', 'W', 'N') |
---|
1896 | icnr = -1 ; jcnr = -1 |
---|
1897 | CASE ('U') |
---|
1898 | icnr = 0 ; jcnr = -1 |
---|
1899 | CASE ('V') |
---|
1900 | icnr = -1 ; jcnr = 0 |
---|
1901 | END SELECT |
---|
1902 | |
---|
1903 | ni = nlei-nldi+1 ; nj = nlej-nldj+1 ! Dimensions of subdomain interior |
---|
1904 | |
---|
1905 | z_fld(:,:) = 1._wp |
---|
1906 | CALL lbc_lnk( z_fld, cdgrd, -1. ) ! Working array for location of northfold |
---|
1907 | |
---|
1908 | ! Cell vertices that can be defined |
---|
1909 | DO jj = 2, jpjm1 |
---|
1910 | DO ji = 2, jpim1 |
---|
1911 | z_bnds(1,ji,jj,1) = plat_cnr(ji+icnr, jj+jcnr ) ! Bottom-left |
---|
1912 | z_bnds(2,ji,jj,1) = plat_cnr(ji+icnr+1,jj+jcnr ) ! Bottom-right |
---|
1913 | z_bnds(3,ji,jj,1) = plat_cnr(ji+icnr+1,jj+jcnr+1) ! Top-right |
---|
1914 | z_bnds(4,ji,jj,1) = plat_cnr(ji+icnr, jj+jcnr+1) ! Top-left |
---|
1915 | z_bnds(1,ji,jj,2) = plon_cnr(ji+icnr, jj+jcnr ) ! Bottom-left |
---|
1916 | z_bnds(2,ji,jj,2) = plon_cnr(ji+icnr+1,jj+jcnr ) ! Bottom-right |
---|
1917 | z_bnds(3,ji,jj,2) = plon_cnr(ji+icnr+1,jj+jcnr+1) ! Top-right |
---|
1918 | z_bnds(4,ji,jj,2) = plon_cnr(ji+icnr, jj+jcnr+1) ! Top-left |
---|
1919 | END DO |
---|
1920 | END DO |
---|
1921 | |
---|
1922 | ! Cell vertices on boundries |
---|
1923 | DO jn = 1, 4 |
---|
1924 | CALL lbc_lnk( z_bnds(jn,:,:,1), cdgrd, 1., pval=999._wp ) |
---|
1925 | CALL lbc_lnk( z_bnds(jn,:,:,2), cdgrd, 1., pval=999._wp ) |
---|
1926 | END DO |
---|
1927 | |
---|
1928 | ! Zero-size cells at closed boundaries if cell points provided, |
---|
1929 | ! otherwise they are closed cells with unrealistic bounds |
---|
1930 | IF( PRESENT(plon_pnt) .AND. PRESENT(plat_pnt) ) THEN |
---|
1931 | IF( (nbondi == -1 .OR. nbondi == 2) .AND. .NOT. (jperio == 1 .OR. jperio == 4 .OR. jperio == 6) ) THEN |
---|
1932 | DO jn = 1, 4 ! (West or jpni = 1), closed E-W |
---|
1933 | z_bnds(jn,1,:,1) = plat_pnt(1,:) ; z_bnds(jn,1,:,2) = plon_pnt(1,:) |
---|
1934 | END DO |
---|
1935 | ENDIF |
---|
1936 | IF( (nbondi == 1 .OR. nbondi == 2) .AND. .NOT. (jperio == 1 .OR. jperio == 4 .OR. jperio == 6) ) THEN |
---|
1937 | DO jn = 1, 4 ! (East or jpni = 1), closed E-W |
---|
1938 | z_bnds(jn,nlci,:,1) = plat_pnt(nlci,:) ; z_bnds(jn,nlci,:,2) = plon_pnt(nlci,:) |
---|
1939 | END DO |
---|
1940 | ENDIF |
---|
1941 | IF( nbondj == -1 .OR. (nbondj == 2 .AND. jperio /= 2) ) THEN |
---|
1942 | DO jn = 1, 4 ! South or (jpnj = 1, not symmetric) |
---|
1943 | z_bnds(jn,:,1,1) = plat_pnt(:,1) ; z_bnds(jn,:,1,2) = plon_pnt(:,1) |
---|
1944 | END DO |
---|
1945 | ENDIF |
---|
1946 | IF( (nbondj == 1 .OR. nbondj == 2) .AND. jperio < 3 ) THEN |
---|
1947 | DO jn = 1, 4 ! (North or jpnj = 1), no north fold |
---|
1948 | z_bnds(jn,:,nlcj,1) = plat_pnt(:,nlcj) ; z_bnds(jn,:,nlcj,2) = plon_pnt(:,nlcj) |
---|
1949 | END DO |
---|
1950 | ENDIF |
---|
1951 | ENDIF |
---|
1952 | |
---|
1953 | ! Rotate cells at the north fold |
---|
1954 | IF( (nbondj == 1 .OR. nbondj == 2) .AND. jperio >= 3 ) THEN |
---|
1955 | DO jj = 1, jpj |
---|
1956 | DO ji = 1, jpi |
---|
1957 | IF( z_fld(ji,jj) == -1. ) THEN |
---|
1958 | z_rot(1,:) = z_bnds(3,ji,jj,:) ; z_rot(2,:) = z_bnds(4,ji,jj,:) |
---|
1959 | z_rot(3,:) = z_bnds(1,ji,jj,:) ; z_rot(4,:) = z_bnds(2,ji,jj,:) |
---|
1960 | z_bnds(:,ji,jj,:) = z_rot(:,:) |
---|
1961 | ENDIF |
---|
1962 | END DO |
---|
1963 | END DO |
---|
1964 | |
---|
1965 | ! Invert cells at the symmetric equator |
---|
1966 | ELSE IF( nbondj == 2 .AND. jperio == 2 ) THEN |
---|
1967 | DO ji = 1, jpi |
---|
1968 | z_rot(1:2,:) = z_bnds(3:4,ji,1,:) |
---|
1969 | z_rot(3:4,:) = z_bnds(1:2,ji,1,:) |
---|
1970 | z_bnds(:,ji,1,:) = z_rot(:,:) |
---|
1971 | END DO |
---|
1972 | ENDIF |
---|
1973 | |
---|
1974 | CALL iom_set_domain_attr("grid_"//cdgrd, bounds_lat = RESHAPE(z_bnds(:,nldi:nlei,nldj:nlej,1),(/ 4,ni*nj /)), & |
---|
1975 | bounds_lon = RESHAPE(z_bnds(:,nldi:nlei,nldj:nlej,2),(/ 4,ni*nj /)), nvertex=4 ) |
---|
1976 | |
---|
1977 | DEALLOCATE( z_bnds, z_fld, z_rot ) |
---|
1978 | |
---|
1979 | END SUBROUTINE set_grid_bounds |
---|
1980 | |
---|
1981 | |
---|
1982 | SUBROUTINE set_grid_znl( plat ) |
---|
1983 | !!---------------------------------------------------------------------- |
---|
1984 | !! *** ROUTINE set_grid_znl *** |
---|
1985 | !! |
---|
1986 | !! ** Purpose : define grids for zonal mean |
---|
1987 | !! |
---|
1988 | !!---------------------------------------------------------------------- |
---|
1989 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: plat |
---|
1990 | ! |
---|
1991 | REAL(wp), DIMENSION(:), ALLOCATABLE :: zlon |
---|
1992 | INTEGER :: ni,nj, ix, iy |
---|
1993 | |
---|
1994 | |
---|
1995 | ni=nlei-nldi+1 ; nj=nlej-nldj+1 ! define zonal mean domain (jpj*jpk) |
---|
1996 | ALLOCATE( zlon(ni*nj) ) ; zlon(:) = 0. |
---|
1997 | |
---|
1998 | CALL dom_ngb( -168.53, 65.03, ix, iy, 'T' ) ! i-line that passes through Bering Strait: Reference latitude (used in plots) |
---|
1999 | CALL iom_set_domain_attr("gznl", ni_glo=jpiglo, nj_glo=jpjglo, ibegin=nimpp+nldi-2, jbegin=njmpp+nldj-2, ni=ni, nj=nj) |
---|
2000 | CALL iom_set_domain_attr("gznl", data_dim=2, data_ibegin = 1-nldi, data_ni = jpi, data_jbegin = 1-nldj, data_nj = jpj) |
---|
2001 | CALL iom_set_domain_attr("gznl", lonvalue = zlon, & |
---|
2002 | & latvalue = RESHAPE(plat(nldi:nlei, nldj:nlej),(/ ni*nj /))) |
---|
2003 | CALL iom_set_zoom_domain_attr ("ptr", ibegin=ix-1, jbegin=0, ni=1, nj=jpjglo) |
---|
2004 | ! |
---|
2005 | CALL iom_update_file_name('ptr') |
---|
2006 | ! |
---|
2007 | END SUBROUTINE set_grid_znl |
---|
2008 | |
---|
2009 | SUBROUTINE set_scalar |
---|
2010 | !!---------------------------------------------------------------------- |
---|
2011 | !! *** ROUTINE set_scalar *** |
---|
2012 | !! |
---|
2013 | !! ** Purpose : define fake grids for scalar point |
---|
2014 | !! |
---|
2015 | !!---------------------------------------------------------------------- |
---|
2016 | REAL(wp), DIMENSION(1) :: zz = 1. |
---|
2017 | !!---------------------------------------------------------------------- |
---|
2018 | |
---|
2019 | CALL iom_set_domain_attr('scalarpoint', ni_glo=jpnij, nj_glo=1, ibegin=narea-1, jbegin=0, ni=1, nj=1) |
---|
2020 | CALL iom_set_domain_attr('scalarpoint', data_dim=2, data_ibegin = 1, data_ni = 1, data_jbegin = 1, data_nj = 1) |
---|
2021 | |
---|
2022 | zz=REAL(narea,wp) |
---|
2023 | CALL iom_set_domain_attr('scalarpoint', lonvalue=zz, latvalue=zz) |
---|
2024 | |
---|
2025 | END SUBROUTINE set_scalar |
---|
2026 | |
---|
2027 | |
---|
2028 | SUBROUTINE set_xmlatt |
---|
2029 | !!---------------------------------------------------------------------- |
---|
2030 | !! *** ROUTINE set_xmlatt *** |
---|
2031 | !! |
---|
2032 | !! ** Purpose : automatic definitions of some of the xml attributs... |
---|
2033 | !! |
---|
2034 | !!---------------------------------------------------------------------- |
---|
2035 | CHARACTER(len=1),DIMENSION( 3) :: clgrd ! suffix name |
---|
2036 | CHARACTER(len=256) :: clsuff ! suffix name |
---|
2037 | CHARACTER(len=1) :: cl1 ! 1 character |
---|
2038 | CHARACTER(len=2) :: cl2 ! 2 characters |
---|
2039 | CHARACTER(len=3) :: cl3 ! 3 characters |
---|
2040 | INTEGER :: ji, jg ! loop counters |
---|
2041 | INTEGER :: ix, iy ! i-,j- index |
---|
2042 | REAL(wp) ,DIMENSION(11) :: zlontao ! longitudes of tao moorings |
---|
2043 | REAL(wp) ,DIMENSION( 7) :: zlattao ! latitudes of tao moorings |
---|
2044 | REAL(wp) ,DIMENSION( 4) :: zlonrama ! longitudes of rama moorings |
---|
2045 | REAL(wp) ,DIMENSION(11) :: zlatrama ! latitudes of rama moorings |
---|
2046 | REAL(wp) ,DIMENSION( 3) :: zlonpira ! longitudes of pirata moorings |
---|
2047 | REAL(wp) ,DIMENSION( 9) :: zlatpira ! latitudes of pirata moorings |
---|
2048 | TYPE(xios_duration) :: f_op, f_of |
---|
2049 | !!---------------------------------------------------------------------- |
---|
2050 | ! |
---|
2051 | ! frequency of the call of iom_put (attribut: freq_op) |
---|
2052 | f_op%timestep = 1 ; f_of%timestep = 0 ; CALL iom_set_field_attr('field_definition', freq_op=f_op, freq_offset=f_of) |
---|
2053 | f_op%timestep = 2 ; f_of%timestep = 0 ; CALL iom_set_field_attr('trendT_even' , freq_op=f_op, freq_offset=f_of) |
---|
2054 | f_op%timestep = 2 ; f_of%timestep = -1 ; CALL iom_set_field_attr('trendT_odd' , freq_op=f_op, freq_offset=f_of) |
---|
2055 | f_op%timestep = nn_fsbc ; f_of%timestep = 0 ; CALL iom_set_field_attr('SBC' , freq_op=f_op, freq_offset=f_of) |
---|
2056 | f_op%timestep = nn_fsbc ; f_of%timestep = 0 ; CALL iom_set_field_attr('SBC_scalar' , freq_op=f_op, freq_offset=f_of) |
---|
2057 | f_op%timestep = nn_dttrc ; f_of%timestep = 0 ; CALL iom_set_field_attr('ptrc_T' , freq_op=f_op, freq_offset=f_of) |
---|
2058 | f_op%timestep = nn_dttrc ; f_of%timestep = 0 ; CALL iom_set_field_attr('diad_T' , freq_op=f_op, freq_offset=f_of) |
---|
2059 | |
---|
2060 | ! output file names (attribut: name) |
---|
2061 | DO ji = 1, 9 |
---|
2062 | WRITE(cl1,'(i1)') ji |
---|
2063 | CALL iom_update_file_name('file'//cl1) |
---|
2064 | END DO |
---|
2065 | DO ji = 1, 99 |
---|
2066 | WRITE(cl2,'(i2.2)') ji |
---|
2067 | CALL iom_update_file_name('file'//cl2) |
---|
2068 | END DO |
---|
2069 | DO ji = 1, 999 |
---|
2070 | WRITE(cl3,'(i3.3)') ji |
---|
2071 | CALL iom_update_file_name('file'//cl3) |
---|
2072 | END DO |
---|
2073 | |
---|
2074 | ! Zooms... |
---|
2075 | clgrd = (/ 'T', 'U', 'W' /) |
---|
2076 | DO jg = 1, SIZE(clgrd) ! grid type |
---|
2077 | cl1 = clgrd(jg) |
---|
2078 | ! Equatorial section (attributs: jbegin, ni, name_suffix) |
---|
2079 | CALL dom_ngb( 0., 0., ix, iy, cl1 ) |
---|
2080 | CALL iom_set_zoom_domain_attr ('Eq'//cl1, jbegin=iy-1, ni=jpiglo) |
---|
2081 | CALL iom_get_file_attr ('Eq'//cl1, name_suffix = clsuff ) |
---|
2082 | CALL iom_set_file_attr ('Eq'//cl1, name_suffix = TRIM(clsuff)//'_Eq') |
---|
2083 | CALL iom_update_file_name('Eq'//cl1) |
---|
2084 | END DO |
---|
2085 | ! TAO moorings (attributs: ibegin, jbegin, name_suffix) |
---|
2086 | zlontao = (/ 137.0, 147.0, 156.0, 165.0, -180.0, -170.0, -155.0, -140.0, -125.0, -110.0, -95.0 /) |
---|
2087 | zlattao = (/ -8.0, -5.0, -2.0, 0.0, 2.0, 5.0, 8.0 /) |
---|
2088 | CALL set_mooring( zlontao, zlattao ) |
---|
2089 | ! RAMA moorings (attributs: ibegin, jbegin, name_suffix) |
---|
2090 | zlonrama = (/ 55.0, 67.0, 80.5, 90.0 /) |
---|
2091 | zlatrama = (/ -16.0, -12.0, -8.0, -4.0, -1.5, 0.0, 1.5, 4.0, 8.0, 12.0, 15.0 /) |
---|
2092 | CALL set_mooring( zlonrama, zlatrama ) |
---|
2093 | ! PIRATA moorings (attributs: ibegin, jbegin, name_suffix) |
---|
2094 | zlonpira = (/ -38.0, -23.0, -10.0 /) |
---|
2095 | zlatpira = (/ -19.0, -14.0, -8.0, 0.0, 4.0, 8.0, 12.0, 15.0, 20.0 /) |
---|
2096 | CALL set_mooring( zlonpira, zlatpira ) |
---|
2097 | |
---|
2098 | |
---|
2099 | END SUBROUTINE set_xmlatt |
---|
2100 | |
---|
2101 | |
---|
2102 | SUBROUTINE set_mooring( plon, plat) |
---|
2103 | !!---------------------------------------------------------------------- |
---|
2104 | !! *** ROUTINE set_mooring *** |
---|
2105 | !! |
---|
2106 | !! ** Purpose : automatic definitions of moorings xml attributs... |
---|
2107 | !! |
---|
2108 | !!---------------------------------------------------------------------- |
---|
2109 | REAL(wp), DIMENSION(:), INTENT(in) :: plon, plat ! longitudes/latitudes oft the mooring |
---|
2110 | ! |
---|
2111 | !!$ CHARACTER(len=1),DIMENSION(4) :: clgrd = (/ 'T', 'U', 'V', 'W' /) ! suffix name |
---|
2112 | CHARACTER(len=1),DIMENSION(1) :: clgrd = (/ 'T' /) ! suffix name |
---|
2113 | CHARACTER(len=256) :: clname ! file name |
---|
2114 | CHARACTER(len=256) :: clsuff ! suffix name |
---|
2115 | CHARACTER(len=1) :: cl1 ! 1 character |
---|
2116 | CHARACTER(len=6) :: clon,clat ! name of longitude, latitude |
---|
2117 | INTEGER :: ji, jj, jg ! loop counters |
---|
2118 | INTEGER :: ix, iy ! i-,j- index |
---|
2119 | REAL(wp) :: zlon, zlat |
---|
2120 | !!---------------------------------------------------------------------- |
---|
2121 | DO jg = 1, SIZE(clgrd) |
---|
2122 | cl1 = clgrd(jg) |
---|
2123 | DO ji = 1, SIZE(plon) |
---|
2124 | DO jj = 1, SIZE(plat) |
---|
2125 | zlon = plon(ji) |
---|
2126 | zlat = plat(jj) |
---|
2127 | ! modifications for RAMA moorings |
---|
2128 | IF( zlon == 67. .AND. zlat == 15. ) zlon = 65. |
---|
2129 | IF( zlon == 90. .AND. zlat <= -4. ) zlon = 95. |
---|
2130 | IF( zlon == 95. .AND. zlat == -4. ) zlat = -5. |
---|
2131 | ! modifications for PIRATA moorings |
---|
2132 | IF( zlon == -38. .AND. zlat == -19. ) zlon = -34. |
---|
2133 | IF( zlon == -38. .AND. zlat == -14. ) zlon = -32. |
---|
2134 | IF( zlon == -38. .AND. zlat == -8. ) zlon = -30. |
---|
2135 | IF( zlon == -38. .AND. zlat == 0. ) zlon = -35. |
---|
2136 | IF( zlon == -23. .AND. zlat == 20. ) zlat = 21. |
---|
2137 | IF( zlon == -10. .AND. zlat == -14. ) zlat = -10. |
---|
2138 | IF( zlon == -10. .AND. zlat == -8. ) zlat = -6. |
---|
2139 | IF( zlon == -10. .AND. zlat == 4. ) THEN ; zlon = 0. ; zlat = 0. ; ENDIF |
---|
2140 | CALL dom_ngb( zlon, zlat, ix, iy, cl1 ) |
---|
2141 | IF( zlon >= 0. ) THEN |
---|
2142 | IF( zlon == REAL(NINT(zlon), wp) ) THEN ; WRITE(clon, '(i3, a)') NINT( zlon), 'e' |
---|
2143 | ELSE ; WRITE(clon, '(f5.1,a)') zlon , 'e' |
---|
2144 | ENDIF |
---|
2145 | ELSE |
---|
2146 | IF( zlon == REAL(NINT(zlon), wp) ) THEN ; WRITE(clon, '(i3, a)') NINT(-zlon), 'w' |
---|
2147 | ELSE ; WRITE(clon, '(f5.1,a)') -zlon , 'w' |
---|
2148 | ENDIF |
---|
2149 | ENDIF |
---|
2150 | IF( zlat >= 0. ) THEN |
---|
2151 | IF( zlat == REAL(NINT(zlat), wp) ) THEN ; WRITE(clat, '(i2, a)') NINT( zlat), 'n' |
---|
2152 | ELSE ; WRITE(clat, '(f4.1,a)') zlat , 'n' |
---|
2153 | ENDIF |
---|
2154 | ELSE |
---|
2155 | IF( zlat == REAL(NINT(zlat), wp) ) THEN ; WRITE(clat, '(i2, a)') NINT(-zlat), 's' |
---|
2156 | ELSE ; WRITE(clat, '(f4.1,a)') -zlat , 's' |
---|
2157 | ENDIF |
---|
2158 | ENDIF |
---|
2159 | clname = TRIM(ADJUSTL(clat))//TRIM(ADJUSTL(clon)) |
---|
2160 | CALL iom_set_zoom_domain_attr (TRIM(clname)//cl1, ibegin= ix-1, jbegin= iy-1) |
---|
2161 | |
---|
2162 | CALL iom_get_file_attr (TRIM(clname)//cl1, name_suffix = clsuff ) |
---|
2163 | CALL iom_set_file_attr (TRIM(clname)//cl1, name_suffix = TRIM(clsuff)//'_'//TRIM(clname)) |
---|
2164 | CALL iom_update_file_name(TRIM(clname)//cl1) |
---|
2165 | END DO |
---|
2166 | END DO |
---|
2167 | END DO |
---|
2168 | |
---|
2169 | END SUBROUTINE set_mooring |
---|
2170 | |
---|
2171 | |
---|
2172 | SUBROUTINE iom_update_file_name( cdid ) |
---|
2173 | !!---------------------------------------------------------------------- |
---|
2174 | !! *** ROUTINE iom_update_file_name *** |
---|
2175 | !! |
---|
2176 | !! ** Purpose : |
---|
2177 | !! |
---|
2178 | !!---------------------------------------------------------------------- |
---|
2179 | CHARACTER(LEN=*) , INTENT(in) :: cdid |
---|
2180 | ! |
---|
2181 | CHARACTER(LEN=256) :: clname |
---|
2182 | CHARACTER(LEN=20) :: clfreq |
---|
2183 | CHARACTER(LEN=20) :: cldate |
---|
2184 | INTEGER :: idx |
---|
2185 | INTEGER :: jn |
---|
2186 | INTEGER :: itrlen |
---|
2187 | INTEGER :: iyear, imonth, iday, isec |
---|
2188 | REAL(wp) :: zsec |
---|
2189 | LOGICAL :: llexist |
---|
2190 | TYPE(xios_duration) :: output_freq |
---|
2191 | !!---------------------------------------------------------------------- |
---|
2192 | |
---|
2193 | DO jn = 1,2 |
---|
2194 | |
---|
2195 | output_freq = xios_duration(0,0,0,0,0,0) |
---|
2196 | IF( jn == 1 ) CALL iom_get_file_attr( cdid, name = clname, output_freq = output_freq ) |
---|
2197 | IF( jn == 2 ) CALL iom_get_file_attr( cdid, name_suffix = clname ) |
---|
2198 | |
---|
2199 | IF ( TRIM(clname) /= '' ) THEN |
---|
2200 | |
---|
2201 | idx = INDEX(clname,'@expname@') + INDEX(clname,'@EXPNAME@') |
---|
2202 | DO WHILE ( idx /= 0 ) |
---|
2203 | clname = clname(1:idx-1)//TRIM(cexper)//clname(idx+9:LEN_TRIM(clname)) |
---|
2204 | idx = INDEX(clname,'@expname@') + INDEX(clname,'@EXPNAME@') |
---|
2205 | END DO |
---|
2206 | |
---|
2207 | idx = INDEX(clname,'@freq@') + INDEX(clname,'@FREQ@') |
---|
2208 | DO WHILE ( idx /= 0 ) |
---|
2209 | IF ( output_freq%timestep /= 0) THEN |
---|
2210 | WRITE(clfreq,'(I18,A2)')INT(output_freq%timestep),'ts' |
---|
2211 | itrlen = LEN_TRIM(ADJUSTL(clfreq)) |
---|
2212 | ELSE IF ( output_freq%second /= 0 ) THEN |
---|
2213 | WRITE(clfreq,'(I19,A1)')INT(output_freq%second),'s' |
---|
2214 | itrlen = LEN_TRIM(ADJUSTL(clfreq)) |
---|
2215 | ELSE IF ( output_freq%minute /= 0 ) THEN |
---|
2216 | WRITE(clfreq,'(I18,A2)')INT(output_freq%minute),'mi' |
---|
2217 | itrlen = LEN_TRIM(ADJUSTL(clfreq)) |
---|
2218 | ELSE IF ( output_freq%hour /= 0 ) THEN |
---|
2219 | WRITE(clfreq,'(I19,A1)')INT(output_freq%hour),'h' |
---|
2220 | itrlen = LEN_TRIM(ADJUSTL(clfreq)) |
---|
2221 | ELSE IF ( output_freq%day /= 0 ) THEN |
---|
2222 | WRITE(clfreq,'(I19,A1)')INT(output_freq%day),'d' |
---|
2223 | itrlen = LEN_TRIM(ADJUSTL(clfreq)) |
---|
2224 | ELSE IF ( output_freq%month /= 0 ) THEN |
---|
2225 | WRITE(clfreq,'(I19,A1)')INT(output_freq%month),'m' |
---|
2226 | itrlen = LEN_TRIM(ADJUSTL(clfreq)) |
---|
2227 | ELSE IF ( output_freq%year /= 0 ) THEN |
---|
2228 | WRITE(clfreq,'(I19,A1)')INT(output_freq%year),'y' |
---|
2229 | itrlen = LEN_TRIM(ADJUSTL(clfreq)) |
---|
2230 | ELSE |
---|
2231 | CALL ctl_stop('error in the name of file id '//TRIM(cdid), & |
---|
2232 | & ' attribute output_freq is undefined -> cannot replace @freq@ in '//TRIM(clname) ) |
---|
2233 | ENDIF |
---|
2234 | clname = clname(1:idx-1)//TRIM(ADJUSTL(clfreq))//clname(idx+6:LEN_TRIM(clname)) |
---|
2235 | idx = INDEX(clname,'@freq@') + INDEX(clname,'@FREQ@') |
---|
2236 | END DO |
---|
2237 | |
---|
2238 | idx = INDEX(clname,'@startdate@') + INDEX(clname,'@STARTDATE@') |
---|
2239 | DO WHILE ( idx /= 0 ) |
---|
2240 | cldate = iom_sdate( fjulday - rdt / rday ) |
---|
2241 | clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+11:LEN_TRIM(clname)) |
---|
2242 | idx = INDEX(clname,'@startdate@') + INDEX(clname,'@STARTDATE@') |
---|
2243 | END DO |
---|
2244 | |
---|
2245 | idx = INDEX(clname,'@startdatefull@') + INDEX(clname,'@STARTDATEFULL@') |
---|
2246 | DO WHILE ( idx /= 0 ) |
---|
2247 | cldate = iom_sdate( fjulday - rdt / rday, ldfull = .TRUE. ) |
---|
2248 | clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+15:LEN_TRIM(clname)) |
---|
2249 | idx = INDEX(clname,'@startdatefull@') + INDEX(clname,'@STARTDATEFULL@') |
---|
2250 | END DO |
---|
2251 | |
---|
2252 | idx = INDEX(clname,'@enddate@') + INDEX(clname,'@ENDDATE@') |
---|
2253 | DO WHILE ( idx /= 0 ) |
---|
2254 | cldate = iom_sdate( fjulday + rdt / rday * REAL( nitend - nit000, wp ), ld24 = .TRUE. ) |
---|
2255 | clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+9:LEN_TRIM(clname)) |
---|
2256 | idx = INDEX(clname,'@enddate@') + INDEX(clname,'@ENDDATE@') |
---|
2257 | END DO |
---|
2258 | |
---|
2259 | idx = INDEX(clname,'@enddatefull@') + INDEX(clname,'@ENDDATEFULL@') |
---|
2260 | DO WHILE ( idx /= 0 ) |
---|
2261 | cldate = iom_sdate( fjulday + rdt / rday * REAL( nitend - nit000, wp ), ld24 = .TRUE., ldfull = .TRUE. ) |
---|
2262 | clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+13:LEN_TRIM(clname)) |
---|
2263 | idx = INDEX(clname,'@enddatefull@') + INDEX(clname,'@ENDDATEFULL@') |
---|
2264 | END DO |
---|
2265 | |
---|
2266 | IF( jn == 1 .AND. TRIM(Agrif_CFixed()) /= '0' ) clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname) |
---|
2267 | IF( jn == 1 ) CALL iom_set_file_attr( cdid, name = clname ) |
---|
2268 | IF( jn == 2 ) CALL iom_set_file_attr( cdid, name_suffix = clname ) |
---|
2269 | |
---|
2270 | ENDIF |
---|
2271 | |
---|
2272 | END DO |
---|
2273 | |
---|
2274 | END SUBROUTINE iom_update_file_name |
---|
2275 | |
---|
2276 | |
---|
2277 | FUNCTION iom_sdate( pjday, ld24, ldfull ) |
---|
2278 | !!---------------------------------------------------------------------- |
---|
2279 | !! *** ROUTINE iom_sdate *** |
---|
2280 | !! |
---|
2281 | !! ** Purpose : send back the date corresponding to the given julian day |
---|
2282 | !! |
---|
2283 | !!---------------------------------------------------------------------- |
---|
2284 | REAL(wp), INTENT(in ) :: pjday ! julian day |
---|
2285 | LOGICAL , INTENT(in ), OPTIONAL :: ld24 ! true to force 24:00 instead of 00:00 |
---|
2286 | LOGICAL , INTENT(in ), OPTIONAL :: ldfull ! true to get the compleate date: yyyymmdd_hh:mm:ss |
---|
2287 | ! |
---|
2288 | CHARACTER(LEN=20) :: iom_sdate |
---|
2289 | CHARACTER(LEN=50) :: clfmt ! format used to write the date |
---|
2290 | INTEGER :: iyear, imonth, iday, ihour, iminute, isec |
---|
2291 | REAL(wp) :: zsec |
---|
2292 | LOGICAL :: ll24, llfull |
---|
2293 | ! |
---|
2294 | IF( PRESENT(ld24) ) THEN ; ll24 = ld24 |
---|
2295 | ELSE ; ll24 = .FALSE. |
---|
2296 | ENDIF |
---|
2297 | |
---|
2298 | IF( PRESENT(ldfull) ) THEN ; llfull = ldfull |
---|
2299 | ELSE ; llfull = .FALSE. |
---|
2300 | ENDIF |
---|
2301 | |
---|
2302 | CALL ju2ymds( pjday, iyear, imonth, iday, zsec ) |
---|
2303 | isec = NINT(zsec) |
---|
2304 | |
---|
2305 | IF ( ll24 .AND. isec == 0 ) THEN ! 00:00 of the next day -> move to 24:00 of the current day |
---|
2306 | CALL ju2ymds( pjday - 1., iyear, imonth, iday, zsec ) |
---|
2307 | isec = 86400 |
---|
2308 | ENDIF |
---|
2309 | |
---|
2310 | IF( iyear < 10000 ) THEN ; clfmt = "i4.4,2i2.2" ! format used to write the date |
---|
2311 | ELSE ; WRITE(clfmt, "('i',i1,',2i2.2')") INT(LOG10(REAL(iyear,wp))) + 1 |
---|
2312 | ENDIF |
---|
2313 | |
---|
2314 | !$AGRIF_DO_NOT_TREAT |
---|
2315 | ! Should be fixed in the conv |
---|
2316 | IF( llfull ) THEN |
---|
2317 | clfmt = TRIM(clfmt)//",'_',i2.2,':',i2.2,':',i2.2" |
---|
2318 | ihour = isec / 3600 |
---|
2319 | isec = MOD(isec, 3600) |
---|
2320 | iminute = isec / 60 |
---|
2321 | isec = MOD(isec, 60) |
---|
2322 | WRITE(iom_sdate, '('//TRIM(clfmt)//')') iyear, imonth, iday, ihour, iminute, isec ! date of the end of run |
---|
2323 | ELSE |
---|
2324 | WRITE(iom_sdate, '('//TRIM(clfmt)//')') iyear, imonth, iday ! date of the end of run |
---|
2325 | ENDIF |
---|
2326 | !$AGRIF_END_DO_NOT_TREAT |
---|
2327 | |
---|
2328 | END FUNCTION iom_sdate |
---|
2329 | |
---|
2330 | #else |
---|
2331 | |
---|
2332 | |
---|
2333 | SUBROUTINE iom_setkt( kt, cdname ) |
---|
2334 | INTEGER , INTENT(in):: kt |
---|
2335 | CHARACTER(LEN=*), INTENT(in) :: cdname |
---|
2336 | IF( .FALSE. ) WRITE(numout,*) kt, cdname ! useless test to avoid compilation warnings |
---|
2337 | END SUBROUTINE iom_setkt |
---|
2338 | |
---|
2339 | SUBROUTINE iom_context_finalize( cdname ) |
---|
2340 | CHARACTER(LEN=*), INTENT(in) :: cdname |
---|
2341 | IF( .FALSE. ) WRITE(numout,*) cdname ! useless test to avoid compilation warnings |
---|
2342 | END SUBROUTINE iom_context_finalize |
---|
2343 | |
---|
2344 | #endif |
---|
2345 | |
---|
2346 | LOGICAL FUNCTION iom_use( cdname ) |
---|
2347 | CHARACTER(LEN=*), INTENT(in) :: cdname |
---|
2348 | #if defined key_iomput |
---|
2349 | iom_use = xios_field_is_active( cdname ) |
---|
2350 | #else |
---|
2351 | iom_use = .FALSE. |
---|
2352 | #endif |
---|
2353 | END FUNCTION iom_use |
---|
2354 | |
---|
2355 | !!====================================================================== |
---|
2356 | END MODULE iom |
---|