[544] | 1 | MODULE iom |
---|
[9019] | 2 | !!====================================================================== |
---|
[544] | 3 | !! *** MODULE iom *** |
---|
| 4 | !! Input/Output manager : Library to read input files |
---|
[9019] | 5 | !!====================================================================== |
---|
[3764] | 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 |
---|
[14072] | 9 | !! 3.4 ! 2012-12 (R. Bourdalle-Badie and G. Reffray) add C1D case |
---|
[6140] | 10 | !! 3.6 ! 2014-15 DIMG format removed |
---|
[7646] | 11 | !! 3.6 ! 2015-15 (J. Harle) Added procedure to read REAL attributes |
---|
[9019] | 12 | !! 4.0 ! 2017-11 (M. Andrejczuk) Extend IOM interface to write any 3D fields |
---|
| 13 | !!---------------------------------------------------------------------- |
---|
[544] | 14 | |
---|
[9019] | 15 | !!---------------------------------------------------------------------- |
---|
[544] | 16 | !! iom_open : open a file read only |
---|
| 17 | !! iom_close : close a file or all files opened by iom |
---|
| 18 | !! iom_get : read a field (interfaced to several routines) |
---|
| 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) |
---|
[9019] | 21 | !!---------------------------------------------------------------------- |
---|
[544] | 22 | USE dom_oce ! ocean space and time domain |
---|
[14072] | 23 | USE domutl ! |
---|
[3764] | 24 | USE c1d ! 1D vertical configuration |
---|
[3294] | 25 | USE flo_oce ! floats module declarations |
---|
[679] | 26 | USE lbclnk ! lateal boundary condition / mpp exchanges |
---|
[544] | 27 | USE iom_def ! iom variables definitions |
---|
| 28 | USE iom_nf90 ! NetCDF format with native NetCDF library |
---|
[2715] | 29 | USE in_out_manager ! I/O manager |
---|
| 30 | USE lib_mpp ! MPP library |
---|
[12377] | 31 | USE sbc_oce , ONLY : nn_fsbc, ght_abl, ghw_abl, e3t_abl, e3w_abl, jpka, jpkam1 |
---|
[9019] | 32 | USE icb_oce , ONLY : nclasses, class_num ! !: iceberg classes |
---|
[9570] | 33 | #if defined key_si3 |
---|
[9019] | 34 | USE ice , ONLY : jpl |
---|
[4691] | 35 | #endif |
---|
[1725] | 36 | USE phycst ! physical constants |
---|
| 37 | USE dianam ! build name of file |
---|
[14822] | 38 | #if defined key_xios |
---|
[3695] | 39 | USE xios |
---|
[1359] | 40 | # endif |
---|
[4148] | 41 | USE ioipsl, ONLY : ju2ymds ! for calendar |
---|
[4152] | 42 | USE crs ! Grid coarsening |
---|
[10222] | 43 | #if defined key_top |
---|
| 44 | USE trc, ONLY : profsed |
---|
| 45 | #endif |
---|
[14072] | 46 | USE lib_fortran |
---|
[12377] | 47 | USE diu_bulk, ONLY : ln_diurnal_only, ln_diurnal |
---|
[13970] | 48 | USE iom_nf90 |
---|
| 49 | USE netcdf |
---|
[1359] | 50 | |
---|
[544] | 51 | IMPLICIT NONE |
---|
[556] | 52 | PUBLIC ! must be public to be able to access iom_def through iom |
---|
[14072] | 53 | |
---|
[14822] | 54 | #if defined key_xios |
---|
[1725] | 55 | LOGICAL, PUBLIC, PARAMETER :: lk_iomput = .TRUE. !: iom_put flag |
---|
[1457] | 56 | #else |
---|
| 57 | LOGICAL, PUBLIC, PARAMETER :: lk_iomput = .FALSE. !: iom_put flag |
---|
| 58 | #endif |
---|
[12377] | 59 | PUBLIC iom_init, iom_init_closedef, iom_swap, iom_open, iom_close, iom_setkt, iom_varid, iom_get, iom_get_var |
---|
[10522] | 60 | PUBLIC iom_chkatt, iom_getatt, iom_putatt, iom_getszuld, iom_rstput, iom_delay_rst, iom_put |
---|
[12377] | 61 | PUBLIC iom_use, iom_context_finalize, iom_update_file_name, iom_miss_val |
---|
[13970] | 62 | PUBLIC iom_xios_setid |
---|
[544] | 63 | |
---|
[13226] | 64 | PRIVATE iom_rp0d_sp, iom_rp1d_sp, iom_rp2d_sp, iom_rp3d_sp |
---|
| 65 | PRIVATE iom_rp0d_dp, iom_rp1d_dp, iom_rp2d_dp, iom_rp3d_dp |
---|
| 66 | PRIVATE iom_get_123d |
---|
| 67 | PRIVATE iom_g0d_sp, iom_g1d_sp, iom_g2d_sp, iom_g3d_sp |
---|
| 68 | PRIVATE iom_g0d_dp, iom_g1d_dp, iom_g2d_dp, iom_g3d_dp |
---|
| 69 | PRIVATE iom_p1d_sp, iom_p2d_sp, iom_p3d_sp, iom_p4d_sp |
---|
| 70 | PRIVATE iom_p1d_dp, iom_p2d_dp, iom_p3d_dp, iom_p4d_dp |
---|
[14822] | 71 | #if defined key_xios |
---|
[4148] | 72 | 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 |
---|
[12377] | 73 | PRIVATE set_grid, set_grid_bounds, set_scalar, set_xmlatt, set_mooring, iom_sdate |
---|
[13970] | 74 | PRIVATE iom_set_rst_context, iom_set_vars_active |
---|
[1359] | 75 | # endif |
---|
[13970] | 76 | PRIVATE set_xios_context |
---|
| 77 | PRIVATE iom_set_rstw_active |
---|
[752] | 78 | |
---|
[544] | 79 | INTERFACE iom_get |
---|
[13226] | 80 | MODULE PROCEDURE iom_g0d_sp, iom_g1d_sp, iom_g2d_sp, iom_g3d_sp |
---|
| 81 | MODULE PROCEDURE iom_g0d_dp, iom_g1d_dp, iom_g2d_dp, iom_g3d_dp |
---|
[544] | 82 | END INTERFACE |
---|
[2528] | 83 | INTERFACE iom_getatt |
---|
[10425] | 84 | MODULE PROCEDURE iom_g0d_iatt, iom_g1d_iatt, iom_g0d_ratt, iom_g1d_ratt, iom_g0d_catt |
---|
[2528] | 85 | END INTERFACE |
---|
[7646] | 86 | INTERFACE iom_putatt |
---|
[10425] | 87 | MODULE PROCEDURE iom_p0d_iatt, iom_p1d_iatt, iom_p0d_ratt, iom_p1d_ratt, iom_p0d_catt |
---|
[7646] | 88 | END INTERFACE |
---|
[544] | 89 | INTERFACE iom_rstput |
---|
[13226] | 90 | MODULE PROCEDURE iom_rp0d_sp, iom_rp1d_sp, iom_rp2d_sp, iom_rp3d_sp |
---|
| 91 | MODULE PROCEDURE iom_rp0d_dp, iom_rp1d_dp, iom_rp2d_dp, iom_rp3d_dp |
---|
[544] | 92 | END INTERFACE |
---|
[9802] | 93 | INTERFACE iom_put |
---|
[13226] | 94 | MODULE PROCEDURE iom_p0d_sp, iom_p1d_sp, iom_p2d_sp, iom_p3d_sp, iom_p4d_sp |
---|
| 95 | MODULE PROCEDURE iom_p0d_dp, iom_p1d_dp, iom_p2d_dp, iom_p3d_dp, iom_p4d_dp |
---|
[9802] | 96 | END INTERFACE iom_put |
---|
[14072] | 97 | |
---|
[12377] | 98 | !! * Substitutions |
---|
| 99 | # include "do_loop_substitute.h90" |
---|
[544] | 100 | !!---------------------------------------------------------------------- |
---|
[9598] | 101 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[1152] | 102 | !! $Id$ |
---|
[10068] | 103 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[544] | 104 | !!---------------------------------------------------------------------- |
---|
| 105 | CONTAINS |
---|
| 106 | |
---|
[14072] | 107 | SUBROUTINE iom_init( cdname, kdid, ld_closedef ) |
---|
[1359] | 108 | !!---------------------------------------------------------------------- |
---|
| 109 | !! *** ROUTINE *** |
---|
| 110 | !! |
---|
[14072] | 111 | !! ** Purpose : |
---|
[1359] | 112 | !! |
---|
| 113 | !!---------------------------------------------------------------------- |
---|
[9903] | 114 | CHARACTER(len=*), INTENT(in) :: cdname |
---|
[14072] | 115 | INTEGER , OPTIONAL, INTENT(in) :: kdid |
---|
[12377] | 116 | LOGICAL , OPTIONAL, INTENT(in) :: ld_closedef |
---|
[14822] | 117 | #if defined key_xios |
---|
[9019] | 118 | ! |
---|
[7646] | 119 | TYPE(xios_duration) :: dtime = xios_duration(0, 0, 0, 0, 0, 0) |
---|
| 120 | TYPE(xios_date) :: start_date |
---|
[9367] | 121 | CHARACTER(len=lc) :: clname |
---|
[12276] | 122 | INTEGER :: irefyear, irefmonth, irefday |
---|
[12597] | 123 | INTEGER :: ji |
---|
[13970] | 124 | LOGICAL :: llrst_context ! is context related to restart |
---|
[14072] | 125 | LOGICAL :: llrstr, llrstw |
---|
[13970] | 126 | INTEGER :: inum |
---|
[5415] | 127 | ! |
---|
[7646] | 128 | REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zt_bnds, zw_bnds |
---|
[12377] | 129 | REAL(wp), DIMENSION(2,jpkam1) :: za_bnds ! ABL vertical boundaries |
---|
[13970] | 130 | LOGICAL :: ll_closedef |
---|
[13557] | 131 | LOGICAL :: ll_exist |
---|
[1359] | 132 | !!---------------------------------------------------------------------- |
---|
[9019] | 133 | ! |
---|
[13970] | 134 | ll_closedef = .TRUE. |
---|
[12377] | 135 | IF ( PRESENT(ld_closedef) ) ll_closedef = ld_closedef |
---|
[9802] | 136 | ! |
---|
[7646] | 137 | ALLOCATE( zt_bnds(2,jpk), zw_bnds(2,jpk) ) |
---|
[9019] | 138 | ! |
---|
[4152] | 139 | clname = cdname |
---|
| 140 | IF( TRIM(Agrif_CFixed()) /= '0' ) clname = TRIM(Agrif_CFixed())//"_"//TRIM(cdname) |
---|
[9570] | 141 | CALL xios_context_initialize(TRIM(clname), mpi_comm_oce) |
---|
[4152] | 142 | CALL iom_swap( cdname ) |
---|
[1359] | 143 | |
---|
[13970] | 144 | llrstr = (cdname == cr_ocerst_cxt) .OR. (cdname == cr_icerst_cxt) |
---|
[14822] | 145 | llrstr = llrstr .OR. (cdname == cr_ablrst_cxt) |
---|
[13970] | 146 | llrstr = llrstr .OR. (cdname == cr_toprst_cxt) |
---|
| 147 | llrstr = llrstr .OR. (cdname == cr_sedrst_cxt) |
---|
| 148 | |
---|
| 149 | llrstw = (cdname == cw_ocerst_cxt) .OR. (cdname == cw_icerst_cxt) |
---|
[14822] | 150 | llrstw = llrstw .OR. (cdname == cw_ablrst_cxt) |
---|
[13970] | 151 | llrstw = llrstw .OR. (cdname == cw_toprst_cxt) |
---|
| 152 | llrstw = llrstw .OR. (cdname == cw_sedrst_cxt) |
---|
| 153 | |
---|
| 154 | llrst_context = llrstr .OR. llrstw |
---|
| 155 | |
---|
[14072] | 156 | ! Calendar type is now defined in xml file |
---|
[12276] | 157 | IF (.NOT.(xios_getvar('ref_year' ,irefyear ))) irefyear = 1900 |
---|
| 158 | IF (.NOT.(xios_getvar('ref_month',irefmonth))) irefmonth = 01 |
---|
| 159 | IF (.NOT.(xios_getvar('ref_day' ,irefday ))) irefday = 01 |
---|
| 160 | |
---|
[1725] | 161 | SELECT CASE ( nleapy ) ! Choose calendar for IOIPSL |
---|
[13286] | 162 | CASE ( 1) ; CALL xios_define_calendar( TYPE = "Gregorian", time_origin = xios_date(irefyear,irefmonth,irefday,0,0,0), & |
---|
| 163 | & start_date = xios_date( nyear, nmonth, nday,0,0,0) ) |
---|
| 164 | CASE ( 0) ; CALL xios_define_calendar( TYPE = "NoLeap" , time_origin = xios_date(irefyear,irefmonth,irefday,0,0,0), & |
---|
| 165 | & start_date = xios_date( nyear, nmonth, nday,0,0,0) ) |
---|
| 166 | CASE (30) ; CALL xios_define_calendar( TYPE = "D360" , time_origin = xios_date(irefyear,irefmonth,irefday,0,0,0), & |
---|
| 167 | & start_date = xios_date( nyear, nmonth, nday,0,0,0) ) |
---|
[1725] | 168 | END SELECT |
---|
[1359] | 169 | |
---|
| 170 | ! horizontal grid definition |
---|
[9367] | 171 | IF(.NOT.llrst_context) CALL set_scalar |
---|
[9019] | 172 | ! |
---|
[14072] | 173 | IF( cdname == cxios_context ) THEN |
---|
| 174 | CALL set_grid( "T", glamt, gphit, .FALSE., .FALSE. ) |
---|
[9984] | 175 | CALL set_grid( "U", glamu, gphiu, .FALSE., .FALSE. ) |
---|
| 176 | CALL set_grid( "V", glamv, gphiv, .FALSE., .FALSE. ) |
---|
| 177 | CALL set_grid( "W", glamt, gphit, .FALSE., .FALSE. ) |
---|
[14053] | 178 | CALL set_grid( "F", glamf, gphif, .FALSE., .FALSE. ) |
---|
[5385] | 179 | CALL set_grid_znl( gphit ) |
---|
[5415] | 180 | ! |
---|
| 181 | IF( ln_cfmeta ) THEN ! Add additional grid metadata |
---|
[13286] | 182 | CALL iom_set_domain_attr("grid_T", area = real( e1e2t(Nis0:Nie0, Njs0:Nje0), dp)) |
---|
| 183 | CALL iom_set_domain_attr("grid_U", area = real( e1e2u(Nis0:Nie0, Njs0:Nje0), dp)) |
---|
| 184 | CALL iom_set_domain_attr("grid_V", area = real( e1e2v(Nis0:Nie0, Njs0:Nje0), dp)) |
---|
[14053] | 185 | CALL iom_set_domain_attr("grid_W", area = REAL( e1e2t(Nis0:Nie0, Njs0:Nje0), dp)) |
---|
| 186 | CALL iom_set_domain_attr("grid_F", area = real( e1e2f(Nis0:Nie0, Njs0:Nje0), dp)) |
---|
[5415] | 187 | CALL set_grid_bounds( "T", glamf, gphif, glamt, gphit ) |
---|
| 188 | CALL set_grid_bounds( "U", glamv, gphiv, glamu, gphiu ) |
---|
| 189 | CALL set_grid_bounds( "V", glamu, gphiu, glamv, gphiv ) |
---|
| 190 | CALL set_grid_bounds( "W", glamf, gphif, glamt, gphit ) |
---|
[14053] | 191 | CALL set_grid_bounds( "F", glamt, gphit, glamf, gphif ) |
---|
[5415] | 192 | ENDIF |
---|
[4152] | 193 | ENDIF |
---|
[9019] | 194 | ! |
---|
[14072] | 195 | IF( TRIM(cdname) == TRIM(cxios_context)//"_crs" ) THEN |
---|
[4152] | 196 | CALL dom_grid_crs ! Save the parent grid information & Switch to coarse grid domain |
---|
| 197 | ! |
---|
[14053] | 198 | CALL set_grid( "T", glamt_crs, gphit_crs, .FALSE., .FALSE. ) |
---|
| 199 | CALL set_grid( "U", glamu_crs, gphiu_crs, .FALSE., .FALSE. ) |
---|
| 200 | CALL set_grid( "V", glamv_crs, gphiv_crs, .FALSE., .FALSE. ) |
---|
| 201 | CALL set_grid( "W", glamt_crs, gphit_crs, .FALSE., .FALSE. ) |
---|
[5385] | 202 | CALL set_grid_znl( gphit_crs ) |
---|
[4152] | 203 | ! |
---|
| 204 | CALL dom_grid_glo ! Return to parent grid domain |
---|
[5415] | 205 | ! |
---|
[9367] | 206 | IF( ln_cfmeta .AND. .NOT. llrst_context) THEN ! Add additional grid metadata |
---|
[13286] | 207 | CALL iom_set_domain_attr("grid_T", area = real(e1e2t_crs(Nis0:Nie0, Njs0:Nje0), dp)) |
---|
| 208 | CALL iom_set_domain_attr("grid_U", area = real(e1u_crs(Nis0:Nie0, Njs0:Nje0) * e2u_crs(Nis0:Nie0, Njs0:Nje0), dp)) |
---|
| 209 | CALL iom_set_domain_attr("grid_V", area = real(e1v_crs(Nis0:Nie0, Njs0:Nje0) * e2v_crs(Nis0:Nie0, Njs0:Nje0), dp)) |
---|
| 210 | CALL iom_set_domain_attr("grid_W", area = real(e1e2t_crs(Nis0:Nie0, Njs0:Nje0), dp)) |
---|
[5415] | 211 | CALL set_grid_bounds( "T", glamf_crs, gphif_crs, glamt_crs, gphit_crs ) |
---|
| 212 | CALL set_grid_bounds( "U", glamv_crs, gphiv_crs, glamu_crs, gphiu_crs ) |
---|
| 213 | CALL set_grid_bounds( "V", glamu_crs, gphiu_crs, glamv_crs, gphiv_crs ) |
---|
| 214 | CALL set_grid_bounds( "W", glamf_crs, gphif_crs, glamt_crs, gphit_crs ) |
---|
| 215 | ENDIF |
---|
[4152] | 216 | ENDIF |
---|
[9019] | 217 | ! |
---|
[1359] | 218 | ! vertical grid definition |
---|
[9367] | 219 | IF(.NOT.llrst_context) THEN |
---|
[13970] | 220 | CALL iom_set_axis_attr( "deptht", paxis = gdept_1d ) |
---|
| 221 | CALL iom_set_axis_attr( "depthu", paxis = gdept_1d ) |
---|
| 222 | CALL iom_set_axis_attr( "depthv", paxis = gdept_1d ) |
---|
| 223 | CALL iom_set_axis_attr( "depthw", paxis = gdepw_1d ) |
---|
[14053] | 224 | CALL iom_set_axis_attr( "depthf", paxis = gdept_1d ) |
---|
[9367] | 225 | |
---|
[12377] | 226 | ! ABL |
---|
[14072] | 227 | IF( .NOT. ALLOCATED(ght_abl) ) THEN ! force definition for xml files (xios) |
---|
[13970] | 228 | ALLOCATE( ght_abl(jpka), ghw_abl(jpka), e3t_abl(jpka), e3w_abl(jpka) ) ! default allocation needed by iom |
---|
| 229 | ght_abl(:) = -1._wp ; ghw_abl(:) = -1._wp |
---|
| 230 | e3t_abl(:) = -1._wp ; e3w_abl(:) = -1._wp |
---|
| 231 | ENDIF |
---|
| 232 | CALL iom_set_axis_attr( "ght_abl", ght_abl(2:jpka) ) |
---|
| 233 | CALL iom_set_axis_attr( "ghw_abl", ghw_abl(2:jpka) ) |
---|
[14072] | 234 | |
---|
[13970] | 235 | ! Add vertical grid bounds |
---|
| 236 | zt_bnds(2,: ) = gdept_1d(:) |
---|
| 237 | zt_bnds(1,2:jpk ) = gdept_1d(1:jpkm1) |
---|
| 238 | zt_bnds(1,1 ) = gdept_1d(1) - e3w_1d(1) |
---|
| 239 | zw_bnds(1,: ) = gdepw_1d(:) |
---|
| 240 | zw_bnds(2,1:jpkm1) = gdepw_1d(2:jpk) |
---|
| 241 | zw_bnds(2,jpk: ) = gdepw_1d(jpk) + e3t_1d(jpk) |
---|
| 242 | CALL iom_set_axis_attr( "deptht", bounds=zw_bnds ) |
---|
| 243 | CALL iom_set_axis_attr( "depthu", bounds=zw_bnds ) |
---|
| 244 | CALL iom_set_axis_attr( "depthv", bounds=zw_bnds ) |
---|
| 245 | CALL iom_set_axis_attr( "depthw", bounds=zt_bnds ) |
---|
[14053] | 246 | CALL iom_set_axis_attr( "depthf", bounds=zw_bnds ) |
---|
[12377] | 247 | |
---|
[13970] | 248 | ! ABL |
---|
| 249 | za_bnds(1,:) = ghw_abl(1:jpkam1) |
---|
| 250 | za_bnds(2,:) = ghw_abl(2:jpka ) |
---|
| 251 | CALL iom_set_axis_attr( "ght_abl", bounds=za_bnds ) |
---|
| 252 | za_bnds(1,:) = ght_abl(2:jpka ) |
---|
| 253 | za_bnds(2,:) = ght_abl(2:jpka ) + e3w_abl(2:jpka) |
---|
| 254 | CALL iom_set_axis_attr( "ghw_abl", bounds=za_bnds ) |
---|
[12377] | 255 | |
---|
[13970] | 256 | CALL iom_set_axis_attr( "nfloat", (/ (REAL(ji,wp), ji=1,jpnfl) /) ) |
---|
[9570] | 257 | # if defined key_si3 |
---|
[13970] | 258 | CALL iom_set_axis_attr( "ncatice", (/ (REAL(ji,wp), ji=1,jpl) /) ) |
---|
| 259 | ! SIMIP diagnostics (4 main arctic straits) |
---|
| 260 | CALL iom_set_axis_attr( "nstrait", (/ (REAL(ji,wp), ji=1,4) /) ) |
---|
[9019] | 261 | # endif |
---|
[10222] | 262 | #if defined key_top |
---|
[13970] | 263 | IF( ALLOCATED(profsed) ) CALL iom_set_axis_attr( "profsed", paxis = profsed ) |
---|
[10222] | 264 | #endif |
---|
[13970] | 265 | CALL iom_set_axis_attr( "icbcla", class_num ) |
---|
| 266 | CALL iom_set_axis_attr( "iax_20C", (/ REAL(20,wp) /) ) ! strange syntaxe and idea... |
---|
| 267 | CALL iom_set_axis_attr( "iax_26C", (/ REAL(26,wp) /) ) ! strange syntaxe and idea... |
---|
| 268 | CALL iom_set_axis_attr( "iax_28C", (/ REAL(28,wp) /) ) ! strange syntaxe and idea... |
---|
| 269 | ! for diaprt, we need to define an axis which size can be 1 (default) or 5 (if the file subbasins.nc exists) |
---|
| 270 | INQUIRE( FILE = 'subbasins.nc', EXIST = ll_exist ) |
---|
| 271 | nbasin = 1 + 4 * COUNT( (/ll_exist/) ) |
---|
| 272 | CALL iom_set_axis_attr( "basin" , (/ (REAL(ji,wp), ji=1,nbasin) /) ) |
---|
[9367] | 273 | ENDIF |
---|
| 274 | ! |
---|
[1725] | 275 | ! automatic definitions of some of the xml attributs |
---|
[13970] | 276 | IF(llrstr) THEN |
---|
| 277 | IF(PRESENT(kdid)) THEN |
---|
| 278 | CALL iom_set_rst_context(.TRUE.) |
---|
| 279 | !set which fields will be read from restart file |
---|
| 280 | CALL iom_set_vars_active(kdid) |
---|
| 281 | ELSE |
---|
| 282 | CALL ctl_stop( 'iom_init:', 'restart read with XIOS: missing pointer to NETCDF file' ) |
---|
| 283 | ENDIF |
---|
| 284 | ELSE IF(llrstw) THEN |
---|
| 285 | CALL iom_set_rstw_file(iom_file(kdid)%name) |
---|
[9367] | 286 | ELSE |
---|
[13970] | 287 | CALL set_xmlatt |
---|
[9367] | 288 | ENDIF |
---|
[9019] | 289 | ! |
---|
[12377] | 290 | ! set time step length |
---|
[12489] | 291 | dtime%second = rn_Dt |
---|
[9019] | 292 | CALL xios_set_timestep( dtime ) |
---|
| 293 | ! |
---|
[12377] | 294 | ! conditional closure of context definition |
---|
| 295 | IF ( ll_closedef ) CALL iom_init_closedef |
---|
| 296 | ! |
---|
[7646] | 297 | DEALLOCATE( zt_bnds, zw_bnds ) |
---|
[9019] | 298 | ! |
---|
[1359] | 299 | #endif |
---|
[9019] | 300 | ! |
---|
[1359] | 301 | END SUBROUTINE iom_init |
---|
| 302 | |
---|
[13970] | 303 | SUBROUTINE iom_init_closedef(cdname) |
---|
[12377] | 304 | !!---------------------------------------------------------------------- |
---|
| 305 | !! *** SUBROUTINE iom_init_closedef *** |
---|
| 306 | !!---------------------------------------------------------------------- |
---|
| 307 | !! |
---|
| 308 | !! ** Purpose : Closure of context definition |
---|
| 309 | !! |
---|
| 310 | !!---------------------------------------------------------------------- |
---|
[13970] | 311 | CHARACTER(len=*), OPTIONAL, INTENT(IN) :: cdname |
---|
[14822] | 312 | #if defined key_xios |
---|
[13970] | 313 | LOGICAL :: llrstw |
---|
[12377] | 314 | |
---|
[13970] | 315 | llrstw = .FALSE. |
---|
| 316 | IF(PRESENT(cdname)) THEN |
---|
| 317 | llrstw = (cdname == cw_ocerst_cxt) |
---|
| 318 | llrstw = llrstw .OR. (cdname == cw_icerst_cxt) |
---|
[14822] | 319 | llrstw = llrstw .OR. (cdname == cw_ablrst_cxt) |
---|
[13970] | 320 | llrstw = llrstw .OR. (cdname == cw_toprst_cxt) |
---|
| 321 | llrstw = llrstw .OR. (cdname == cw_sedrst_cxt) |
---|
| 322 | ENDIF |
---|
| 323 | |
---|
| 324 | IF( llrstw ) THEN |
---|
| 325 | !set names of the fields in restart file IF using XIOS to write data |
---|
| 326 | CALL iom_set_rst_context(.FALSE.) |
---|
| 327 | CALL xios_close_context_definition() |
---|
| 328 | ELSE |
---|
| 329 | CALL xios_close_context_definition() |
---|
| 330 | CALL xios_update_calendar( 0 ) |
---|
| 331 | ENDIF |
---|
[12377] | 332 | #else |
---|
| 333 | IF( .FALSE. ) WRITE(numout,*) 'iom_init_closedef: should not see this' ! useless statement to avoid compilation warnings |
---|
| 334 | #endif |
---|
| 335 | |
---|
| 336 | END SUBROUTINE iom_init_closedef |
---|
| 337 | |
---|
[13970] | 338 | SUBROUTINE iom_set_vars_active(idnum) |
---|
[9367] | 339 | !!--------------------------------------------------------------------- |
---|
[13970] | 340 | !! *** SUBROUTINE iom_set_vars_active *** |
---|
[9367] | 341 | !! |
---|
[13970] | 342 | !! ** Purpose : define filename in XIOS context for reading file, |
---|
[14072] | 343 | !! enable variables present in a file for reading with XIOS |
---|
[13970] | 344 | !! id of the file is assumed to be rrestart. |
---|
[9367] | 345 | !!--------------------------------------------------------------------- |
---|
[14072] | 346 | INTEGER, INTENT(IN) :: idnum |
---|
| 347 | |
---|
[14822] | 348 | #if defined key_xios |
---|
[13970] | 349 | INTEGER :: ndims, nvars, natts, unlimitedDimId, dimlen, xtype,mdims |
---|
| 350 | TYPE(xios_field) :: field_hdl |
---|
| 351 | TYPE(xios_file) :: file_hdl |
---|
| 352 | TYPE(xios_filegroup) :: filegroup_hdl |
---|
| 353 | INTEGER :: dimids(4), jv,i, idim |
---|
| 354 | CHARACTER(LEN=256) :: clinfo ! info character |
---|
| 355 | INTEGER, ALLOCATABLE :: indimlens(:) |
---|
| 356 | CHARACTER(LEN=nf90_max_name), ALLOCATABLE :: indimnames(:) |
---|
| 357 | CHARACTER(LEN=nf90_max_name) :: dimname, varname |
---|
| 358 | INTEGER :: iln |
---|
| 359 | CHARACTER(LEN=lc) :: fname |
---|
| 360 | LOGICAL :: lmeta |
---|
| 361 | !metadata in restart file for restart read with XIOS |
---|
[14822] | 362 | INTEGER, PARAMETER :: NMETA = 11 |
---|
[13970] | 363 | CHARACTER(LEN=lc) :: meta(NMETA) |
---|
[9367] | 364 | |
---|
| 365 | |
---|
[13970] | 366 | meta(1) = "nav_lat" |
---|
| 367 | meta(2) = "nav_lon" |
---|
| 368 | meta(3) = "nav_lev" |
---|
| 369 | meta(4) = "time_instant" |
---|
| 370 | meta(5) = "time_instant_bounds" |
---|
| 371 | meta(6) = "time_counter" |
---|
| 372 | meta(7) = "time_counter_bounds" |
---|
| 373 | meta(8) = "x" |
---|
| 374 | meta(9) = "y" |
---|
| 375 | meta(10) = "numcat" |
---|
[14822] | 376 | meta(11) = "nav_hgt" |
---|
[9367] | 377 | |
---|
[13970] | 378 | clinfo = ' iom_set_vars_active, file: '//TRIM(iom_file(idnum)%name) |
---|
[9367] | 379 | |
---|
[13970] | 380 | iln = INDEX( iom_file(idnum)%name, '.nc' ) |
---|
| 381 | !XIOS doee not need .nc |
---|
| 382 | IF(iln > 0) THEN |
---|
| 383 | fname = iom_file(idnum)%name(1:iln-1) |
---|
| 384 | ELSE |
---|
| 385 | fname = iom_file(idnum)%name |
---|
| 386 | ENDIF |
---|
[9535] | 387 | |
---|
[13970] | 388 | !set name of the restart file and enable available fields |
---|
| 389 | CALL xios_get_handle("file_definition", filegroup_hdl ) |
---|
| 390 | CALL xios_add_child(filegroup_hdl, file_hdl, 'rrestart') |
---|
| 391 | CALL xios_set_file_attr( "rrestart", name=fname, type="one_file", & |
---|
| 392 | par_access="collective", enabled=.TRUE., mode="read", & |
---|
| 393 | output_freq=xios_timestep ) |
---|
[9367] | 394 | |
---|
[13970] | 395 | CALL iom_nf90_check( nf90_inquire(iom_file(idnum)%nfid, ndims, nvars, natts ), clinfo ) |
---|
| 396 | ALLOCATE(indimlens(ndims), indimnames(ndims)) |
---|
| 397 | CALL iom_nf90_check( nf90_inquire(iom_file(idnum)%nfid, unlimitedDimId = unlimitedDimId ), clinfo ) |
---|
| 398 | |
---|
| 399 | DO idim = 1, ndims |
---|
| 400 | CALL iom_nf90_check( nf90_inquire_dimension(iom_file(idnum)%nfid, idim, dimname, dimlen ), clinfo ) |
---|
| 401 | indimlens(idim) = dimlen |
---|
| 402 | indimnames(idim) = dimname |
---|
| 403 | ENDDO |
---|
| 404 | |
---|
| 405 | DO jv =1, nvars |
---|
| 406 | lmeta = .FALSE. |
---|
| 407 | CALL iom_nf90_check( nf90_inquire_variable(iom_file(idnum)%nfid, jv, varname, xtype, ndims, dimids, natts ), clinfo ) |
---|
| 408 | DO i = 1, NMETA |
---|
| 409 | IF(varname == meta(i)) THEN |
---|
| 410 | lmeta = .TRUE. |
---|
[9367] | 411 | ENDIF |
---|
[13970] | 412 | ENDDO |
---|
| 413 | IF(.NOT.lmeta) THEN |
---|
| 414 | CALL xios_add_child(file_hdl, field_hdl, varname) |
---|
| 415 | mdims = ndims |
---|
| 416 | |
---|
| 417 | IF(ANY(dimids(1:ndims) == unlimitedDimId)) THEN |
---|
| 418 | mdims = mdims - 1 |
---|
| 419 | ENDIF |
---|
| 420 | |
---|
| 421 | IF(mdims == 3) THEN |
---|
| 422 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = varname, & |
---|
| 423 | domain_ref="grid_N", & |
---|
| 424 | axis_ref=iom_axis(indimlens(dimids(mdims))), & |
---|
| 425 | prec = 8, operation = "instant" ) |
---|
| 426 | ELSEIF(mdims == 2) THEN |
---|
| 427 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = varname, & |
---|
| 428 | domain_ref="grid_N", prec = 8, & |
---|
[14072] | 429 | operation = "instant" ) |
---|
[13970] | 430 | ELSEIF(mdims == 1) THEN |
---|
| 431 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = varname, & |
---|
| 432 | axis_ref=iom_axis(indimlens(dimids(mdims))), & |
---|
| 433 | prec = 8, operation = "instant" ) |
---|
| 434 | ELSEIF(mdims == 0) THEN |
---|
| 435 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = varname, & |
---|
| 436 | scalar_ref = "grid_scalar", prec = 8, & |
---|
| 437 | operation = "instant" ) |
---|
| 438 | ELSE |
---|
[14072] | 439 | WRITE(ctmp1,*) 'iom_set_vars_active: variable ', TRIM(varname) ,' incorrect number of dimensions' |
---|
[13970] | 440 | CALL ctl_stop( 'iom_set_vars_active:', ctmp1 ) |
---|
| 441 | ENDIF |
---|
[9367] | 442 | ENDIF |
---|
[13970] | 443 | ENDDO |
---|
| 444 | DEALLOCATE(indimlens, indimnames) |
---|
[9535] | 445 | #endif |
---|
[13970] | 446 | END SUBROUTINE iom_set_vars_active |
---|
[9367] | 447 | |
---|
[13970] | 448 | SUBROUTINE iom_set_rstw_file(cdrst_file) |
---|
[9367] | 449 | !!--------------------------------------------------------------------- |
---|
[13970] | 450 | !! *** SUBROUTINE iom_set_rstw_file *** |
---|
[9367] | 451 | !! |
---|
[13970] | 452 | !! ** Purpose : define file name in XIOS context for writing restart |
---|
[9367] | 453 | !!--------------------------------------------------------------------- |
---|
[13970] | 454 | CHARACTER(len=*) :: cdrst_file |
---|
[14822] | 455 | #if defined key_xios |
---|
[13970] | 456 | TYPE(xios_file) :: file_hdl |
---|
| 457 | TYPE(xios_filegroup) :: filegroup_hdl |
---|
| 458 | |
---|
| 459 | !set name of the restart file and enable available fields |
---|
| 460 | IF(lwp) WRITE(numout,*) 'Setting restart filename (for XIOS write) to: ', TRIM(cdrst_file) |
---|
| 461 | CALL xios_get_handle("file_definition", filegroup_hdl ) |
---|
| 462 | CALL xios_add_child(filegroup_hdl, file_hdl, 'wrestart') |
---|
[14072] | 463 | IF(nxioso.eq.1) THEN |
---|
| 464 | CALL xios_set_file_attr( "wrestart", type="one_file", enabled=.TRUE.,& |
---|
| 465 | mode="write", output_freq=xios_timestep) |
---|
| 466 | IF(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in one_file mode' |
---|
| 467 | ELSE |
---|
| 468 | CALL xios_set_file_attr( "wrestart", type="multiple_file", enabled=.TRUE.,& |
---|
| 469 | mode="write", output_freq=xios_timestep) |
---|
| 470 | IF(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in multiple_file mode' |
---|
| 471 | ENDIF |
---|
[13970] | 472 | CALL xios_set_file_attr( "wrestart", name=trim(cdrst_file)) |
---|
[9535] | 473 | #endif |
---|
[13970] | 474 | END SUBROUTINE iom_set_rstw_file |
---|
[9367] | 475 | |
---|
| 476 | |
---|
[13970] | 477 | SUBROUTINE iom_set_rstw_active(sdfield, rd0, rs0, rd1, rs1, rd2, rs2, rd3, rs3) |
---|
[9367] | 478 | !!--------------------------------------------------------------------- |
---|
[9535] | 479 | !! *** SUBROUTINE iom_set_rstw_active *** |
---|
[9367] | 480 | !! |
---|
| 481 | !! ** Purpose : define file name in XIOS context for writing restart |
---|
| 482 | !! enable variables present in restart file for writing |
---|
| 483 | !!--------------------------------------------------------------------- |
---|
| 484 | !sets enabled = .TRUE. for each field in restart file |
---|
[13970] | 485 | CHARACTER(len = *), INTENT(IN) :: sdfield |
---|
| 486 | REAL(dp), OPTIONAL, INTENT(IN) :: rd0 |
---|
| 487 | REAL(sp), OPTIONAL, INTENT(IN) :: rs0 |
---|
| 488 | REAL(dp), OPTIONAL, INTENT(IN), DIMENSION(:) :: rd1 |
---|
| 489 | REAL(sp), OPTIONAL, INTENT(IN), DIMENSION(:) :: rs1 |
---|
| 490 | REAL(dp), OPTIONAL, INTENT(IN), DIMENSION(:, :) :: rd2 |
---|
| 491 | REAL(sp), OPTIONAL, INTENT(IN), DIMENSION(:, :) :: rs2 |
---|
[14072] | 492 | REAL(dp), OPTIONAL, INTENT(IN), DIMENSION(:, :, :) :: rd3 |
---|
[13970] | 493 | REAL(sp), OPTIONAL, INTENT(IN), DIMENSION(:, :, :) :: rs3 |
---|
[14822] | 494 | #if defined key_xios |
---|
[13970] | 495 | TYPE(xios_field) :: field_hdl |
---|
| 496 | TYPE(xios_file) :: file_hdl |
---|
[9367] | 497 | |
---|
[13970] | 498 | CALL xios_get_handle("wrestart", file_hdl) |
---|
[9367] | 499 | !define fields for restart context |
---|
[13970] | 500 | CALL xios_add_child(file_hdl, field_hdl, sdfield) |
---|
| 501 | |
---|
| 502 | IF(PRESENT(rd3)) THEN |
---|
| 503 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & |
---|
| 504 | domain_ref = "grid_N", & |
---|
| 505 | axis_ref = iom_axis(size(rd3, 3)), & |
---|
| 506 | prec = 8, operation = "instant" ) |
---|
| 507 | ELSEIF(PRESENT(rs3)) THEN |
---|
| 508 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & |
---|
| 509 | domain_ref = "grid_N", & |
---|
| 510 | axis_ref = iom_axis(size(rd3, 3)), & |
---|
| 511 | prec = 4, operation = "instant" ) |
---|
| 512 | ELSEIF(PRESENT(rd2)) THEN |
---|
| 513 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & |
---|
| 514 | domain_ref = "grid_N", prec = 8, & |
---|
[14072] | 515 | operation = "instant" ) |
---|
[13970] | 516 | ELSEIF(PRESENT(rs2)) THEN |
---|
| 517 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & |
---|
| 518 | domain_ref = "grid_N", prec = 4, & |
---|
| 519 | operation = "instant" ) |
---|
| 520 | ELSEIF(PRESENT(rd1)) THEN |
---|
| 521 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & |
---|
| 522 | axis_ref = iom_axis(size(rd1, 1)), & |
---|
| 523 | prec = 8, operation = "instant" ) |
---|
| 524 | ELSEIF(PRESENT(rs1)) THEN |
---|
| 525 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & |
---|
| 526 | axis_ref = iom_axis(size(rd1, 1)), & |
---|
| 527 | prec = 4, operation = "instant" ) |
---|
| 528 | ELSEIF(PRESENT(rd0)) THEN |
---|
| 529 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & |
---|
| 530 | scalar_ref = "grid_scalar", prec = 8, & |
---|
| 531 | operation = "instant" ) |
---|
| 532 | ELSEIF(PRESENT(rs0)) THEN |
---|
| 533 | CALL xios_set_attr (field_hdl, enabled = .TRUE., name = sdfield, & |
---|
| 534 | scalar_ref = "grid_scalar", prec = 4, & |
---|
| 535 | operation = "instant" ) |
---|
| 536 | ENDIF |
---|
[9367] | 537 | #endif |
---|
| 538 | END SUBROUTINE iom_set_rstw_active |
---|
| 539 | |
---|
[13970] | 540 | FUNCTION iom_axis(idlev) result(axis_ref) |
---|
| 541 | !!--------------------------------------------------------------------- |
---|
| 542 | !! *** FUNCTION iom_axis *** |
---|
| 543 | !! |
---|
| 544 | !! ** Purpose : Used for grid definition when XIOS is used to read/write |
---|
| 545 | !! restart. Returns axis corresponding to the number of levels |
---|
[14072] | 546 | !! given as an input variable. Axes are defined in routine |
---|
[13970] | 547 | !! iom_set_rst_context |
---|
| 548 | !!--------------------------------------------------------------------- |
---|
| 549 | INTEGER, INTENT(IN) :: idlev |
---|
| 550 | CHARACTER(len=lc) :: axis_ref |
---|
| 551 | CHARACTER(len=12) :: str |
---|
| 552 | IF(idlev == jpk) THEN |
---|
| 553 | axis_ref="nav_lev" |
---|
[14822] | 554 | ELSEIF(idlev == jpka) THEN |
---|
| 555 | axis_ref="nav_hgt" |
---|
[13970] | 556 | #if defined key_si3 |
---|
| 557 | ELSEIF(idlev == jpl) THEN |
---|
| 558 | axis_ref="numcat" |
---|
[14072] | 559 | #endif |
---|
[13970] | 560 | ELSE |
---|
| 561 | write(str, *) idlev |
---|
| 562 | CALL ctl_stop( 'iom_axis', 'Definition for axis with '//TRIM(ADJUSTL(str))//' levels missing') |
---|
| 563 | ENDIF |
---|
| 564 | END FUNCTION iom_axis |
---|
| 565 | |
---|
| 566 | FUNCTION iom_xios_setid(cdname) result(kid) |
---|
| 567 | !!--------------------------------------------------------------------- |
---|
| 568 | !! *** FUNCTION *** |
---|
| 569 | !! |
---|
[14072] | 570 | !! ** Purpose : this function returns first available id to keep information about file |
---|
[13970] | 571 | !! sets filename in iom_file structure and sets name |
---|
| 572 | !! of XIOS context depending on cdcomp |
---|
| 573 | !! corresponds to iom_nf90_open |
---|
| 574 | !!--------------------------------------------------------------------- |
---|
| 575 | CHARACTER(len=*), INTENT(in ) :: cdname ! File name |
---|
| 576 | INTEGER :: kid ! identifier of the opened file |
---|
| 577 | INTEGER :: jl |
---|
| 578 | |
---|
| 579 | kid = 0 |
---|
| 580 | DO jl = jpmax_files, 1, -1 |
---|
| 581 | IF( iom_file(jl)%nfid == 0 ) kid = jl |
---|
| 582 | ENDDO |
---|
| 583 | |
---|
| 584 | iom_file(kid)%name = TRIM(cdname) |
---|
| 585 | iom_file(kid)%nfid = 1 |
---|
| 586 | iom_file(kid)%nvars = 0 |
---|
| 587 | iom_file(kid)%irec = -1 |
---|
| 588 | |
---|
| 589 | END FUNCTION iom_xios_setid |
---|
| 590 | |
---|
[14072] | 591 | SUBROUTINE iom_set_rst_context(ld_rstr) |
---|
[13970] | 592 | !!--------------------------------------------------------------------- |
---|
[9535] | 593 | !! *** SUBROUTINE iom_set_rst_context *** |
---|
[9367] | 594 | !! |
---|
[14072] | 595 | !! ** Purpose : Define domain, axis and grid for restart (read/write) |
---|
| 596 | !! context |
---|
| 597 | !! |
---|
[9367] | 598 | !!--------------------------------------------------------------------- |
---|
[13970] | 599 | LOGICAL, INTENT(IN) :: ld_rstr |
---|
| 600 | INTEGER :: ji |
---|
[14822] | 601 | #if defined key_xios |
---|
[14072] | 602 | TYPE(xios_domaingroup) :: domaingroup_hdl |
---|
| 603 | TYPE(xios_domain) :: domain_hdl |
---|
| 604 | TYPE(xios_axisgroup) :: axisgroup_hdl |
---|
| 605 | TYPE(xios_axis) :: axis_hdl |
---|
| 606 | TYPE(xios_scalar) :: scalar_hdl |
---|
| 607 | TYPE(xios_scalargroup) :: scalargroup_hdl |
---|
[9367] | 608 | |
---|
[14072] | 609 | CALL xios_get_handle("domain_definition",domaingroup_hdl) |
---|
| 610 | CALL xios_add_child(domaingroup_hdl, domain_hdl, "grid_N") |
---|
| 611 | CALL set_grid("N", glamt, gphit, .TRUE., ld_rstr) |
---|
| 612 | |
---|
| 613 | CALL xios_get_handle("axis_definition",axisgroup_hdl) |
---|
| 614 | CALL xios_add_child(axisgroup_hdl, axis_hdl, "nav_lev") |
---|
[9367] | 615 | !AGRIF fails to compile when unit= is in call to xios_set_axis_attr |
---|
[14072] | 616 | ! CALL xios_set_axis_attr( "nav_lev", long_name="Vertical levels", unit="m", positive="down") |
---|
[13970] | 617 | CALL xios_set_axis_attr( "nav_lev", long_name = "Vertical levels in meters", positive = "down") |
---|
[14072] | 618 | CALL iom_set_axis_attr( "nav_lev", paxis = gdept_1d ) |
---|
[13970] | 619 | #if defined key_si3 |
---|
| 620 | CALL xios_add_child(axisgroup_hdl, axis_hdl, "numcat") |
---|
| 621 | CALL iom_set_axis_attr( "numcat", (/ (REAL(ji,wp), ji=1,jpl) /) ) |
---|
[9367] | 622 | #endif |
---|
[14822] | 623 | CALL xios_add_child(axisgroup_hdl, axis_hdl, "nav_hgt") |
---|
| 624 | CALL iom_set_axis_attr( "nav_hgt", (/ (REAL(ji,wp), ji=1,jpka) /) ) |
---|
[14072] | 625 | CALL xios_get_handle("scalar_definition", scalargroup_hdl) |
---|
| 626 | CALL xios_add_child(scalargroup_hdl, scalar_hdl, "grid_scalar") |
---|
[13970] | 627 | #endif |
---|
[9367] | 628 | END SUBROUTINE iom_set_rst_context |
---|
| 629 | |
---|
[13970] | 630 | |
---|
[14072] | 631 | SUBROUTINE set_xios_context(kdid, cdcont) |
---|
[13970] | 632 | !!--------------------------------------------------------------------- |
---|
| 633 | !! *** SUBROUTINE iom_set_rst_context *** |
---|
| 634 | !! |
---|
| 635 | !! ** Purpose : set correct XIOS context based on kdid |
---|
[14072] | 636 | !! |
---|
[13970] | 637 | !!--------------------------------------------------------------------- |
---|
| 638 | INTEGER, INTENT(IN) :: kdid ! Identifier of the file |
---|
| 639 | CHARACTER(LEN=lc), INTENT(OUT) :: cdcont ! name of the context for XIOS read/write |
---|
[14072] | 640 | |
---|
[13970] | 641 | cdcont = "NONE" |
---|
| 642 | |
---|
| 643 | IF(lrxios) THEN |
---|
| 644 | IF(kdid == numror) THEN |
---|
| 645 | cdcont = cr_ocerst_cxt |
---|
| 646 | ELSEIF(kdid == numrir) THEN |
---|
[14072] | 647 | cdcont = cr_icerst_cxt |
---|
[14822] | 648 | ELSEIF(kdid == numrar) THEN |
---|
| 649 | cdcont = cr_ablrst_cxt |
---|
[13970] | 650 | ELSEIF(kdid == numrtr) THEN |
---|
| 651 | cdcont = cr_toprst_cxt |
---|
| 652 | ELSEIF(kdid == numrsr) THEN |
---|
| 653 | cdcont = cr_sedrst_cxt |
---|
| 654 | ENDIF |
---|
| 655 | ENDIF |
---|
| 656 | |
---|
| 657 | IF(lwxios) THEN |
---|
| 658 | IF(kdid == numrow) THEN |
---|
| 659 | cdcont = cw_ocerst_cxt |
---|
| 660 | ELSEIF(kdid == numriw) THEN |
---|
| 661 | cdcont = cw_icerst_cxt |
---|
[14822] | 662 | ELSEIF(kdid == numraw) THEN |
---|
| 663 | cdcont = cw_ablrst_cxt |
---|
[13970] | 664 | ELSEIF(kdid == numrtw) THEN |
---|
| 665 | cdcont = cw_toprst_cxt |
---|
| 666 | ELSEIF(kdid == numrsw) THEN |
---|
| 667 | cdcont = cw_sedrst_cxt |
---|
| 668 | ENDIF |
---|
| 669 | ENDIF |
---|
| 670 | END SUBROUTINE set_xios_context |
---|
| 671 | |
---|
| 672 | |
---|
[4152] | 673 | SUBROUTINE iom_swap( cdname ) |
---|
[1793] | 674 | !!--------------------------------------------------------------------- |
---|
| 675 | !! *** SUBROUTINE iom_swap *** |
---|
| 676 | !! |
---|
| 677 | !! ** Purpose : swap context between different agrif grid for xmlio_server |
---|
| 678 | !!--------------------------------------------------------------------- |
---|
[4152] | 679 | CHARACTER(len=*), INTENT(in) :: cdname |
---|
[14822] | 680 | #if defined key_xios |
---|
[3695] | 681 | TYPE(xios_context) :: nemo_hdl |
---|
[4152] | 682 | IF( TRIM(Agrif_CFixed()) == '0' ) THEN |
---|
| 683 | CALL xios_get_handle(TRIM(cdname),nemo_hdl) |
---|
| 684 | ELSE |
---|
| 685 | CALL xios_get_handle(TRIM(Agrif_CFixed())//"_"//TRIM(cdname),nemo_hdl) |
---|
| 686 | ENDIF |
---|
| 687 | ! |
---|
| 688 | CALL xios_set_current_context(nemo_hdl) |
---|
[1793] | 689 | #endif |
---|
[4152] | 690 | ! |
---|
[1793] | 691 | END SUBROUTINE iom_swap |
---|
| 692 | |
---|
| 693 | |
---|
[13286] | 694 | SUBROUTINE iom_open( cdname, kiomid, ldwrt, ldstop, ldiof, kdlev, cdcomp ) |
---|
[544] | 695 | !!--------------------------------------------------------------------- |
---|
| 696 | !! *** SUBROUTINE iom_open *** |
---|
| 697 | !! |
---|
| 698 | !! ** Purpose : open an input file (return 0 if not found) |
---|
| 699 | !!--------------------------------------------------------------------- |
---|
| 700 | CHARACTER(len=*), INTENT(in ) :: cdname ! File name |
---|
| 701 | INTEGER , INTENT( out) :: kiomid ! iom identifier of the opened file |
---|
| 702 | LOGICAL , INTENT(in ), OPTIONAL :: ldwrt ! open in write modeb (default = .FALSE.) |
---|
[679] | 703 | LOGICAL , INTENT(in ), OPTIONAL :: ldstop ! stop if open to read a non-existing file (default = .TRUE.) |
---|
[1319] | 704 | LOGICAL , INTENT(in ), OPTIONAL :: ldiof ! Interp On the Fly, needed for AGRIF (default = .FALSE.) |
---|
[9019] | 705 | INTEGER , INTENT(in ), OPTIONAL :: kdlev ! number of vertical levels |
---|
[12649] | 706 | CHARACTER(len=3), INTENT(in ), OPTIONAL :: cdcomp ! name of component calling iom_nf90_open |
---|
[9019] | 707 | ! |
---|
[4148] | 708 | CHARACTER(LEN=256) :: clname ! the name of the file based on cdname [[+clcpu]+clcpu] |
---|
| 709 | CHARACTER(LEN=256) :: cltmpn ! tempory name to store clname (in writting mode) |
---|
[14072] | 710 | CHARACTER(LEN=10) :: clsuffix ! ".nc" |
---|
[550] | 711 | CHARACTER(LEN=15) :: clcpu ! the cpu number (max jpmax_digits digits) |
---|
[4148] | 712 | CHARACTER(LEN=256) :: clinfo ! info character |
---|
[14072] | 713 | LOGICAL :: llok ! check the existence |
---|
[679] | 714 | LOGICAL :: llwrt ! local definition of ldwrt |
---|
| 715 | LOGICAL :: llstop ! local definition of ldstop |
---|
[1319] | 716 | LOGICAL :: lliof ! local definition of ldiof |
---|
[544] | 717 | INTEGER :: icnt ! counter for digits in clcpu (max = jpmax_digits) |
---|
| 718 | INTEGER :: iln, ils ! lengths of character |
---|
[14072] | 719 | INTEGER :: istop ! |
---|
[544] | 720 | ! local number of points for x,y dimensions |
---|
| 721 | ! position of first local point for x,y dimensions |
---|
| 722 | ! position of last local point for x,y dimensions |
---|
| 723 | ! start halo size for x,y dimensions |
---|
| 724 | ! end halo size for x,y dimensions |
---|
| 725 | !--------------------------------------------------------------------- |
---|
| 726 | ! Initializations and control |
---|
| 727 | ! ============= |
---|
[1341] | 728 | kiomid = -1 |
---|
[544] | 729 | clinfo = ' iom_open ~~~ ' |
---|
| 730 | istop = nstop |
---|
| 731 | ! if iom_open is called for the first time: initialize iom_file(:)%nfid to 0 |
---|
| 732 | ! (could be done when defining iom_file in f95 but not in f90) |
---|
[1441] | 733 | IF( Agrif_Root() ) THEN |
---|
| 734 | IF( iom_open_init == 0 ) THEN |
---|
| 735 | iom_file(:)%nfid = 0 |
---|
| 736 | iom_open_init = 1 |
---|
| 737 | ENDIF |
---|
[1409] | 738 | ENDIF |
---|
[544] | 739 | ! do we read or write the file? |
---|
| 740 | IF( PRESENT(ldwrt) ) THEN ; llwrt = ldwrt |
---|
| 741 | ELSE ; llwrt = .FALSE. |
---|
| 742 | ENDIF |
---|
[679] | 743 | ! do we call ctl_stop if we try to open a non-existing file in read mode? |
---|
| 744 | IF( PRESENT(ldstop) ) THEN ; llstop = ldstop |
---|
| 745 | ELSE ; llstop = .TRUE. |
---|
| 746 | ENDIF |
---|
[1319] | 747 | ! are we using interpolation on the fly? |
---|
| 748 | IF( PRESENT(ldiof) ) THEN ; lliof = ldiof |
---|
| 749 | ELSE ; lliof = .FALSE. |
---|
| 750 | ENDIF |
---|
[544] | 751 | ! create the file name by added, if needed, TRIM(Agrif_CFixed()) and TRIM(clsuffix) |
---|
| 752 | ! ============= |
---|
| 753 | clname = trim(cdname) |
---|
[1319] | 754 | IF ( .NOT. Agrif_Root() .AND. .NOT. lliof ) THEN |
---|
[14072] | 755 | iln = INDEX(clname,'/') |
---|
[1200] | 756 | cltmpn = clname(1:iln) |
---|
| 757 | clname = clname(iln+1:LEN_TRIM(clname)) |
---|
| 758 | clname=TRIM(cltmpn)//TRIM(Agrif_CFixed())//'_'//TRIM(clname) |
---|
| 759 | ENDIF |
---|
[544] | 760 | ! which suffix should we use? |
---|
[10425] | 761 | clsuffix = '.nc' |
---|
[544] | 762 | ! Add the suffix if needed |
---|
| 763 | iln = LEN_TRIM(clname) |
---|
| 764 | ils = LEN_TRIM(clsuffix) |
---|
[742] | 765 | IF( iln <= ils .OR. INDEX( TRIM(clname), TRIM(clsuffix), back = .TRUE. ) /= iln - ils + 1 ) & |
---|
| 766 | & clname = TRIM(clname)//TRIM(clsuffix) |
---|
[544] | 767 | cltmpn = clname ! store this name |
---|
| 768 | ! try to find if the file to be opened already exist |
---|
| 769 | ! ============= |
---|
| 770 | INQUIRE( FILE = clname, EXIST = llok ) |
---|
| 771 | IF( .NOT.llok ) THEN |
---|
| 772 | ! we try to add the cpu number to the name |
---|
[6140] | 773 | WRITE(clcpu,*) narea-1 |
---|
| 774 | |
---|
[544] | 775 | clcpu = TRIM(ADJUSTL(clcpu)) |
---|
[679] | 776 | iln = INDEX(clname,TRIM(clsuffix), back = .TRUE.) |
---|
[544] | 777 | clname = clname(1:iln-1)//'_'//TRIM(clcpu)//TRIM(clsuffix) |
---|
| 778 | icnt = 0 |
---|
[14072] | 779 | INQUIRE( FILE = clname, EXIST = llok ) |
---|
[544] | 780 | ! we try different formats for the cpu number by adding 0 |
---|
| 781 | DO WHILE( .NOT.llok .AND. icnt < jpmax_digits ) |
---|
| 782 | clcpu = "0"//trim(clcpu) |
---|
| 783 | clname = clname(1:iln-1)//'_'//TRIM(clcpu)//TRIM(clsuffix) |
---|
| 784 | INQUIRE( FILE = clname, EXIST = llok ) |
---|
| 785 | icnt = icnt + 1 |
---|
| 786 | END DO |
---|
[9367] | 787 | ELSE |
---|
| 788 | lxios_sini = .TRUE. |
---|
[544] | 789 | ENDIF |
---|
[6140] | 790 | ! Open the NetCDF file |
---|
[544] | 791 | ! ============= |
---|
| 792 | ! do we have some free file identifier? |
---|
| 793 | IF( MINVAL(iom_file(:)%nfid) /= 0 ) & |
---|
[679] | 794 | & CALL ctl_stop( TRIM(clinfo), 'No more free file identifier', 'increase jpmax_files in iom_def' ) |
---|
| 795 | ! if no file was found... |
---|
| 796 | IF( .NOT. llok ) THEN |
---|
[14072] | 797 | IF( .NOT. llwrt ) THEN ! we are in read mode |
---|
[679] | 798 | IF( llstop ) THEN ; CALL ctl_stop( TRIM(clinfo), 'File '//TRIM(cltmpn)//'* not found' ) |
---|
| 799 | ELSE ; istop = nstop + 1 ! make sure that istop /= nstop so we don't open the file |
---|
| 800 | ENDIF |
---|
[14072] | 801 | ELSE ! we are in write mode so we |
---|
[679] | 802 | clname = cltmpn ! get back the file name without the cpu number |
---|
| 803 | ENDIF |
---|
[2586] | 804 | ELSE |
---|
[14072] | 805 | IF( llwrt .AND. .NOT. ln_clobber ) THEN ! we stop as we want to write in a new file |
---|
[2586] | 806 | CALL ctl_stop( TRIM(clinfo), 'We want to write in a new file but '//TRIM(clname)//' already exists...' ) |
---|
| 807 | istop = nstop + 1 ! make sure that istop /= nstop so we don't open the file |
---|
[14072] | 808 | ELSEIF( llwrt ) THEN ! the file exists and we are in write mode with permission to |
---|
[4650] | 809 | clname = cltmpn ! overwrite so get back the file name without the cpu number |
---|
[2586] | 810 | ENDIF |
---|
[679] | 811 | ENDIF |
---|
[544] | 812 | IF( istop == nstop ) THEN ! no error within this routine |
---|
[13286] | 813 | CALL iom_nf90_open( clname, kiomid, llwrt, llok, kdlev = kdlev, cdcomp = cdcomp ) |
---|
[544] | 814 | ENDIF |
---|
| 815 | ! |
---|
| 816 | END SUBROUTINE iom_open |
---|
| 817 | |
---|
| 818 | |
---|
| 819 | SUBROUTINE iom_close( kiomid ) |
---|
| 820 | !!-------------------------------------------------------------------- |
---|
| 821 | !! *** SUBROUTINE iom_close *** |
---|
| 822 | !! |
---|
| 823 | !! ** Purpose : close an input file, or all files opened by iom |
---|
| 824 | !!-------------------------------------------------------------------- |
---|
[1131] | 825 | INTEGER, INTENT(inout), OPTIONAL :: kiomid ! iom identifier of the file to be closed |
---|
| 826 | ! ! return 0 when file is properly closed |
---|
| 827 | ! ! No argument: all files opened by iom are closed |
---|
[544] | 828 | |
---|
| 829 | INTEGER :: jf ! dummy loop indices |
---|
| 830 | INTEGER :: i_s, i_e ! temporary integer |
---|
| 831 | CHARACTER(LEN=100) :: clinfo ! info character |
---|
| 832 | !--------------------------------------------------------------------- |
---|
| 833 | ! |
---|
[12283] | 834 | IF( iom_open_init == 0 ) RETURN ! avoid to use iom_file(jf)%nfid that us not yet initialized |
---|
| 835 | ! |
---|
[544] | 836 | clinfo = ' iom_close ~~~ ' |
---|
| 837 | IF( PRESENT(kiomid) ) THEN |
---|
| 838 | i_s = kiomid |
---|
| 839 | i_e = kiomid |
---|
| 840 | ELSE |
---|
| 841 | i_s = 1 |
---|
| 842 | i_e = jpmax_files |
---|
| 843 | ENDIF |
---|
| 844 | |
---|
| 845 | IF( i_s > 0 ) THEN |
---|
| 846 | DO jf = i_s, i_e |
---|
| 847 | IF( iom_file(jf)%nfid > 0 ) THEN |
---|
[10425] | 848 | CALL iom_nf90_close( jf ) |
---|
[14072] | 849 | iom_file(jf)%nfid = 0 ! free the id |
---|
[1131] | 850 | IF( PRESENT(kiomid) ) kiomid = 0 ! return 0 as id to specify that the file was closed |
---|
[679] | 851 | IF(lwp) WRITE(numout,*) TRIM(clinfo)//' close file: '//TRIM(iom_file(jf)%name)//' ok' |
---|
[544] | 852 | ELSEIF( PRESENT(kiomid) ) THEN |
---|
| 853 | WRITE(ctmp1,*) '--->', kiomid |
---|
| 854 | CALL ctl_stop( TRIM(clinfo)//' Invalid file identifier', ctmp1 ) |
---|
| 855 | ENDIF |
---|
| 856 | END DO |
---|
| 857 | ENDIF |
---|
[14072] | 858 | ! |
---|
[544] | 859 | END SUBROUTINE iom_close |
---|
| 860 | |
---|
| 861 | |
---|
[14072] | 862 | FUNCTION iom_varid ( kiomid, cdvar, kdimsz, kndims, lduld, ldstop ) |
---|
[544] | 863 | !!----------------------------------------------------------------------- |
---|
| 864 | !! *** FUNCTION iom_varid *** |
---|
| 865 | !! |
---|
| 866 | !! ** Purpose : get the id of a variable in a file (return 0 if not found) |
---|
| 867 | !!----------------------------------------------------------------------- |
---|
| 868 | INTEGER , INTENT(in ) :: kiomid ! file Identifier |
---|
| 869 | CHARACTER(len=*) , INTENT(in ) :: cdvar ! name of the variable |
---|
[9540] | 870 | INTEGER, DIMENSION(:), INTENT( out), OPTIONAL :: kdimsz ! size of each dimension |
---|
[11536] | 871 | INTEGER , INTENT( out), OPTIONAL :: kndims ! number of dimensions |
---|
| 872 | LOGICAL , INTENT( out), OPTIONAL :: lduld ! true if the last dimension is unlimited (time) |
---|
[745] | 873 | LOGICAL , INTENT(in ), OPTIONAL :: ldstop ! stop if looking for non-existing variable (default = .TRUE.) |
---|
[544] | 874 | ! |
---|
| 875 | INTEGER :: iom_varid, iiv, i_nvd |
---|
| 876 | LOGICAL :: ll_fnd |
---|
| 877 | CHARACTER(LEN=100) :: clinfo ! info character |
---|
[745] | 878 | LOGICAL :: llstop ! local definition of ldstop |
---|
[544] | 879 | !!----------------------------------------------------------------------- |
---|
| 880 | iom_varid = 0 ! default definition |
---|
[745] | 881 | ! do we call ctl_stop if we look for non-existing variable? |
---|
| 882 | IF( PRESENT(ldstop) ) THEN ; llstop = ldstop |
---|
| 883 | ELSE ; llstop = .TRUE. |
---|
| 884 | ENDIF |
---|
[544] | 885 | ! |
---|
| 886 | IF( kiomid > 0 ) THEN |
---|
[679] | 887 | clinfo = 'iom_varid, file: '//trim(iom_file(kiomid)%name)//', var: '//trim(cdvar) |
---|
[14072] | 888 | IF( iom_file(kiomid)%nfid == 0 ) THEN |
---|
[544] | 889 | CALL ctl_stop( trim(clinfo), 'the file is not open' ) |
---|
| 890 | ELSE |
---|
| 891 | ll_fnd = .FALSE. |
---|
| 892 | iiv = 0 |
---|
| 893 | ! |
---|
| 894 | DO WHILE ( .NOT.ll_fnd .AND. iiv < iom_file(kiomid)%nvars ) |
---|
| 895 | iiv = iiv + 1 |
---|
| 896 | ll_fnd = ( TRIM(cdvar) == TRIM(iom_file(kiomid)%cn_var(iiv)) ) |
---|
| 897 | END DO |
---|
| 898 | ! |
---|
| 899 | IF( .NOT.ll_fnd ) THEN |
---|
| 900 | iiv = iiv + 1 |
---|
| 901 | IF( iiv <= jpmax_vars ) THEN |
---|
[11536] | 902 | iom_varid = iom_nf90_varid( kiomid, cdvar, iiv, kdimsz, kndims, lduld ) |
---|
[544] | 903 | ELSE |
---|
| 904 | CALL ctl_stop( trim(clinfo), 'Too many variables in the file '//iom_file(kiomid)%name, & |
---|
[10425] | 905 | & 'increase the parameter jpmax_vars') |
---|
[544] | 906 | ENDIF |
---|
[14072] | 907 | IF( llstop .AND. iom_varid == -1 ) CALL ctl_stop( TRIM(clinfo)//' not found' ) |
---|
[544] | 908 | ELSE |
---|
| 909 | iom_varid = iiv |
---|
[14072] | 910 | IF( PRESENT(kdimsz) ) THEN |
---|
[544] | 911 | i_nvd = iom_file(kiomid)%ndims(iiv) |
---|
[9540] | 912 | IF( i_nvd <= size(kdimsz) ) THEN |
---|
| 913 | kdimsz(1:i_nvd) = iom_file(kiomid)%dimsz(1:i_nvd,iiv) |
---|
[544] | 914 | ELSE |
---|
| 915 | WRITE(ctmp1,*) i_nvd, size(kdimsz) |
---|
| 916 | CALL ctl_stop( trim(clinfo), 'error in kdimsz size'//trim(ctmp1) ) |
---|
| 917 | ENDIF |
---|
| 918 | ENDIF |
---|
[4205] | 919 | IF( PRESENT(kndims) ) kndims = iom_file(kiomid)%ndims(iiv) |
---|
[11536] | 920 | IF( PRESENT( lduld) ) lduld = iom_file(kiomid)%luld( iiv) |
---|
[544] | 921 | ENDIF |
---|
| 922 | ENDIF |
---|
| 923 | ENDIF |
---|
| 924 | ! |
---|
| 925 | END FUNCTION iom_varid |
---|
| 926 | |
---|
| 927 | |
---|
| 928 | !!---------------------------------------------------------------------- |
---|
| 929 | !! INTERFACE iom_get |
---|
| 930 | !!---------------------------------------------------------------------- |
---|
[13970] | 931 | SUBROUTINE iom_g0d_sp( kiomid, cdvar, pvar, ktime ) |
---|
[544] | 932 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 933 | CHARACTER(len=*), INTENT(in ) :: cdvar ! Name of the variable |
---|
[13226] | 934 | REAL(sp) , INTENT( out) :: pvar ! read field |
---|
| 935 | REAL(dp) :: ztmp_pvar ! tmp var to read field |
---|
[4245] | 936 | INTEGER , INTENT(in ), OPTIONAL :: ktime ! record number |
---|
[544] | 937 | ! |
---|
[4245] | 938 | INTEGER :: idvar ! variable id |
---|
| 939 | INTEGER :: idmspc ! number of spatial dimensions |
---|
| 940 | INTEGER , DIMENSION(1) :: itime ! record number |
---|
| 941 | CHARACTER(LEN=100) :: clinfo ! info character |
---|
| 942 | CHARACTER(LEN=100) :: clname ! file name |
---|
| 943 | CHARACTER(LEN=1) :: cldmspc ! |
---|
[13970] | 944 | CHARACTER(LEN=lc) :: context |
---|
[544] | 945 | ! |
---|
[13970] | 946 | CALL set_xios_context(kiomid, context) |
---|
[9367] | 947 | |
---|
[13970] | 948 | IF(context == "NONE") THEN ! read data using default library |
---|
[9367] | 949 | itime = 1 |
---|
| 950 | IF( PRESENT(ktime) ) itime = ktime |
---|
| 951 | ! |
---|
| 952 | clname = iom_file(kiomid)%name |
---|
| 953 | clinfo = ' iom_g0d, file: '//trim(clname)//', var: '//trim(cdvar) |
---|
| 954 | ! |
---|
| 955 | IF( kiomid > 0 ) THEN |
---|
| 956 | idvar = iom_varid( kiomid, cdvar ) |
---|
| 957 | IF( iom_file(kiomid)%nfid > 0 .AND. idvar > 0 ) THEN |
---|
| 958 | idmspc = iom_file ( kiomid )%ndims( idvar ) |
---|
| 959 | IF( iom_file(kiomid)%luld(idvar) ) idmspc = idmspc - 1 |
---|
| 960 | WRITE(cldmspc , fmt='(i1)') idmspc |
---|
| 961 | IF( idmspc > 0 ) CALL ctl_stop( TRIM(clinfo), 'When reading to a 0D array, we do not accept data', & |
---|
| 962 | & 'with 1 or more spatial dimensions: '//cldmspc//' were found.' , & |
---|
| 963 | & 'Use ncwa -a to suppress the unnecessary dimensions' ) |
---|
[13226] | 964 | CALL iom_nf90_get( kiomid, idvar, ztmp_pvar, itime ) |
---|
| 965 | pvar = ztmp_pvar |
---|
| 966 | ENDIF |
---|
| 967 | ENDIF |
---|
| 968 | ELSE |
---|
[14822] | 969 | #if defined key_xios |
---|
[13226] | 970 | IF(lwp) WRITE(numout,*) 'XIOS RST READ (0D): ', trim(cdvar) |
---|
[13970] | 971 | CALL iom_swap(context) |
---|
[13226] | 972 | CALL xios_recv_field( trim(cdvar), pvar) |
---|
[13970] | 973 | CALL iom_swap(cxios_context) |
---|
[13226] | 974 | #else |
---|
| 975 | WRITE(ctmp1,*) 'Can not use XIOS in iom_g0d, file: '//trim(clname)//', var:'//trim(cdvar) |
---|
| 976 | CALL ctl_stop( 'iom_g0d', ctmp1 ) |
---|
| 977 | #endif |
---|
| 978 | ENDIF |
---|
| 979 | END SUBROUTINE iom_g0d_sp |
---|
| 980 | |
---|
[13970] | 981 | SUBROUTINE iom_g0d_dp( kiomid, cdvar, pvar, ktime ) |
---|
[13226] | 982 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 983 | CHARACTER(len=*), INTENT(in ) :: cdvar ! Name of the variable |
---|
| 984 | REAL(dp) , INTENT( out) :: pvar ! read field |
---|
| 985 | INTEGER , INTENT(in ), OPTIONAL :: ktime ! record number |
---|
| 986 | ! |
---|
| 987 | INTEGER :: idvar ! variable id |
---|
| 988 | INTEGER :: idmspc ! number of spatial dimensions |
---|
| 989 | INTEGER , DIMENSION(1) :: itime ! record number |
---|
| 990 | CHARACTER(LEN=100) :: clinfo ! info character |
---|
| 991 | CHARACTER(LEN=100) :: clname ! file name |
---|
| 992 | CHARACTER(LEN=1) :: cldmspc ! |
---|
[13970] | 993 | CHARACTER(LEN=lc) :: context |
---|
[13226] | 994 | ! |
---|
[13970] | 995 | CALL set_xios_context(kiomid, context) |
---|
[13226] | 996 | |
---|
[13970] | 997 | IF(context == "NONE") THEN ! read data using default library |
---|
[13226] | 998 | itime = 1 |
---|
| 999 | IF( PRESENT(ktime) ) itime = ktime |
---|
| 1000 | ! |
---|
| 1001 | clname = iom_file(kiomid)%name |
---|
| 1002 | clinfo = ' iom_g0d, file: '//trim(clname)//', var: '//trim(cdvar) |
---|
| 1003 | ! |
---|
| 1004 | IF( kiomid > 0 ) THEN |
---|
| 1005 | idvar = iom_varid( kiomid, cdvar ) |
---|
| 1006 | IF( iom_file(kiomid)%nfid > 0 .AND. idvar > 0 ) THEN |
---|
| 1007 | idmspc = iom_file ( kiomid )%ndims( idvar ) |
---|
| 1008 | IF( iom_file(kiomid)%luld(idvar) ) idmspc = idmspc - 1 |
---|
| 1009 | WRITE(cldmspc , fmt='(i1)') idmspc |
---|
| 1010 | IF( idmspc > 0 ) CALL ctl_stop( TRIM(clinfo), 'When reading to a 0D array, we do not accept data', & |
---|
| 1011 | & 'with 1 or more spatial dimensions: '//cldmspc//' were found.' , & |
---|
| 1012 | & 'Use ncwa -a to suppress the unnecessary dimensions' ) |
---|
[10425] | 1013 | CALL iom_nf90_get( kiomid, idvar, pvar, itime ) |
---|
[9367] | 1014 | ENDIF |
---|
[679] | 1015 | ENDIF |
---|
[9367] | 1016 | ELSE |
---|
[14822] | 1017 | #if defined key_xios |
---|
[9367] | 1018 | IF(lwp) WRITE(numout,*) 'XIOS RST READ (0D): ', trim(cdvar) |
---|
[13970] | 1019 | CALL iom_swap(context) |
---|
[9367] | 1020 | CALL xios_recv_field( trim(cdvar), pvar) |
---|
[13970] | 1021 | CALL iom_swap(cxios_context) |
---|
[9535] | 1022 | #else |
---|
[10425] | 1023 | WRITE(ctmp1,*) 'Can not use XIOS in iom_g0d, file: '//trim(clname)//', var:'//trim(cdvar) |
---|
| 1024 | CALL ctl_stop( 'iom_g0d', ctmp1 ) |
---|
[9535] | 1025 | #endif |
---|
[679] | 1026 | ENDIF |
---|
[13226] | 1027 | END SUBROUTINE iom_g0d_dp |
---|
[544] | 1028 | |
---|
[13970] | 1029 | SUBROUTINE iom_g1d_sp( kiomid, kdom, cdvar, pvar, ktime, kstart, kcount ) |
---|
[544] | 1030 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1031 | INTEGER , INTENT(in ) :: kdom ! Type of domain to be read |
---|
| 1032 | CHARACTER(len=*), INTENT(in ) :: cdvar ! Name of the variable |
---|
[13226] | 1033 | REAL(sp) , INTENT( out), DIMENSION(:) :: pvar ! read field |
---|
| 1034 | REAL(dp) , ALLOCATABLE , DIMENSION(:) :: ztmp_pvar ! tmp var to read field |
---|
[544] | 1035 | INTEGER , INTENT(in ) , OPTIONAL :: ktime ! record number |
---|
[14072] | 1036 | INTEGER , INTENT(in ), DIMENSION(1), OPTIONAL :: kstart ! start axis position of the reading |
---|
[544] | 1037 | INTEGER , INTENT(in ), DIMENSION(1), OPTIONAL :: kcount ! number of points in each axis |
---|
| 1038 | ! |
---|
[679] | 1039 | IF( kiomid > 0 ) THEN |
---|
[13226] | 1040 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
| 1041 | ALLOCATE(ztmp_pvar(size(pvar,1))) |
---|
| 1042 | CALL iom_get_123d( kiomid, kdom , cdvar , pv_r1d=ztmp_pvar, & |
---|
[13970] | 1043 | & ktime=ktime, kstart=kstart, kcount=kcount ) |
---|
[13226] | 1044 | pvar = ztmp_pvar |
---|
| 1045 | DEALLOCATE(ztmp_pvar) |
---|
| 1046 | END IF |
---|
| 1047 | ENDIF |
---|
| 1048 | END SUBROUTINE iom_g1d_sp |
---|
| 1049 | |
---|
| 1050 | |
---|
[13970] | 1051 | SUBROUTINE iom_g1d_dp( kiomid, kdom, cdvar, pvar, ktime, kstart, kcount ) |
---|
[13226] | 1052 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1053 | INTEGER , INTENT(in ) :: kdom ! Type of domain to be read |
---|
| 1054 | CHARACTER(len=*), INTENT(in ) :: cdvar ! Name of the variable |
---|
| 1055 | REAL(dp) , INTENT( out), DIMENSION(:) :: pvar ! read field |
---|
| 1056 | INTEGER , INTENT(in ) , OPTIONAL :: ktime ! record number |
---|
[14072] | 1057 | INTEGER , INTENT(in ), DIMENSION(1), OPTIONAL :: kstart ! start axis position of the reading |
---|
[13226] | 1058 | INTEGER , INTENT(in ), DIMENSION(1), OPTIONAL :: kcount ! number of points in each axis |
---|
| 1059 | ! |
---|
| 1060 | IF( kiomid > 0 ) THEN |
---|
[679] | 1061 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_get_123d( kiomid, kdom , cdvar , pv_r1d=pvar, & |
---|
[13970] | 1062 | & ktime=ktime, kstart=kstart, kcount=kcount) |
---|
[679] | 1063 | ENDIF |
---|
[13226] | 1064 | END SUBROUTINE iom_g1d_dp |
---|
[544] | 1065 | |
---|
[13970] | 1066 | SUBROUTINE iom_g2d_sp( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kfill, kstart, kcount) |
---|
[13286] | 1067 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1068 | INTEGER , INTENT(in ) :: kdom ! Type of domain to be read |
---|
| 1069 | CHARACTER(len=*), INTENT(in ) :: cdvar ! Name of the variable |
---|
| 1070 | REAL(sp) , INTENT( out), DIMENSION(:,:) :: pvar ! read field |
---|
| 1071 | REAL(dp) , ALLOCATABLE , DIMENSION(:,:) :: ztmp_pvar ! tmp var to read field |
---|
| 1072 | INTEGER , INTENT(in ) , OPTIONAL :: ktime ! record number |
---|
| 1073 | CHARACTER(len=1), INTENT(in ) , OPTIONAL :: cd_type ! nature of grid-points (T, U, V, F, W) |
---|
| 1074 | REAL(dp) , INTENT(in ) , OPTIONAL :: psgn ! -1.(1.): (not) change sign across the north fold |
---|
| 1075 | INTEGER , INTENT(in ) , OPTIONAL :: kfill ! value of kfillmode in lbc_lbk |
---|
[14072] | 1076 | INTEGER , INTENT(in ), DIMENSION(2), OPTIONAL :: kstart ! start axis position of the reading |
---|
[13286] | 1077 | INTEGER , INTENT(in ), DIMENSION(2), OPTIONAL :: kcount ! number of points in each axis |
---|
[544] | 1078 | ! |
---|
[679] | 1079 | IF( kiomid > 0 ) THEN |
---|
[13226] | 1080 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
| 1081 | ALLOCATE(ztmp_pvar(size(pvar,1), size(pvar,2))) |
---|
[13286] | 1082 | CALL iom_get_123d( kiomid, kdom, cdvar , pv_r2d = ztmp_pvar , ktime = ktime, & |
---|
| 1083 | & cd_type = cd_type, psgn = psgn , kfill = kfill, & |
---|
[13970] | 1084 | & kstart = kstart , kcount = kcount ) |
---|
[13226] | 1085 | pvar = ztmp_pvar |
---|
| 1086 | DEALLOCATE(ztmp_pvar) |
---|
[13286] | 1087 | ENDIF |
---|
[13226] | 1088 | ENDIF |
---|
| 1089 | END SUBROUTINE iom_g2d_sp |
---|
| 1090 | |
---|
[13970] | 1091 | SUBROUTINE iom_g2d_dp( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kfill, kstart, kcount) |
---|
[13286] | 1092 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1093 | INTEGER , INTENT(in ) :: kdom ! Type of domain to be read |
---|
| 1094 | CHARACTER(len=*), INTENT(in ) :: cdvar ! Name of the variable |
---|
| 1095 | REAL(dp) , INTENT( out), DIMENSION(:,:) :: pvar ! read field |
---|
| 1096 | INTEGER , INTENT(in ) , OPTIONAL :: ktime ! record number |
---|
| 1097 | CHARACTER(len=1), INTENT(in ) , OPTIONAL :: cd_type ! nature of grid-points (T, U, V, F, W) |
---|
| 1098 | REAL(dp) , INTENT(in ) , OPTIONAL :: psgn ! -1.(1.): (not) change sign across the north fold |
---|
| 1099 | INTEGER , INTENT(in ) , OPTIONAL :: kfill ! value of kfillmode in lbc_lbk |
---|
[14072] | 1100 | INTEGER , INTENT(in ), DIMENSION(2), OPTIONAL :: kstart ! start axis position of the reading |
---|
[13286] | 1101 | INTEGER , INTENT(in ), DIMENSION(2), OPTIONAL :: kcount ! number of points in each axis |
---|
[13226] | 1102 | ! |
---|
| 1103 | IF( kiomid > 0 ) THEN |
---|
[13286] | 1104 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_get_123d( kiomid, kdom, cdvar , pv_r2d = pvar , ktime = ktime, & |
---|
| 1105 | & cd_type = cd_type, psgn = psgn , kfill = kfill, & |
---|
[13970] | 1106 | & kstart = kstart , kcount = kcount ) |
---|
[679] | 1107 | ENDIF |
---|
[13226] | 1108 | END SUBROUTINE iom_g2d_dp |
---|
[544] | 1109 | |
---|
[13970] | 1110 | SUBROUTINE iom_g3d_sp( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kfill, kstart, kcount ) |
---|
[13286] | 1111 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1112 | INTEGER , INTENT(in ) :: kdom ! Type of domain to be read |
---|
| 1113 | CHARACTER(len=*), INTENT(in ) :: cdvar ! Name of the variable |
---|
| 1114 | REAL(sp) , INTENT( out), DIMENSION(:,:,:) :: pvar ! read field |
---|
| 1115 | REAL(dp) , ALLOCATABLE , DIMENSION(:,:,:) :: ztmp_pvar ! tmp var to read field |
---|
| 1116 | INTEGER , INTENT(in ) , OPTIONAL :: ktime ! record number |
---|
| 1117 | CHARACTER(len=1), INTENT(in ) , OPTIONAL :: cd_type ! nature of grid-points (T, U, V, F, W) |
---|
| 1118 | REAL(dp) , INTENT(in ) , OPTIONAL :: psgn ! -1.(1.) : (not) change sign across the north fold |
---|
| 1119 | INTEGER , INTENT(in ) , OPTIONAL :: kfill ! value of kfillmode in lbc_lbk |
---|
[14072] | 1120 | INTEGER , INTENT(in ), DIMENSION(3), OPTIONAL :: kstart ! start axis position of the reading |
---|
[13286] | 1121 | INTEGER , INTENT(in ), DIMENSION(3), OPTIONAL :: kcount ! number of points in each axis |
---|
[544] | 1122 | ! |
---|
[679] | 1123 | IF( kiomid > 0 ) THEN |
---|
[13226] | 1124 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
| 1125 | ALLOCATE(ztmp_pvar(size(pvar,1), size(pvar,2), size(pvar,3))) |
---|
[13286] | 1126 | CALL iom_get_123d( kiomid, kdom, cdvar , pv_r3d = ztmp_pvar , ktime = ktime, & |
---|
| 1127 | & cd_type = cd_type, psgn = psgn , kfill = kfill, & |
---|
[13970] | 1128 | & kstart = kstart , kcount = kcount ) |
---|
[13226] | 1129 | pvar = ztmp_pvar |
---|
| 1130 | DEALLOCATE(ztmp_pvar) |
---|
| 1131 | END IF |
---|
| 1132 | ENDIF |
---|
| 1133 | END SUBROUTINE iom_g3d_sp |
---|
| 1134 | |
---|
[13970] | 1135 | SUBROUTINE iom_g3d_dp( kiomid, kdom, cdvar, pvar, ktime, cd_type, psgn, kfill, kstart, kcount ) |
---|
[13286] | 1136 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1137 | INTEGER , INTENT(in ) :: kdom ! Type of domain to be read |
---|
| 1138 | CHARACTER(len=*), INTENT(in ) :: cdvar ! Name of the variable |
---|
| 1139 | REAL(dp) , INTENT( out), DIMENSION(:,:,:) :: pvar ! read field |
---|
| 1140 | INTEGER , INTENT(in ) , OPTIONAL :: ktime ! record number |
---|
| 1141 | CHARACTER(len=1), INTENT(in ) , OPTIONAL :: cd_type ! nature of grid-points (T, U, V, F, W) |
---|
| 1142 | REAL(dp) , INTENT(in ) , OPTIONAL :: psgn ! -1.(1.) : (not) change sign across the north fold |
---|
| 1143 | INTEGER , INTENT(in ) , OPTIONAL :: kfill ! value of kfillmode in lbc_lbk |
---|
[14072] | 1144 | INTEGER , INTENT(in ), DIMENSION(3), OPTIONAL :: kstart ! start axis position of the reading |
---|
[13286] | 1145 | INTEGER , INTENT(in ), DIMENSION(3), OPTIONAL :: kcount ! number of points in each axis |
---|
[13226] | 1146 | ! |
---|
| 1147 | IF( kiomid > 0 ) THEN |
---|
[13286] | 1148 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
| 1149 | CALL iom_get_123d( kiomid, kdom, cdvar , pv_r3d = pvar , ktime = ktime, & |
---|
| 1150 | & cd_type = cd_type, psgn = psgn , kfill = kfill, & |
---|
[13970] | 1151 | & kstart = kstart , kcount = kcount ) |
---|
[13286] | 1152 | END IF |
---|
[679] | 1153 | ENDIF |
---|
[13226] | 1154 | END SUBROUTINE iom_g3d_dp |
---|
| 1155 | |
---|
[544] | 1156 | !!---------------------------------------------------------------------- |
---|
| 1157 | |
---|
[13286] | 1158 | SUBROUTINE iom_get_123d( kiomid , kdom, cdvar, pv_r1d, pv_r2d, pv_r3d, ktime , & |
---|
[13970] | 1159 | & cd_type, psgn, kfill, kstart, kcount ) |
---|
[544] | 1160 | !!----------------------------------------------------------------------- |
---|
| 1161 | !! *** ROUTINE iom_get_123d *** |
---|
| 1162 | !! |
---|
| 1163 | !! ** Purpose : read a 1D/2D/3D variable |
---|
| 1164 | !! |
---|
| 1165 | !! ** Method : read ONE record at each CALL |
---|
| 1166 | !!----------------------------------------------------------------------- |
---|
[13286] | 1167 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1168 | INTEGER , INTENT(in ) :: kdom ! Type of domain to be read |
---|
| 1169 | CHARACTER(len=*) , INTENT(in ) :: cdvar ! Name of the variable |
---|
| 1170 | REAL(dp), DIMENSION(:) , INTENT( out), OPTIONAL :: pv_r1d ! read field (1D case) |
---|
| 1171 | REAL(dp), DIMENSION(:,:) , INTENT( out), OPTIONAL :: pv_r2d ! read field (2D case) |
---|
| 1172 | REAL(dp), DIMENSION(:,:,:) , INTENT( out), OPTIONAL :: pv_r3d ! read field (3D case) |
---|
| 1173 | INTEGER , INTENT(in ), OPTIONAL :: ktime ! record number |
---|
| 1174 | CHARACTER(len=1) , INTENT(in ), OPTIONAL :: cd_type ! nature of grid-points (T, U, V, F, W) |
---|
| 1175 | REAL(dp) , INTENT(in ), OPTIONAL :: psgn ! -1.(1.) : (not) change sign across the north fold |
---|
| 1176 | INTEGER , INTENT(in ), OPTIONAL :: kfill ! value of kfillmode in lbc_lbk |
---|
[14072] | 1177 | INTEGER , DIMENSION(:) , INTENT(in ), OPTIONAL :: kstart ! start position of the reading in each axis |
---|
[13286] | 1178 | INTEGER , DIMENSION(:) , INTENT(in ), OPTIONAL :: kcount ! number of points to be read in each axis |
---|
[544] | 1179 | ! |
---|
[13286] | 1180 | LOGICAL :: llok ! true if ok! |
---|
[14072] | 1181 | INTEGER :: jl ! loop on number of dimension |
---|
[544] | 1182 | INTEGER :: idom ! type of domain |
---|
| 1183 | INTEGER :: idvar ! id of the variable |
---|
| 1184 | INTEGER :: inbdim ! number of dimensions of the variable |
---|
[14072] | 1185 | INTEGER :: idmspc ! number of spatial dimensions |
---|
[544] | 1186 | INTEGER :: itime ! record number |
---|
| 1187 | INTEGER :: istop ! temporary value of nstop |
---|
[679] | 1188 | INTEGER :: ix1, ix2, iy1, iy2 ! subdomain indexes |
---|
| 1189 | INTEGER :: ji, jj ! loop counters |
---|
[14072] | 1190 | INTEGER :: irankpv ! |
---|
[679] | 1191 | INTEGER :: ind1, ind2 ! substring index |
---|
[544] | 1192 | INTEGER, DIMENSION(jpmax_dims) :: istart ! starting point to read for each axis |
---|
[14072] | 1193 | INTEGER, DIMENSION(jpmax_dims) :: icnt ! number of value to read along each axis |
---|
[544] | 1194 | INTEGER, DIMENSION(jpmax_dims) :: idimsz ! size of the dimensions of the variable |
---|
[679] | 1195 | INTEGER, DIMENSION(jpmax_dims) :: ishape ! size of the dimensions of the variable |
---|
[13226] | 1196 | REAL(dp) :: zscf, zofs ! sacle_factor and add_offset |
---|
[13286] | 1197 | REAL(wp) :: zsgn ! local value of psgn |
---|
[544] | 1198 | INTEGER :: itmp ! temporary integer |
---|
[4148] | 1199 | CHARACTER(LEN=256) :: clinfo ! info character |
---|
| 1200 | CHARACTER(LEN=256) :: clname ! file name |
---|
[14072] | 1201 | CHARACTER(LEN=1) :: clrankpv, cldmspc ! |
---|
[13286] | 1202 | CHARACTER(LEN=1) :: cl_type ! local value of cd_type |
---|
| 1203 | LOGICAL :: ll_only3rd ! T => if kstart, kcount present then *only* use values for 3rd spatial dimension. |
---|
[9019] | 1204 | INTEGER :: inlev ! number of levels for 3D data |
---|
[13226] | 1205 | REAL(dp) :: gma, gmi |
---|
[544] | 1206 | !--------------------------------------------------------------------- |
---|
[13970] | 1207 | CHARACTER(LEN=lc) :: context |
---|
[544] | 1208 | ! |
---|
[13970] | 1209 | CALL set_xios_context(kiomid, context) |
---|
[9019] | 1210 | inlev = -1 |
---|
| 1211 | IF( PRESENT(pv_r3d) ) inlev = SIZE(pv_r3d, 3) |
---|
[9367] | 1212 | ! |
---|
[544] | 1213 | idom = kdom |
---|
[13286] | 1214 | istop = nstop |
---|
[9367] | 1215 | ! |
---|
[13970] | 1216 | IF(context == "NONE") THEN |
---|
[9367] | 1217 | clname = iom_file(kiomid)%name ! esier to read |
---|
| 1218 | clinfo = ' iom_get_123d, file: '//trim(clname)//', var: '//trim(cdvar) |
---|
| 1219 | ! check kcount and kstart optionals parameters... |
---|
[13286] | 1220 | IF( PRESENT(kcount) .AND. .NOT. PRESENT(kstart) ) CALL ctl_stop(trim(clinfo), 'kcount present needs kstart present') |
---|
| 1221 | IF( PRESENT(kstart) .AND. .NOT. PRESENT(kcount) ) CALL ctl_stop(trim(clinfo), 'kstart present needs kcount present') |
---|
| 1222 | IF( PRESENT(kstart) .AND. idom /= jpdom_unknown .AND. idom /= jpdom_auto_xy ) & |
---|
| 1223 | & CALL ctl_stop(TRIM(clinfo), 'kstart present needs idom = jpdom_unknown or idom = jpdom_auto_xy') |
---|
| 1224 | IF( idom == jpdom_auto_xy .AND. .NOT. PRESENT(kstart) ) & |
---|
| 1225 | & CALL ctl_stop(TRIM(clinfo), 'idom = jpdom_auto_xy requires kstart to be present') |
---|
| 1226 | ! |
---|
[9367] | 1227 | ! Search for the variable in the data base (eventually actualize data) |
---|
[544] | 1228 | ! |
---|
[14072] | 1229 | idvar = iom_varid( kiomid, cdvar ) |
---|
[9367] | 1230 | IF( idvar > 0 ) THEN |
---|
[13286] | 1231 | ! |
---|
| 1232 | idimsz(:) = iom_file(kiomid)%dimsz(:, idvar) ! to write iom_file(kiomid)%dimsz in a shorter way |
---|
[9367] | 1233 | inbdim = iom_file(kiomid)%ndims(idvar) ! number of dimensions in the file |
---|
| 1234 | idmspc = inbdim ! number of spatial dimensions in the file |
---|
| 1235 | IF( iom_file(kiomid)%luld(idvar) ) idmspc = inbdim - 1 |
---|
[14072] | 1236 | IF( idmspc > 3 ) CALL ctl_stop(trim(clinfo), 'the file has more than 3 spatial dimensions this case is not coded...') |
---|
[9367] | 1237 | ! |
---|
[13286] | 1238 | ! Identify the domain in case of jpdom_auto definition |
---|
[14072] | 1239 | IF( idom == jpdom_auto .OR. idom == jpdom_auto_xy ) THEN |
---|
[13286] | 1240 | idom = jpdom_global ! default |
---|
| 1241 | ! else: if the file name finishes with _xxxx.nc with xxxx any number |
---|
[9367] | 1242 | ind1 = INDEX( clname, '_', back = .TRUE. ) + 1 |
---|
| 1243 | ind2 = INDEX( clname, '.', back = .TRUE. ) - 1 |
---|
| 1244 | IF( ind2 > ind1 ) THEN ; IF( VERIFY( clname(ind1:ind2), '0123456789' ) == 0 ) idom = jpdom_local ; ENDIF |
---|
| 1245 | ENDIF |
---|
| 1246 | ! |
---|
| 1247 | ! check the consistency between input array and data rank in the file |
---|
| 1248 | ! |
---|
| 1249 | ! initializations |
---|
| 1250 | itime = 1 |
---|
| 1251 | IF( PRESENT(ktime) ) itime = ktime |
---|
| 1252 | ! |
---|
| 1253 | irankpv = 1 * COUNT( (/PRESENT(pv_r1d)/) ) + 2 * COUNT( (/PRESENT(pv_r2d)/) ) + 3 * COUNT( (/PRESENT(pv_r3d)/) ) |
---|
| 1254 | WRITE(clrankpv, fmt='(i1)') irankpv |
---|
| 1255 | WRITE(cldmspc , fmt='(i1)') idmspc |
---|
| 1256 | ! |
---|
[13286] | 1257 | IF( idmspc < irankpv ) THEN ! it seems we want to read more than we can... |
---|
| 1258 | IF( irankpv == 3 .AND. idmspc == 2 ) THEN ! 3D input array from 2D spatial data in the file: |
---|
| 1259 | llok = inlev == 1 ! -> 3rd dimension must be equal to 1 |
---|
| 1260 | ELSEIF( irankpv == 3 .AND. idmspc == 1 ) THEN ! 3D input array from 1D spatial data in the file: |
---|
| 1261 | llok = inlev == 1 .AND. SIZE(pv_r3d, 2) == 1 ! -> 2nd and 3rd dimensions must be equal to 1 |
---|
| 1262 | ELSEIF( irankpv == 2 .AND. idmspc == 2 ) THEN ! 2D input array from 1D spatial data in the file: |
---|
| 1263 | llok = SIZE(pv_r2d, 2) == 1 ! -> 2nd dimension must be equal to 1 |
---|
| 1264 | ELSE |
---|
| 1265 | llok = .FALSE. |
---|
| 1266 | ENDIF |
---|
| 1267 | IF( .NOT. llok ) CALL ctl_stop( TRIM(clinfo), 'The file has only '//cldmspc//' spatial dimension', & |
---|
| 1268 | & '=> cannot read a true '//clrankpv//'D array from this file...' ) |
---|
| 1269 | ELSEIF( idmspc == irankpv ) THEN |
---|
[9367] | 1270 | IF( PRESENT(pv_r1d) .AND. idom /= jpdom_unknown ) & |
---|
| 1271 | & CALL ctl_stop( TRIM(clinfo), 'case not coded...You must use jpdom_unknown' ) |
---|
[13286] | 1272 | ELSEIF( idmspc > irankpv ) THEN ! it seems we want to read less than we should... |
---|
[9367] | 1273 | IF( PRESENT(pv_r2d) .AND. itime == 1 .AND. idimsz(3) == 1 .AND. idmspc == 3 ) THEN |
---|
[13286] | 1274 | CALL ctl_warn( trim(clinfo), '2D array input but 3 spatial dimensions in the file...' , & |
---|
[9367] | 1275 | & 'As the size of the z dimension is 1 and as we try to read the first record, ', & |
---|
[14072] | 1276 | & 'we accept this case, even if there is a possible mix-up between z and time dimension' ) |
---|
[9367] | 1277 | idmspc = idmspc - 1 |
---|
[13214] | 1278 | !!GS: possibility to read 3D ABL atmopsheric forcing and use 1st level to force BULK simulation |
---|
| 1279 | !ELSE |
---|
| 1280 | ! CALL ctl_stop( TRIM(clinfo), 'To keep iom lisibility, when reading a '//clrankpv//'D array,', & |
---|
| 1281 | ! & 'we do not accept data with '//cldmspc//' spatial dimensions' , & |
---|
| 1282 | ! & 'Use ncwa -a to suppress the unnecessary dimensions' ) |
---|
[9367] | 1283 | ENDIF |
---|
| 1284 | ENDIF |
---|
| 1285 | ! |
---|
| 1286 | ! definition of istart and icnt |
---|
| 1287 | ! |
---|
[14072] | 1288 | icnt (:) = 1 ! default definition (simple way to deal with special cases listed above) |
---|
| 1289 | istart(:) = 1 ! default definition (simple way to deal with special cases listed above) |
---|
[13286] | 1290 | istart(idmspc+1) = itime ! temporal dimenstion |
---|
| 1291 | ! |
---|
| 1292 | IF( idom == jpdom_unknown ) THEN |
---|
[14072] | 1293 | IF( PRESENT(kstart) .AND. idom /= jpdom_auto_xy ) THEN |
---|
| 1294 | istart(1:idmspc) = kstart(1:idmspc) |
---|
[13286] | 1295 | icnt (1:idmspc) = kcount(1:idmspc) |
---|
| 1296 | ELSE |
---|
| 1297 | icnt (1:idmspc) = idimsz(1:idmspc) |
---|
| 1298 | ENDIF |
---|
| 1299 | ELSE ! not a 1D array as pv_r1d requires jpdom_unknown |
---|
[14072] | 1300 | ! we do not read the overlap and the extra-halos -> from Nis0 to Nie0 and from Njs0 to Nje0 |
---|
[13286] | 1301 | IF( idom == jpdom_global ) istart(1:2) = (/ mig0(Nis0), mjg0(Njs0) /) |
---|
| 1302 | icnt(1:2) = (/ Ni_0, Nj_0 /) |
---|
| 1303 | IF( PRESENT(pv_r3d) ) THEN |
---|
| 1304 | IF( idom == jpdom_auto_xy ) THEN |
---|
| 1305 | istart(3) = kstart(3) |
---|
| 1306 | icnt (3) = kcount(3) |
---|
| 1307 | ELSE |
---|
| 1308 | icnt (3) = inlev |
---|
[544] | 1309 | ENDIF |
---|
| 1310 | ENDIF |
---|
[679] | 1311 | ENDIF |
---|
[13286] | 1312 | ! |
---|
[9367] | 1313 | ! check that istart and icnt can be used with this file |
---|
| 1314 | !- |
---|
| 1315 | DO jl = 1, jpmax_dims |
---|
| 1316 | itmp = istart(jl)+icnt(jl)-1 |
---|
| 1317 | IF( itmp > idimsz(jl) .AND. idimsz(jl) /= 0 ) THEN |
---|
| 1318 | WRITE( ctmp1, FMT="('(istart(', i1, ') + icnt(', i1, ') - 1) = ', i5)" ) jl, jl, itmp |
---|
| 1319 | WRITE( ctmp2, FMT="(' is larger than idimsz(', i1,') = ', i5)" ) jl, idimsz(jl) |
---|
[14072] | 1320 | CALL ctl_stop( trim(clinfo), 'start and count too big regarding to the size of the data, ', ctmp1, ctmp2 ) |
---|
[9367] | 1321 | ENDIF |
---|
| 1322 | END DO |
---|
[13286] | 1323 | ! |
---|
[9367] | 1324 | ! check that icnt matches the input array |
---|
[14072] | 1325 | !- |
---|
[9367] | 1326 | IF( idom == jpdom_unknown ) THEN |
---|
| 1327 | IF( irankpv == 1 ) ishape(1:1) = SHAPE(pv_r1d) |
---|
| 1328 | IF( irankpv == 2 ) ishape(1:2) = SHAPE(pv_r2d) |
---|
| 1329 | IF( irankpv == 3 ) ishape(1:3) = SHAPE(pv_r3d) |
---|
| 1330 | ctmp1 = 'd' |
---|
| 1331 | ELSE |
---|
| 1332 | IF( irankpv == 2 ) THEN |
---|
[13286] | 1333 | ishape(1:2) = SHAPE(pv_r2d(Nis0:Nie0,Njs0:Nje0 )) ; ctmp1 = 'd(Nis0:Nie0,Njs0:Nje0)' |
---|
[544] | 1334 | ENDIF |
---|
[14072] | 1335 | IF( irankpv == 3 ) THEN |
---|
[13286] | 1336 | ishape(1:3) = SHAPE(pv_r3d(Nis0:Nie0,Njs0:Nje0,:)) ; ctmp1 = 'd(Nis0:Nie0,Njs0:Nje0,:)' |
---|
[544] | 1337 | ENDIF |
---|
[14072] | 1338 | ENDIF |
---|
[9367] | 1339 | DO jl = 1, irankpv |
---|
| 1340 | WRITE( ctmp2, FMT="(', ', i1,'): ', i5,' /= icnt(', i1,'):', i5)" ) jl, ishape(jl), jl, icnt(jl) |
---|
| 1341 | IF( ishape(jl) /= icnt(jl) ) CALL ctl_stop( TRIM(clinfo), 'size(pv_r'//clrankpv//TRIM(ctmp1)//TRIM(ctmp2) ) |
---|
| 1342 | END DO |
---|
[679] | 1343 | |
---|
[9367] | 1344 | ENDIF |
---|
[544] | 1345 | |
---|
[9367] | 1346 | ! read the data |
---|
[14072] | 1347 | !- |
---|
[9367] | 1348 | IF( idvar > 0 .AND. istop == nstop ) THEN ! no additional errors until this point... |
---|
| 1349 | ! |
---|
[13286] | 1350 | ! find the right index of the array to be read |
---|
| 1351 | IF( idom /= jpdom_unknown ) THEN ; ix1 = Nis0 ; ix2 = Nie0 ; iy1 = Njs0 ; iy2 = Nje0 |
---|
| 1352 | ELSE ; ix1 = 1 ; ix2 = icnt(1) ; iy1 = 1 ; iy2 = icnt(2) |
---|
[679] | 1353 | ENDIF |
---|
[14072] | 1354 | |
---|
[10425] | 1355 | CALL iom_nf90_get( kiomid, idvar, inbdim, istart, icnt, ix1, ix2, iy1, iy2, pv_r1d, pv_r2d, pv_r3d ) |
---|
[679] | 1356 | |
---|
[9367] | 1357 | IF( istop == nstop ) THEN ! no additional errors until this point... |
---|
| 1358 | IF(lwp) WRITE(numout,"(10x,' read ',a,' (rec: ',i6,') in ',a,' ok')") TRIM(cdvar), itime, TRIM(iom_file(kiomid)%name) |
---|
[13286] | 1359 | |
---|
| 1360 | cl_type = 'T' |
---|
| 1361 | IF( PRESENT(cd_type) ) cl_type = cd_type |
---|
| 1362 | zsgn = 1._wp |
---|
| 1363 | IF( PRESENT(psgn ) ) zsgn = psgn |
---|
[9367] | 1364 | !--- overlap areas and extra hallows (mpp) |
---|
[13286] | 1365 | IF( PRESENT(pv_r2d) .AND. idom /= jpdom_unknown .AND. cl_type /= 'Z' ) THEN |
---|
| 1366 | CALL lbc_lnk( 'iom', pv_r2d, cl_type, zsgn, kfillmode = kfill ) |
---|
| 1367 | ELSEIF( PRESENT(pv_r3d) .AND. idom /= jpdom_unknown .AND. cl_type /= 'Z' ) THEN |
---|
| 1368 | CALL lbc_lnk( 'iom', pv_r3d, cl_type, zsgn, kfillmode = kfill ) |
---|
[679] | 1369 | ENDIF |
---|
[9367] | 1370 | ! |
---|
| 1371 | ELSE |
---|
| 1372 | ! return if istop == nstop is false |
---|
| 1373 | RETURN |
---|
[679] | 1374 | ENDIF |
---|
[9367] | 1375 | ELSE |
---|
| 1376 | ! return if statment idvar > 0 .AND. istop == nstop is false |
---|
| 1377 | RETURN |
---|
| 1378 | ENDIF |
---|
| 1379 | ! |
---|
| 1380 | ELSE ! read using XIOS. Only if KEY_IOMPUT is defined |
---|
[14822] | 1381 | #if defined key_xios |
---|
[9367] | 1382 | !would be good to be able to check which context is active and swap only if current is not restart |
---|
[13970] | 1383 | idvar = iom_varid( kiomid, cdvar ) |
---|
| 1384 | CALL iom_swap(context) |
---|
| 1385 | zsgn = 1._wp |
---|
| 1386 | IF( PRESENT(psgn ) ) zsgn = psgn |
---|
| 1387 | cl_type = 'T' |
---|
| 1388 | IF( PRESENT(cd_type) ) cl_type = cd_type |
---|
| 1389 | |
---|
[9367] | 1390 | IF( PRESENT(pv_r3d) ) THEN |
---|
[13286] | 1391 | IF(lwp) WRITE(numout,*) 'XIOS RST READ (3D): ',TRIM(cdvar) |
---|
[13970] | 1392 | CALL xios_recv_field( trim(cdvar), pv_r3d(:, :, :)) |
---|
| 1393 | IF(idom /= jpdom_unknown .AND. cl_type /= 'Z' ) THEN |
---|
| 1394 | CALL lbc_lnk( 'iom', pv_r3d, cl_type, zsgn, kfillmode = kfill) |
---|
| 1395 | ENDIF |
---|
[9367] | 1396 | ELSEIF( PRESENT(pv_r2d) ) THEN |
---|
[13286] | 1397 | IF(lwp) WRITE(numout,*) 'XIOS RST READ (2D): ', TRIM(cdvar) |
---|
[13970] | 1398 | CALL xios_recv_field( trim(cdvar), pv_r2d(:, :)) |
---|
| 1399 | IF(idom /= jpdom_unknown .AND. cl_type /= 'Z' ) THEN |
---|
| 1400 | CALL lbc_lnk('iom', pv_r2d, cl_type, zsgn, kfillmode = kfill) |
---|
| 1401 | ENDIF |
---|
[9367] | 1402 | ELSEIF( PRESENT(pv_r1d) ) THEN |
---|
[13286] | 1403 | IF(lwp) WRITE(numout,*) 'XIOS RST READ (1D): ', TRIM(cdvar) |
---|
[9367] | 1404 | CALL xios_recv_field( trim(cdvar), pv_r1d) |
---|
[544] | 1405 | ENDIF |
---|
[13970] | 1406 | CALL iom_swap(cxios_context) |
---|
[9367] | 1407 | #else |
---|
[14072] | 1408 | istop = istop + 1 |
---|
[9367] | 1409 | clinfo = 'Can not use XIOS in iom_get_123d, file: '//trim(clname)//', var:'//trim(cdvar) |
---|
| 1410 | #endif |
---|
[544] | 1411 | ENDIF |
---|
[9367] | 1412 | !some final adjustments |
---|
| 1413 | ! C1D case : always call lbc_lnk to replicate the central value over the whole 3X3 domain |
---|
[13226] | 1414 | IF( lk_c1d .AND. PRESENT(pv_r2d) ) CALL lbc_lnk( 'iom', pv_r2d,'Z',1.0_wp ) |
---|
| 1415 | IF( lk_c1d .AND. PRESENT(pv_r3d) ) CALL lbc_lnk( 'iom', pv_r3d,'Z',1.0_wp ) |
---|
[9367] | 1416 | |
---|
| 1417 | !--- Apply scale_factor and offset |
---|
| 1418 | zscf = iom_file(kiomid)%scf(idvar) ! scale factor |
---|
| 1419 | zofs = iom_file(kiomid)%ofs(idvar) ! offset |
---|
| 1420 | IF( PRESENT(pv_r1d) ) THEN |
---|
[14072] | 1421 | IF( zscf /= 1._wp ) pv_r1d(:) = pv_r1d(:) * zscf |
---|
[13970] | 1422 | IF( zofs /= 0._wp ) pv_r1d(:) = pv_r1d(:) + zofs |
---|
[9367] | 1423 | ELSEIF( PRESENT(pv_r2d) ) THEN |
---|
[13970] | 1424 | IF( zscf /= 1._wp) pv_r2d(:,:) = pv_r2d(:,:) * zscf |
---|
| 1425 | IF( zofs /= 0._wp) pv_r2d(:,:) = pv_r2d(:,:) + zofs |
---|
[9367] | 1426 | ELSEIF( PRESENT(pv_r3d) ) THEN |
---|
[13970] | 1427 | IF( zscf /= 1._wp) pv_r3d(:,:,:) = pv_r3d(:,:,:) * zscf |
---|
| 1428 | IF( zofs /= 0._wp) pv_r3d(:,:,:) = pv_r3d(:,:,:) + zofs |
---|
[9367] | 1429 | ENDIF |
---|
[544] | 1430 | ! |
---|
| 1431 | END SUBROUTINE iom_get_123d |
---|
| 1432 | |
---|
[12276] | 1433 | SUBROUTINE iom_get_var( cdname, z2d) |
---|
| 1434 | CHARACTER(LEN=*), INTENT(in ) :: cdname |
---|
[14072] | 1435 | REAL(wp), DIMENSION(jpi,jpj) :: z2d |
---|
[14822] | 1436 | #if defined key_xios |
---|
[12276] | 1437 | IF( xios_field_is_active( cdname, at_current_timestep_arg = .TRUE. ) ) THEN |
---|
| 1438 | z2d(:,:) = 0._wp |
---|
| 1439 | CALL xios_recv_field( cdname, z2d) |
---|
| 1440 | ENDIF |
---|
| 1441 | #else |
---|
| 1442 | IF( .FALSE. ) WRITE(numout,*) cdname, z2d ! useless test to avoid compilation warnings |
---|
| 1443 | #endif |
---|
| 1444 | END SUBROUTINE iom_get_var |
---|
[544] | 1445 | |
---|
[12276] | 1446 | |
---|
[14072] | 1447 | FUNCTION iom_getszuld ( kiomid ) |
---|
[10522] | 1448 | !!----------------------------------------------------------------------- |
---|
| 1449 | !! *** FUNCTION iom_getszuld *** |
---|
[544] | 1450 | !! |
---|
[10522] | 1451 | !! ** Purpose : get the size of the unlimited dimension in a file |
---|
| 1452 | !! (return -1 if not found) |
---|
| 1453 | !!----------------------------------------------------------------------- |
---|
| 1454 | INTEGER, INTENT(in ) :: kiomid ! file Identifier |
---|
[544] | 1455 | ! |
---|
[10522] | 1456 | INTEGER :: iom_getszuld |
---|
| 1457 | !!----------------------------------------------------------------------- |
---|
| 1458 | iom_getszuld = -1 |
---|
[679] | 1459 | IF( kiomid > 0 ) THEN |
---|
[10523] | 1460 | IF( iom_file(kiomid)%iduld > 0 ) iom_getszuld = iom_file(kiomid)%lenuld |
---|
[544] | 1461 | ENDIF |
---|
[10522] | 1462 | END FUNCTION iom_getszuld |
---|
[544] | 1463 | |
---|
[14072] | 1464 | |
---|
[544] | 1465 | !!---------------------------------------------------------------------- |
---|
[10425] | 1466 | !! INTERFACE iom_chkatt |
---|
[2528] | 1467 | !!---------------------------------------------------------------------- |
---|
[10425] | 1468 | SUBROUTINE iom_chkatt( kiomid, cdatt, llok, ksize, cdvar ) |
---|
[2528] | 1469 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1470 | CHARACTER(len=*), INTENT(in ) :: cdatt ! Name of the attribute |
---|
[10425] | 1471 | LOGICAL , INTENT( out) :: llok ! Error code |
---|
| 1472 | INTEGER , INTENT( out), OPTIONAL :: ksize ! Size of the attribute array |
---|
[7646] | 1473 | CHARACTER(len=*), INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
[2528] | 1474 | ! |
---|
| 1475 | IF( kiomid > 0 ) THEN |
---|
[10425] | 1476 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_chkatt( kiomid, cdatt, llok, ksize=ksize, cdvar=cdvar ) |
---|
[2528] | 1477 | ENDIF |
---|
[10425] | 1478 | ! |
---|
| 1479 | END SUBROUTINE iom_chkatt |
---|
| 1480 | |
---|
| 1481 | !!---------------------------------------------------------------------- |
---|
| 1482 | !! INTERFACE iom_getatt |
---|
| 1483 | !!---------------------------------------------------------------------- |
---|
| 1484 | SUBROUTINE iom_g0d_iatt( kiomid, cdatt, katt0d, cdvar ) |
---|
| 1485 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1486 | CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute |
---|
| 1487 | INTEGER , INTENT( out) :: katt0d ! read field |
---|
| 1488 | CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
| 1489 | ! |
---|
| 1490 | IF( kiomid > 0 ) THEN |
---|
| 1491 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_getatt( kiomid, cdatt, katt0d = katt0d, cdvar=cdvar ) |
---|
| 1492 | ENDIF |
---|
[7646] | 1493 | END SUBROUTINE iom_g0d_iatt |
---|
[2528] | 1494 | |
---|
[10425] | 1495 | SUBROUTINE iom_g1d_iatt( kiomid, cdatt, katt1d, cdvar ) |
---|
| 1496 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1497 | CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute |
---|
| 1498 | INTEGER, DIMENSION(:) , INTENT( out) :: katt1d ! read field |
---|
| 1499 | CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
[7646] | 1500 | ! |
---|
| 1501 | IF( kiomid > 0 ) THEN |
---|
[10425] | 1502 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_getatt( kiomid, cdatt, katt1d = katt1d, cdvar=cdvar ) |
---|
[7646] | 1503 | ENDIF |
---|
[10425] | 1504 | END SUBROUTINE iom_g1d_iatt |
---|
| 1505 | |
---|
| 1506 | SUBROUTINE iom_g0d_ratt( kiomid, cdatt, patt0d, cdvar ) |
---|
| 1507 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1508 | CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute |
---|
| 1509 | REAL(wp) , INTENT( out) :: patt0d ! read field |
---|
| 1510 | CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
| 1511 | ! |
---|
| 1512 | IF( kiomid > 0 ) THEN |
---|
| 1513 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_getatt( kiomid, cdatt, patt0d = patt0d, cdvar=cdvar ) |
---|
| 1514 | ENDIF |
---|
[7646] | 1515 | END SUBROUTINE iom_g0d_ratt |
---|
[2528] | 1516 | |
---|
[10425] | 1517 | SUBROUTINE iom_g1d_ratt( kiomid, cdatt, patt1d, cdvar ) |
---|
| 1518 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1519 | CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute |
---|
| 1520 | REAL(wp), DIMENSION(:), INTENT( out) :: patt1d ! read field |
---|
| 1521 | CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
[7646] | 1522 | ! |
---|
| 1523 | IF( kiomid > 0 ) THEN |
---|
[10425] | 1524 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_getatt( kiomid, cdatt, patt1d = patt1d, cdvar=cdvar ) |
---|
[7646] | 1525 | ENDIF |
---|
[10425] | 1526 | END SUBROUTINE iom_g1d_ratt |
---|
[14072] | 1527 | |
---|
[10425] | 1528 | SUBROUTINE iom_g0d_catt( kiomid, cdatt, cdatt0d, cdvar ) |
---|
| 1529 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1530 | CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute |
---|
| 1531 | CHARACTER(len=*) , INTENT( out) :: cdatt0d ! read field |
---|
| 1532 | CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
| 1533 | ! |
---|
| 1534 | IF( kiomid > 0 ) THEN |
---|
| 1535 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_getatt( kiomid, cdatt, cdatt0d = cdatt0d, cdvar=cdvar ) |
---|
| 1536 | ENDIF |
---|
[7646] | 1537 | END SUBROUTINE iom_g0d_catt |
---|
| 1538 | |
---|
[10425] | 1539 | |
---|
[2528] | 1540 | !!---------------------------------------------------------------------- |
---|
[7646] | 1541 | !! INTERFACE iom_putatt |
---|
| 1542 | !!---------------------------------------------------------------------- |
---|
[10425] | 1543 | SUBROUTINE iom_p0d_iatt( kiomid, cdatt, katt0d, cdvar ) |
---|
| 1544 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1545 | CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute |
---|
| 1546 | INTEGER , INTENT(in ) :: katt0d ! written field |
---|
| 1547 | CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
[7646] | 1548 | ! |
---|
| 1549 | IF( kiomid > 0 ) THEN |
---|
[10425] | 1550 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_putatt( kiomid, cdatt, katt0d = katt0d, cdvar=cdvar ) |
---|
[7646] | 1551 | ENDIF |
---|
| 1552 | END SUBROUTINE iom_p0d_iatt |
---|
| 1553 | |
---|
[10425] | 1554 | SUBROUTINE iom_p1d_iatt( kiomid, cdatt, katt1d, cdvar ) |
---|
| 1555 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1556 | CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute |
---|
| 1557 | INTEGER, DIMENSION(:) , INTENT(in ) :: katt1d ! written field |
---|
| 1558 | CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
[7646] | 1559 | ! |
---|
| 1560 | IF( kiomid > 0 ) THEN |
---|
[10425] | 1561 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_putatt( kiomid, cdatt, katt1d = katt1d, cdvar=cdvar ) |
---|
[7646] | 1562 | ENDIF |
---|
[10425] | 1563 | END SUBROUTINE iom_p1d_iatt |
---|
| 1564 | |
---|
| 1565 | SUBROUTINE iom_p0d_ratt( kiomid, cdatt, patt0d, cdvar ) |
---|
| 1566 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1567 | CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute |
---|
| 1568 | REAL(wp) , INTENT(in ) :: patt0d ! written field |
---|
| 1569 | CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
| 1570 | ! |
---|
| 1571 | IF( kiomid > 0 ) THEN |
---|
| 1572 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_putatt( kiomid, cdatt, patt0d = patt0d, cdvar=cdvar ) |
---|
| 1573 | ENDIF |
---|
[7646] | 1574 | END SUBROUTINE iom_p0d_ratt |
---|
| 1575 | |
---|
[10425] | 1576 | SUBROUTINE iom_p1d_ratt( kiomid, cdatt, patt1d, cdvar ) |
---|
| 1577 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1578 | CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute |
---|
| 1579 | REAL(wp), DIMENSION(:), INTENT(in ) :: patt1d ! written field |
---|
| 1580 | CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
[7646] | 1581 | ! |
---|
| 1582 | IF( kiomid > 0 ) THEN |
---|
[10425] | 1583 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_putatt( kiomid, cdatt, patt1d = patt1d, cdvar=cdvar ) |
---|
[7646] | 1584 | ENDIF |
---|
[10425] | 1585 | END SUBROUTINE iom_p1d_ratt |
---|
[14072] | 1586 | |
---|
[10425] | 1587 | SUBROUTINE iom_p0d_catt( kiomid, cdatt, cdatt0d, cdvar ) |
---|
| 1588 | INTEGER , INTENT(in ) :: kiomid ! Identifier of the file |
---|
| 1589 | CHARACTER(len=*) , INTENT(in ) :: cdatt ! Name of the attribute |
---|
| 1590 | CHARACTER(len=*) , INTENT(in ) :: cdatt0d ! written field |
---|
| 1591 | CHARACTER(len=*) , INTENT(in ), OPTIONAL :: cdvar ! Name of the variable |
---|
| 1592 | ! |
---|
| 1593 | IF( kiomid > 0 ) THEN |
---|
| 1594 | IF( iom_file(kiomid)%nfid > 0 ) CALL iom_nf90_putatt( kiomid, cdatt, cdatt0d = cdatt0d, cdvar=cdvar ) |
---|
| 1595 | ENDIF |
---|
[7646] | 1596 | END SUBROUTINE iom_p0d_catt |
---|
| 1597 | |
---|
[10425] | 1598 | |
---|
[7646] | 1599 | !!---------------------------------------------------------------------- |
---|
[544] | 1600 | !! INTERFACE iom_rstput |
---|
| 1601 | !!---------------------------------------------------------------------- |
---|
[13970] | 1602 | SUBROUTINE iom_rp0d_sp( kt, kwrite, kiomid, cdvar, pvar, ktype ) |
---|
[544] | 1603 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
| 1604 | INTEGER , INTENT(in) :: kwrite ! writing time-step |
---|
[14072] | 1605 | INTEGER , INTENT(in) :: kiomid ! Identifier of the file |
---|
[544] | 1606 | CHARACTER(len=*), INTENT(in) :: cdvar ! time axis name |
---|
[13226] | 1607 | REAL(sp) , INTENT(in) :: pvar ! written field |
---|
[544] | 1608 | INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type |
---|
[13970] | 1609 | ! |
---|
| 1610 | LOGICAL :: llx ! local xios write flag |
---|
| 1611 | INTEGER :: ivid ! variable id |
---|
| 1612 | CHARACTER(LEN=lc) :: context |
---|
| 1613 | ! |
---|
| 1614 | CALL set_xios_context(kiomid, context) |
---|
[9367] | 1615 | |
---|
[13970] | 1616 | llx = .NOT. (context == "NONE") |
---|
| 1617 | |
---|
[9367] | 1618 | IF( llx ) THEN |
---|
[14822] | 1619 | #ifdef key_xios |
---|
[13970] | 1620 | IF( kt == kwrite ) THEN |
---|
| 1621 | IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar) |
---|
| 1622 | CALL iom_swap(context) |
---|
| 1623 | CALL iom_put(trim(cdvar), pvar) |
---|
| 1624 | CALL iom_swap(cxios_context) |
---|
| 1625 | ELSE |
---|
| 1626 | IF(lwp) write(numout,*) 'RESTART: define (XIOS 0D) ',trim(cdvar) |
---|
| 1627 | CALL iom_swap(context) |
---|
[14072] | 1628 | CALL iom_set_rstw_active( trim(cdvar), rs0 = pvar ) |
---|
[13970] | 1629 | CALL iom_swap(cxios_context) |
---|
| 1630 | ENDIF |
---|
[9367] | 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. ) |
---|
[13226] | 1636 | CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r0d = real(pvar, dp) ) |
---|
| 1637 | ENDIF |
---|
| 1638 | ENDIF |
---|
| 1639 | ENDIF |
---|
| 1640 | END SUBROUTINE iom_rp0d_sp |
---|
| 1641 | |
---|
[13970] | 1642 | SUBROUTINE iom_rp0d_dp( kt, kwrite, kiomid, cdvar, pvar, ktype ) |
---|
[13226] | 1643 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
| 1644 | INTEGER , INTENT(in) :: kwrite ! writing time-step |
---|
[14072] | 1645 | INTEGER , INTENT(in) :: kiomid ! Identifier of the file |
---|
[13226] | 1646 | CHARACTER(len=*), INTENT(in) :: cdvar ! time axis name |
---|
| 1647 | REAL(dp) , INTENT(in) :: pvar ! written field |
---|
| 1648 | INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type |
---|
[13970] | 1649 | ! |
---|
| 1650 | LOGICAL :: llx ! local xios write flag |
---|
| 1651 | INTEGER :: ivid ! variable id |
---|
| 1652 | CHARACTER(LEN=lc) :: context |
---|
| 1653 | ! |
---|
| 1654 | CALL set_xios_context(kiomid, context) |
---|
[13226] | 1655 | |
---|
[13970] | 1656 | llx = .NOT. (context == "NONE") |
---|
| 1657 | |
---|
[13226] | 1658 | IF( llx ) THEN |
---|
[14822] | 1659 | #ifdef key_xios |
---|
[13970] | 1660 | IF( kt == kwrite ) THEN |
---|
| 1661 | IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar) |
---|
| 1662 | CALL iom_swap(context) |
---|
| 1663 | CALL iom_put(trim(cdvar), pvar) |
---|
| 1664 | CALL iom_swap(cxios_context) |
---|
| 1665 | ELSE |
---|
| 1666 | IF(lwp) write(numout,*) 'RESTART: define (XIOS 0D) ',trim(cdvar) |
---|
| 1667 | CALL iom_swap(context) |
---|
[14072] | 1668 | CALL iom_set_rstw_active( trim(cdvar), rd0 = pvar ) |
---|
[13970] | 1669 | CALL iom_swap(cxios_context) |
---|
| 1670 | ENDIF |
---|
[13226] | 1671 | #endif |
---|
| 1672 | ELSE |
---|
| 1673 | IF( kiomid > 0 ) THEN |
---|
| 1674 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
| 1675 | ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) |
---|
[10425] | 1676 | CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r0d = pvar ) |
---|
[9367] | 1677 | ENDIF |
---|
[679] | 1678 | ENDIF |
---|
| 1679 | ENDIF |
---|
[13226] | 1680 | END SUBROUTINE iom_rp0d_dp |
---|
[544] | 1681 | |
---|
[13226] | 1682 | |
---|
[13970] | 1683 | SUBROUTINE iom_rp1d_sp( kt, kwrite, kiomid, cdvar, pvar, ktype ) |
---|
[544] | 1684 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
| 1685 | INTEGER , INTENT(in) :: kwrite ! writing time-step |
---|
[14072] | 1686 | INTEGER , INTENT(in) :: kiomid ! Identifier of the file |
---|
[544] | 1687 | CHARACTER(len=*), INTENT(in) :: cdvar ! time axis name |
---|
[13226] | 1688 | REAL(sp) , INTENT(in), DIMENSION( :) :: pvar ! written field |
---|
[544] | 1689 | INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type |
---|
[13970] | 1690 | ! |
---|
| 1691 | LOGICAL :: llx ! local xios write flag |
---|
| 1692 | INTEGER :: ivid ! variable id |
---|
| 1693 | CHARACTER(LEN=lc) :: context |
---|
| 1694 | ! |
---|
| 1695 | CALL set_xios_context(kiomid, context) |
---|
[9367] | 1696 | |
---|
[13970] | 1697 | llx = .NOT. (context == "NONE") |
---|
| 1698 | |
---|
[9367] | 1699 | IF( llx ) THEN |
---|
[14822] | 1700 | #ifdef key_xios |
---|
[13970] | 1701 | IF( kt == kwrite ) THEN |
---|
| 1702 | IF(lwp) write(numout,*) 'RESTART: write (XIOS 1D) ',trim(cdvar) |
---|
| 1703 | CALL iom_swap(context) |
---|
| 1704 | CALL iom_put(trim(cdvar), pvar) |
---|
| 1705 | CALL iom_swap(cxios_context) |
---|
| 1706 | ELSE |
---|
| 1707 | IF(lwp) write(numout,*) 'RESTART: define (XIOS 1D)',trim(cdvar) |
---|
| 1708 | CALL iom_swap(context) |
---|
| 1709 | CALL iom_set_rstw_active( trim(cdvar), rs1 = pvar ) |
---|
| 1710 | CALL iom_swap(cxios_context) |
---|
| 1711 | ENDIF |
---|
[9367] | 1712 | #endif |
---|
| 1713 | ELSE |
---|
| 1714 | IF( kiomid > 0 ) THEN |
---|
| 1715 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
| 1716 | ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) |
---|
[13226] | 1717 | CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r1d = real(pvar, dp) ) |
---|
| 1718 | ENDIF |
---|
| 1719 | ENDIF |
---|
| 1720 | ENDIF |
---|
| 1721 | END SUBROUTINE iom_rp1d_sp |
---|
| 1722 | |
---|
[13970] | 1723 | SUBROUTINE iom_rp1d_dp( kt, kwrite, kiomid, cdvar, pvar, ktype ) |
---|
[13226] | 1724 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
| 1725 | INTEGER , INTENT(in) :: kwrite ! writing time-step |
---|
[14072] | 1726 | INTEGER , INTENT(in) :: kiomid ! Identifier of the file |
---|
[13226] | 1727 | CHARACTER(len=*), INTENT(in) :: cdvar ! time axis name |
---|
| 1728 | REAL(dp) , INTENT(in), DIMENSION( :) :: pvar ! written field |
---|
| 1729 | INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type |
---|
[13970] | 1730 | ! |
---|
| 1731 | LOGICAL :: llx ! local xios write flag |
---|
| 1732 | INTEGER :: ivid ! variable id |
---|
| 1733 | CHARACTER(LEN=lc) :: context |
---|
| 1734 | ! |
---|
| 1735 | CALL set_xios_context(kiomid, context) |
---|
[13226] | 1736 | |
---|
[13970] | 1737 | llx = .NOT. (context == "NONE") |
---|
| 1738 | |
---|
[13226] | 1739 | IF( llx ) THEN |
---|
[14822] | 1740 | #ifdef key_xios |
---|
[13970] | 1741 | IF( kt == kwrite ) THEN |
---|
| 1742 | IF(lwp) write(numout,*) 'RESTART: write (XIOS 1D) ',trim(cdvar) |
---|
| 1743 | CALL iom_swap(context) |
---|
| 1744 | CALL iom_put(trim(cdvar), pvar) |
---|
| 1745 | CALL iom_swap(cxios_context) |
---|
| 1746 | ELSE |
---|
| 1747 | IF(lwp) write(numout,*) 'RESTART: define (XIOS 1D)',trim(cdvar) |
---|
| 1748 | CALL iom_swap(context) |
---|
| 1749 | CALL iom_set_rstw_active( trim(cdvar), rd1 = pvar ) |
---|
| 1750 | CALL iom_swap(cxios_context) |
---|
| 1751 | ENDIF |
---|
[13226] | 1752 | #endif |
---|
| 1753 | ELSE |
---|
| 1754 | IF( kiomid > 0 ) THEN |
---|
| 1755 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
| 1756 | ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) |
---|
[10425] | 1757 | CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r1d = pvar ) |
---|
[9367] | 1758 | ENDIF |
---|
[679] | 1759 | ENDIF |
---|
| 1760 | ENDIF |
---|
[13226] | 1761 | END SUBROUTINE iom_rp1d_dp |
---|
[544] | 1762 | |
---|
[13226] | 1763 | |
---|
[13970] | 1764 | SUBROUTINE iom_rp2d_sp( kt, kwrite, kiomid, cdvar, pvar, ktype ) |
---|
[544] | 1765 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
| 1766 | INTEGER , INTENT(in) :: kwrite ! writing time-step |
---|
[14072] | 1767 | INTEGER , INTENT(in) :: kiomid ! Identifier of the file |
---|
[544] | 1768 | CHARACTER(len=*), INTENT(in) :: cdvar ! time axis name |
---|
[13226] | 1769 | REAL(sp) , INTENT(in), DIMENSION(:, : ) :: pvar ! written field |
---|
[544] | 1770 | INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type |
---|
[13970] | 1771 | ! |
---|
| 1772 | LOGICAL :: llx |
---|
| 1773 | INTEGER :: ivid ! variable id |
---|
| 1774 | CHARACTER(LEN=lc) :: context |
---|
| 1775 | ! |
---|
| 1776 | CALL set_xios_context(kiomid, context) |
---|
[9367] | 1777 | |
---|
[13970] | 1778 | llx = .NOT. (context == "NONE") |
---|
| 1779 | |
---|
[9367] | 1780 | IF( llx ) THEN |
---|
[14822] | 1781 | #ifdef key_xios |
---|
[13970] | 1782 | IF( kt == kwrite ) THEN |
---|
| 1783 | IF(lwp) write(numout,*) 'RESTART: write (XIOS 2D) ',trim(cdvar) |
---|
| 1784 | CALL iom_swap(context) |
---|
| 1785 | CALL iom_put(trim(cdvar), pvar) |
---|
| 1786 | CALL iom_swap(cxios_context) |
---|
| 1787 | ELSE |
---|
| 1788 | IF(lwp) write(numout,*) 'RESTART: define (XIOS 2D)',trim(cdvar) |
---|
| 1789 | CALL iom_swap(context) |
---|
| 1790 | CALL iom_set_rstw_active( trim(cdvar), rs2 = pvar ) |
---|
| 1791 | CALL iom_swap(cxios_context) |
---|
| 1792 | ENDIF |
---|
[9367] | 1793 | #endif |
---|
| 1794 | ELSE |
---|
| 1795 | IF( kiomid > 0 ) THEN |
---|
| 1796 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
| 1797 | ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) |
---|
[13226] | 1798 | CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r2d = real(pvar, dp) ) |
---|
| 1799 | ENDIF |
---|
| 1800 | ENDIF |
---|
| 1801 | ENDIF |
---|
| 1802 | END SUBROUTINE iom_rp2d_sp |
---|
| 1803 | |
---|
[13970] | 1804 | SUBROUTINE iom_rp2d_dp( kt, kwrite, kiomid, cdvar, pvar, ktype ) |
---|
[13226] | 1805 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
| 1806 | INTEGER , INTENT(in) :: kwrite ! writing time-step |
---|
[14072] | 1807 | INTEGER , INTENT(in) :: kiomid ! Identifier of the file |
---|
[13226] | 1808 | CHARACTER(len=*), INTENT(in) :: cdvar ! time axis name |
---|
| 1809 | REAL(dp) , INTENT(in), DIMENSION(:, : ) :: pvar ! written field |
---|
| 1810 | INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type |
---|
[13970] | 1811 | ! |
---|
| 1812 | LOGICAL :: llx |
---|
| 1813 | INTEGER :: ivid ! variable id |
---|
| 1814 | CHARACTER(LEN=lc) :: context |
---|
| 1815 | ! |
---|
| 1816 | CALL set_xios_context(kiomid, context) |
---|
[13226] | 1817 | |
---|
[13970] | 1818 | llx = .NOT. (context == "NONE") |
---|
| 1819 | |
---|
[13226] | 1820 | IF( llx ) THEN |
---|
[14822] | 1821 | #ifdef key_xios |
---|
[13970] | 1822 | IF( kt == kwrite ) THEN |
---|
| 1823 | IF(lwp) write(numout,*) 'RESTART: write (XIOS 2D) ',trim(cdvar) |
---|
| 1824 | CALL iom_swap(context) |
---|
| 1825 | CALL iom_put(trim(cdvar), pvar) |
---|
| 1826 | CALL iom_swap(cxios_context) |
---|
| 1827 | ELSE |
---|
| 1828 | IF(lwp) write(numout,*) 'RESTART: define (XIOS 2D)',trim(cdvar) |
---|
| 1829 | CALL iom_swap(context) |
---|
| 1830 | CALL iom_set_rstw_active( trim(cdvar), rd2 = pvar ) |
---|
| 1831 | CALL iom_swap(cxios_context) |
---|
| 1832 | ENDIF |
---|
[13226] | 1833 | #endif |
---|
| 1834 | ELSE |
---|
| 1835 | IF( kiomid > 0 ) THEN |
---|
| 1836 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
| 1837 | ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) |
---|
[10425] | 1838 | CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r2d = pvar ) |
---|
[9367] | 1839 | ENDIF |
---|
[679] | 1840 | ENDIF |
---|
| 1841 | ENDIF |
---|
[13226] | 1842 | END SUBROUTINE iom_rp2d_dp |
---|
[544] | 1843 | |
---|
[13226] | 1844 | |
---|
[13970] | 1845 | SUBROUTINE iom_rp3d_sp( kt, kwrite, kiomid, cdvar, pvar, ktype ) |
---|
[544] | 1846 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
| 1847 | INTEGER , INTENT(in) :: kwrite ! writing time-step |
---|
[14072] | 1848 | INTEGER , INTENT(in) :: kiomid ! Identifier of the file |
---|
[544] | 1849 | CHARACTER(len=*), INTENT(in) :: cdvar ! time axis name |
---|
[13226] | 1850 | REAL(sp) , INTENT(in), DIMENSION(:,:,:) :: pvar ! written field |
---|
[544] | 1851 | INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type |
---|
[13970] | 1852 | ! |
---|
| 1853 | LOGICAL :: llx ! local xios write flag |
---|
| 1854 | INTEGER :: ivid ! variable id |
---|
| 1855 | CHARACTER(LEN=lc) :: context |
---|
| 1856 | ! |
---|
| 1857 | CALL set_xios_context(kiomid, context) |
---|
[9367] | 1858 | |
---|
[13970] | 1859 | llx = .NOT. (context == "NONE") |
---|
| 1860 | |
---|
[9367] | 1861 | IF( llx ) THEN |
---|
[14822] | 1862 | #ifdef key_xios |
---|
[13970] | 1863 | IF( kt == kwrite ) THEN |
---|
| 1864 | IF(lwp) write(numout,*) 'RESTART: write (XIOS 3D) ',trim(cdvar) |
---|
| 1865 | CALL iom_swap(context) |
---|
| 1866 | CALL iom_put(trim(cdvar), pvar) |
---|
| 1867 | CALL iom_swap(cxios_context) |
---|
| 1868 | ELSE |
---|
| 1869 | IF(lwp) write(numout,*) 'RESTART: define (XIOS 3D)',trim(cdvar) |
---|
| 1870 | CALL iom_swap(context) |
---|
| 1871 | CALL iom_set_rstw_active( trim(cdvar), rs3 = pvar ) |
---|
| 1872 | CALL iom_swap(cxios_context) |
---|
| 1873 | ENDIF |
---|
[9367] | 1874 | #endif |
---|
| 1875 | ELSE |
---|
| 1876 | IF( kiomid > 0 ) THEN |
---|
| 1877 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
| 1878 | ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) |
---|
[13226] | 1879 | CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r3d = real(pvar, dp) ) |
---|
| 1880 | ENDIF |
---|
| 1881 | ENDIF |
---|
| 1882 | ENDIF |
---|
| 1883 | END SUBROUTINE iom_rp3d_sp |
---|
| 1884 | |
---|
[13970] | 1885 | SUBROUTINE iom_rp3d_dp( kt, kwrite, kiomid, cdvar, pvar, ktype ) |
---|
[13226] | 1886 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
| 1887 | INTEGER , INTENT(in) :: kwrite ! writing time-step |
---|
[14072] | 1888 | INTEGER , INTENT(in) :: kiomid ! Identifier of the file |
---|
[13226] | 1889 | CHARACTER(len=*), INTENT(in) :: cdvar ! time axis name |
---|
| 1890 | REAL(dp) , INTENT(in), DIMENSION(:,:,:) :: pvar ! written field |
---|
| 1891 | INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type |
---|
[13970] | 1892 | ! |
---|
| 1893 | LOGICAL :: llx ! local xios write flag |
---|
| 1894 | INTEGER :: ivid ! variable id |
---|
| 1895 | CHARACTER(LEN=lc) :: context |
---|
| 1896 | ! |
---|
| 1897 | CALL set_xios_context(kiomid, context) |
---|
[13226] | 1898 | |
---|
[13970] | 1899 | llx = .NOT. (context == "NONE") |
---|
| 1900 | |
---|
[13226] | 1901 | IF( llx ) THEN |
---|
[14822] | 1902 | #ifdef key_xios |
---|
[13970] | 1903 | IF( kt == kwrite ) THEN |
---|
| 1904 | IF(lwp) write(numout,*) 'RESTART: write (XIOS 3D) ',trim(cdvar) |
---|
| 1905 | CALL iom_swap(context) |
---|
| 1906 | CALL iom_put(trim(cdvar), pvar) |
---|
| 1907 | CALL iom_swap(cxios_context) |
---|
| 1908 | ELSE |
---|
| 1909 | IF(lwp) write(numout,*) 'RESTART: define (XIOS 3D)',trim(cdvar) |
---|
| 1910 | CALL iom_swap(context) |
---|
| 1911 | CALL iom_set_rstw_active( trim(cdvar), rd3 = pvar ) |
---|
| 1912 | CALL iom_swap(cxios_context) |
---|
| 1913 | ENDIF |
---|
[13226] | 1914 | #endif |
---|
| 1915 | ELSE |
---|
| 1916 | IF( kiomid > 0 ) THEN |
---|
| 1917 | IF( iom_file(kiomid)%nfid > 0 ) THEN |
---|
| 1918 | ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) |
---|
[10425] | 1919 | CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r3d = pvar ) |
---|
[9367] | 1920 | ENDIF |
---|
[679] | 1921 | ENDIF |
---|
| 1922 | ENDIF |
---|
[13226] | 1923 | END SUBROUTINE iom_rp3d_dp |
---|
[1359] | 1924 | |
---|
| 1925 | |
---|
[13226] | 1926 | |
---|
[10425] | 1927 | SUBROUTINE iom_delay_rst( cdaction, cdcpnt, kncid ) |
---|
| 1928 | !!--------------------------------------------------------------------- |
---|
| 1929 | !! Routine iom_delay_rst: used read/write restart related to mpp_delay |
---|
| 1930 | !! |
---|
| 1931 | !!--------------------------------------------------------------------- |
---|
| 1932 | CHARACTER(len=*), INTENT(in ) :: cdaction ! |
---|
| 1933 | CHARACTER(len=*), INTENT(in ) :: cdcpnt |
---|
| 1934 | INTEGER , INTENT(in ) :: kncid |
---|
| 1935 | ! |
---|
| 1936 | INTEGER :: ji |
---|
| 1937 | INTEGER :: indim |
---|
| 1938 | LOGICAL :: llattexist |
---|
| 1939 | REAL(wp), ALLOCATABLE, DIMENSION(:) :: zreal1d |
---|
| 1940 | !!--------------------------------------------------------------------- |
---|
| 1941 | ! |
---|
| 1942 | ! =================================== |
---|
| 1943 | IF( TRIM(cdaction) == 'READ' ) THEN ! read restart related to mpp_delay ! |
---|
| 1944 | ! =================================== |
---|
| 1945 | DO ji = 1, nbdelay |
---|
| 1946 | IF ( c_delaycpnt(ji) == cdcpnt ) THEN |
---|
| 1947 | CALL iom_chkatt( kncid, 'DELAY_'//c_delaylist(ji), llattexist, indim ) |
---|
| 1948 | IF( llattexist ) THEN |
---|
| 1949 | ALLOCATE( todelay(ji)%z1d(indim) ) |
---|
| 1950 | CALL iom_getatt( kncid, 'DELAY_'//c_delaylist(ji), todelay(ji)%z1d(:) ) |
---|
| 1951 | ndelayid(ji) = 0 ! set to 0 to specify that the value was read in the restart |
---|
| 1952 | ENDIF |
---|
| 1953 | ENDIF |
---|
| 1954 | END DO |
---|
| 1955 | ! ==================================== |
---|
| 1956 | ELSE ! write restart related to mpp_delay ! |
---|
| 1957 | ! ==================================== |
---|
| 1958 | DO ji = 1, nbdelay ! save only ocean delayed global communication variables |
---|
| 1959 | IF ( c_delaycpnt(ji) == cdcpnt ) THEN |
---|
| 1960 | IF( ASSOCIATED(todelay(ji)%z1d) ) THEN |
---|
| 1961 | CALL mpp_delay_rcv(ji) ! make sure %z1d is received |
---|
| 1962 | CALL iom_putatt( kncid, 'DELAY_'//c_delaylist(ji), todelay(ji)%z1d(:) ) |
---|
| 1963 | ENDIF |
---|
| 1964 | ENDIF |
---|
| 1965 | END DO |
---|
| 1966 | ! |
---|
| 1967 | ENDIF |
---|
[14072] | 1968 | |
---|
[10425] | 1969 | END SUBROUTINE iom_delay_rst |
---|
| 1970 | |
---|
[14072] | 1971 | |
---|
| 1972 | |
---|
[544] | 1973 | !!---------------------------------------------------------------------- |
---|
[1457] | 1974 | !! INTERFACE iom_put |
---|
[1359] | 1975 | !!---------------------------------------------------------------------- |
---|
[13226] | 1976 | SUBROUTINE iom_p0d_sp( cdname, pfield0d ) |
---|
[1738] | 1977 | CHARACTER(LEN=*), INTENT(in) :: cdname |
---|
[13226] | 1978 | REAL(sp) , INTENT(in) :: pfield0d |
---|
[13982] | 1979 | !! REAL(wp) , DIMENSION(jpi,jpj) :: zz ! masson |
---|
[14822] | 1980 | #if defined key_xios |
---|
[11536] | 1981 | !!clem zz(:,:)=pfield0d |
---|
| 1982 | !!clem CALL xios_send_field(cdname, zz) |
---|
[14072] | 1983 | CALL xios_send_field(cdname, (/pfield0d/)) |
---|
[1738] | 1984 | #else |
---|
| 1985 | IF( .FALSE. ) WRITE(numout,*) cdname, pfield0d ! useless test to avoid compilation warnings |
---|
| 1986 | #endif |
---|
[13226] | 1987 | END SUBROUTINE iom_p0d_sp |
---|
[1738] | 1988 | |
---|
[13226] | 1989 | SUBROUTINE iom_p0d_dp( cdname, pfield0d ) |
---|
| 1990 | CHARACTER(LEN=*), INTENT(in) :: cdname |
---|
| 1991 | REAL(dp) , INTENT(in) :: pfield0d |
---|
| 1992 | !! REAL(wp) , DIMENSION(jpi,jpj) :: zz ! masson |
---|
[14822] | 1993 | #if defined key_xios |
---|
[13226] | 1994 | !!clem zz(:,:)=pfield0d |
---|
| 1995 | !!clem CALL xios_send_field(cdname, zz) |
---|
[14072] | 1996 | CALL xios_send_field(cdname, (/pfield0d/)) |
---|
[13226] | 1997 | #else |
---|
| 1998 | IF( .FALSE. ) WRITE(numout,*) cdname, pfield0d ! useless test to avoid compilation warnings |
---|
| 1999 | #endif |
---|
| 2000 | END SUBROUTINE iom_p0d_dp |
---|
| 2001 | |
---|
| 2002 | |
---|
| 2003 | SUBROUTINE iom_p1d_sp( cdname, pfield1d ) |
---|
[3294] | 2004 | CHARACTER(LEN=*) , INTENT(in) :: cdname |
---|
[13226] | 2005 | REAL(sp), DIMENSION(:), INTENT(in) :: pfield1d |
---|
[14822] | 2006 | #if defined key_xios |
---|
[3695] | 2007 | CALL xios_send_field( cdname, RESHAPE( (/pfield1d/), (/1,1,SIZE(pfield1d)/) ) ) |
---|
[3294] | 2008 | #else |
---|
| 2009 | IF( .FALSE. ) WRITE(numout,*) cdname, pfield1d ! useless test to avoid compilation warnings |
---|
| 2010 | #endif |
---|
[13226] | 2011 | END SUBROUTINE iom_p1d_sp |
---|
[3294] | 2012 | |
---|
[13226] | 2013 | SUBROUTINE iom_p1d_dp( cdname, pfield1d ) |
---|
| 2014 | CHARACTER(LEN=*) , INTENT(in) :: cdname |
---|
| 2015 | REAL(dp), DIMENSION(:), INTENT(in) :: pfield1d |
---|
[14822] | 2016 | #if defined key_xios |
---|
[13226] | 2017 | CALL xios_send_field( cdname, RESHAPE( (/pfield1d/), (/1,1,SIZE(pfield1d)/) ) ) |
---|
| 2018 | #else |
---|
| 2019 | IF( .FALSE. ) WRITE(numout,*) cdname, pfield1d ! useless test to avoid compilation warnings |
---|
| 2020 | #endif |
---|
| 2021 | END SUBROUTINE iom_p1d_dp |
---|
| 2022 | |
---|
| 2023 | SUBROUTINE iom_p2d_sp( cdname, pfield2d ) |
---|
[1359] | 2024 | CHARACTER(LEN=*) , INTENT(in) :: cdname |
---|
[13226] | 2025 | REAL(sp), DIMENSION(:,:), INTENT(in) :: pfield2d |
---|
[13286] | 2026 | IF( iom_use(cdname) ) THEN |
---|
[14822] | 2027 | #if defined key_xios |
---|
[13747] | 2028 | CALL xios_send_field( cdname, pfield2d ) |
---|
[1520] | 2029 | #else |
---|
[13286] | 2030 | WRITE(numout,*) pfield2d ! iom_use(cdname) = .F. -> useless test to avoid compilation warnings |
---|
[1359] | 2031 | #endif |
---|
[13286] | 2032 | ENDIF |
---|
[13226] | 2033 | END SUBROUTINE iom_p2d_sp |
---|
[544] | 2034 | |
---|
[13226] | 2035 | SUBROUTINE iom_p2d_dp( cdname, pfield2d ) |
---|
| 2036 | CHARACTER(LEN=*) , INTENT(in) :: cdname |
---|
| 2037 | REAL(dp), DIMENSION(:,:), INTENT(in) :: pfield2d |
---|
[13286] | 2038 | IF( iom_use(cdname) ) THEN |
---|
[14822] | 2039 | #if defined key_xios |
---|
[13747] | 2040 | CALL xios_send_field( cdname, pfield2d ) |
---|
[13226] | 2041 | #else |
---|
[13286] | 2042 | WRITE(numout,*) pfield2d ! iom_use(cdname) = .F. -> useless test to avoid compilation warnings |
---|
[13226] | 2043 | #endif |
---|
[13286] | 2044 | ENDIF |
---|
[13226] | 2045 | END SUBROUTINE iom_p2d_dp |
---|
| 2046 | |
---|
| 2047 | SUBROUTINE iom_p3d_sp( cdname, pfield3d ) |
---|
[1359] | 2048 | CHARACTER(LEN=*) , INTENT(in) :: cdname |
---|
[13226] | 2049 | REAL(sp), DIMENSION(:,:,:), INTENT(in) :: pfield3d |
---|
[13286] | 2050 | IF( iom_use(cdname) ) THEN |
---|
[14822] | 2051 | #if defined key_xios |
---|
[13747] | 2052 | CALL xios_send_field( cdname, pfield3d ) |
---|
[1520] | 2053 | #else |
---|
[13286] | 2054 | WRITE(numout,*) pfield3d ! iom_use(cdname) = .F. -> useless test to avoid compilation warnings |
---|
[1359] | 2055 | #endif |
---|
[13286] | 2056 | ENDIF |
---|
[13226] | 2057 | END SUBROUTINE iom_p3d_sp |
---|
[544] | 2058 | |
---|
[13226] | 2059 | SUBROUTINE iom_p3d_dp( cdname, pfield3d ) |
---|
[12377] | 2060 | CHARACTER(LEN=*) , INTENT(in) :: cdname |
---|
[13226] | 2061 | REAL(dp), DIMENSION(:,:,:), INTENT(in) :: pfield3d |
---|
[13286] | 2062 | IF( iom_use(cdname) ) THEN |
---|
[14822] | 2063 | #if defined key_xios |
---|
[13747] | 2064 | CALL xios_send_field( cdname, pfield3d ) |
---|
[13226] | 2065 | #else |
---|
[13286] | 2066 | WRITE(numout,*) pfield3d ! iom_use(cdname) = .F. -> useless test to avoid compilation warnings |
---|
[13226] | 2067 | #endif |
---|
[13286] | 2068 | ENDIF |
---|
[13226] | 2069 | END SUBROUTINE iom_p3d_dp |
---|
| 2070 | |
---|
| 2071 | SUBROUTINE iom_p4d_sp( cdname, pfield4d ) |
---|
| 2072 | CHARACTER(LEN=*) , INTENT(in) :: cdname |
---|
| 2073 | REAL(sp), DIMENSION(:,:,:,:), INTENT(in) :: pfield4d |
---|
[13286] | 2074 | IF( iom_use(cdname) ) THEN |
---|
[14822] | 2075 | #if defined key_xios |
---|
[13747] | 2076 | CALL xios_send_field (cdname, pfield4d ) |
---|
[12276] | 2077 | #else |
---|
[13286] | 2078 | WRITE(numout,*) pfield4d ! iom_use(cdname) = .F. -> useless test to avoid compilation warnings |
---|
[12276] | 2079 | #endif |
---|
[13286] | 2080 | ENDIF |
---|
[13226] | 2081 | END SUBROUTINE iom_p4d_sp |
---|
[12276] | 2082 | |
---|
[13226] | 2083 | SUBROUTINE iom_p4d_dp( cdname, pfield4d ) |
---|
| 2084 | CHARACTER(LEN=*) , INTENT(in) :: cdname |
---|
| 2085 | REAL(dp), DIMENSION(:,:,:,:), INTENT(in) :: pfield4d |
---|
[13286] | 2086 | IF( iom_use(cdname) ) THEN |
---|
[14822] | 2087 | #if defined key_xios |
---|
[13747] | 2088 | CALL xios_send_field (cdname, pfield4d ) |
---|
[13226] | 2089 | #else |
---|
[13286] | 2090 | WRITE(numout,*) pfield4d ! iom_use(cdname) = .F. -> useless test to avoid compilation warnings |
---|
[13226] | 2091 | #endif |
---|
[13286] | 2092 | ENDIF |
---|
[13226] | 2093 | END SUBROUTINE iom_p4d_dp |
---|
[12276] | 2094 | |
---|
[14822] | 2095 | #if defined key_xios |
---|
[9019] | 2096 | !!---------------------------------------------------------------------- |
---|
[14822] | 2097 | !! 'key_xios' XIOS interface |
---|
[9019] | 2098 | !!---------------------------------------------------------------------- |
---|
[1359] | 2099 | |
---|
[9930] | 2100 | SUBROUTINE iom_set_domain_attr( cdid, ni_glo, nj_glo, ibegin, jbegin, ni, nj, & |
---|
[5363] | 2101 | & data_dim, data_ibegin, data_ni, data_jbegin, data_nj, lonvalue, latvalue, mask, & |
---|
[5415] | 2102 | & nvertex, bounds_lon, bounds_lat, area ) |
---|
[9019] | 2103 | !!---------------------------------------------------------------------- |
---|
| 2104 | !!---------------------------------------------------------------------- |
---|
| 2105 | CHARACTER(LEN=*) , INTENT(in) :: cdid |
---|
| 2106 | INTEGER , OPTIONAL, INTENT(in) :: ni_glo, nj_glo, ibegin, jbegin, ni, nj |
---|
| 2107 | INTEGER , OPTIONAL, INTENT(in) :: data_dim, data_ibegin, data_ni, data_jbegin, data_nj |
---|
[9930] | 2108 | INTEGER , OPTIONAL, INTENT(in) :: nvertex |
---|
[13226] | 2109 | REAL(dp), DIMENSION(:) , OPTIONAL, INTENT(in) :: lonvalue, latvalue |
---|
| 2110 | REAL(dp), DIMENSION(:,:), OPTIONAL, INTENT(in) :: bounds_lon, bounds_lat, area |
---|
[9019] | 2111 | LOGICAL , DIMENSION(:) , OPTIONAL, INTENT(in) :: mask |
---|
| 2112 | !!---------------------------------------------------------------------- |
---|
| 2113 | ! |
---|
| 2114 | IF( xios_is_valid_domain (cdid) ) THEN |
---|
[4148] | 2115 | CALL xios_set_domain_attr ( cdid, ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj, & |
---|
| 2116 | & data_dim=data_dim, data_ibegin=data_ibegin, data_ni=data_ni, data_jbegin=data_jbegin, data_nj=data_nj , & |
---|
[7646] | 2117 | & lonvalue_1D=lonvalue, latvalue_1D=latvalue, mask_1D=mask, nvertex=nvertex, bounds_lon_1D=bounds_lon, & |
---|
| 2118 | & bounds_lat_1D=bounds_lat, area=area, type='curvilinear') |
---|
[9367] | 2119 | ENDIF |
---|
[9019] | 2120 | IF( xios_is_valid_domaingroup(cdid) ) THEN |
---|
[4148] | 2121 | CALL xios_set_domaingroup_attr( cdid, ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj, & |
---|
| 2122 | & data_dim=data_dim, data_ibegin=data_ibegin, data_ni=data_ni, data_jbegin=data_jbegin, data_nj=data_nj , & |
---|
[7646] | 2123 | & lonvalue_1D=lonvalue, latvalue_1D=latvalue, mask_1D=mask, nvertex=nvertex, bounds_lon_1D=bounds_lon, & |
---|
| 2124 | & bounds_lat_1D=bounds_lat, area=area, type='curvilinear' ) |
---|
[3695] | 2125 | ENDIF |
---|
[9019] | 2126 | ! |
---|
[4148] | 2127 | CALL xios_solve_inheritance() |
---|
[9019] | 2128 | ! |
---|
[3695] | 2129 | END SUBROUTINE iom_set_domain_attr |
---|
| 2130 | |
---|
| 2131 | |
---|
[9019] | 2132 | SUBROUTINE iom_set_zoom_domain_attr( cdid, ibegin, jbegin, ni, nj ) |
---|
| 2133 | !!---------------------------------------------------------------------- |
---|
| 2134 | !!---------------------------------------------------------------------- |
---|
[9930] | 2135 | CHARACTER(LEN=*), INTENT(in) :: cdid |
---|
| 2136 | INTEGER , INTENT(in) :: ibegin, jbegin, ni, nj |
---|
| 2137 | ! |
---|
| 2138 | TYPE(xios_gridgroup) :: gridgroup_hdl |
---|
| 2139 | TYPE(xios_grid) :: grid_hdl |
---|
[14072] | 2140 | TYPE(xios_domain) :: domain_hdl |
---|
| 2141 | TYPE(xios_axis) :: axis_hdl |
---|
[9930] | 2142 | CHARACTER(LEN=64) :: cldomrefid ! domain_ref name |
---|
| 2143 | CHARACTER(len=1) :: cl1 ! last character of this name |
---|
[9019] | 2144 | !!---------------------------------------------------------------------- |
---|
[9930] | 2145 | ! |
---|
| 2146 | IF( xios_is_valid_zoom_domain(cdid) ) THEN |
---|
| 2147 | ! define the zoom_domain attributs |
---|
| 2148 | CALL xios_set_zoom_domain_attr( cdid, ibegin=ibegin, jbegin=jbegin, ni=ni, nj=nj ) |
---|
| 2149 | ! define a new 2D grid with this new domain |
---|
| 2150 | CALL xios_get_handle("grid_definition", gridgroup_hdl ) |
---|
| 2151 | CALL xios_add_child(gridgroup_hdl, grid_hdl, TRIM(cdid)//'_2D' ) ! add a new 2D grid to grid_definition |
---|
| 2152 | CALL xios_add_child(grid_hdl, domain_hdl, TRIM(cdid) ) ! add its domain |
---|
| 2153 | ! define a new 3D grid with this new domain |
---|
| 2154 | CALL xios_add_child(gridgroup_hdl, grid_hdl, TRIM(cdid)//'_3D' ) ! add a new 3D grid to grid_definition |
---|
| 2155 | CALL xios_add_child(grid_hdl, domain_hdl, TRIM(cdid) ) ! add its domain |
---|
| 2156 | ! vertical axis |
---|
| 2157 | cl1 = cdid(LEN_TRIM(cdid):) ! last letter of cdid |
---|
| 2158 | cl1 = CHAR(ICHAR(cl1)+32) ! from upper to lower case |
---|
| 2159 | CALL xios_add_child(grid_hdl, axis_hdl, 'depth'//cl1) ! add its axis |
---|
| 2160 | ENDIF |
---|
[14072] | 2161 | ! |
---|
[7646] | 2162 | END SUBROUTINE iom_set_zoom_domain_attr |
---|
| 2163 | |
---|
| 2164 | |
---|
[5415] | 2165 | SUBROUTINE iom_set_axis_attr( cdid, paxis, bounds ) |
---|
[9019] | 2166 | !!---------------------------------------------------------------------- |
---|
| 2167 | !!---------------------------------------------------------------------- |
---|
[4148] | 2168 | CHARACTER(LEN=*) , INTENT(in) :: cdid |
---|
[5415] | 2169 | REAL(wp), DIMENSION(:) , OPTIONAL, INTENT(in) :: paxis |
---|
| 2170 | REAL(wp), DIMENSION(:,:), OPTIONAL, INTENT(in) :: bounds |
---|
[9019] | 2171 | !!---------------------------------------------------------------------- |
---|
| 2172 | IF( PRESENT(paxis) ) THEN |
---|
[13226] | 2173 | IF( xios_is_valid_axis (cdid) ) CALL xios_set_axis_attr ( cdid, n_glo=SIZE(paxis), value=real(paxis, dp) ) |
---|
| 2174 | IF( xios_is_valid_axisgroup(cdid) ) CALL xios_set_axisgroup_attr( cdid, n_glo=SIZE(paxis), value=real(paxis, dp) ) |
---|
[5415] | 2175 | ENDIF |
---|
[13226] | 2176 | IF( PRESENT(bounds) ) THEN |
---|
| 2177 | IF( xios_is_valid_axis (cdid) ) CALL xios_set_axis_attr ( cdid, bounds=real(bounds, dp) ) |
---|
| 2178 | IF( xios_is_valid_axisgroup(cdid) ) CALL xios_set_axisgroup_attr( cdid, bounds=real(bounds, dp) ) |
---|
| 2179 | ELSE |
---|
| 2180 | IF( xios_is_valid_axis (cdid) ) CALL xios_set_axis_attr ( cdid) |
---|
| 2181 | IF( xios_is_valid_axisgroup(cdid) ) CALL xios_set_axisgroup_attr( cdid) |
---|
| 2182 | END IF |
---|
[4148] | 2183 | CALL xios_solve_inheritance() |
---|
[3737] | 2184 | END SUBROUTINE iom_set_axis_attr |
---|
| 2185 | |
---|
| 2186 | |
---|
[4148] | 2187 | SUBROUTINE iom_set_field_attr( cdid, freq_op, freq_offset ) |
---|
[9019] | 2188 | !!---------------------------------------------------------------------- |
---|
| 2189 | !!---------------------------------------------------------------------- |
---|
| 2190 | CHARACTER(LEN=*) , INTENT(in) :: cdid |
---|
| 2191 | TYPE(xios_duration), OPTIONAL, INTENT(in) :: freq_op |
---|
| 2192 | TYPE(xios_duration), OPTIONAL, INTENT(in) :: freq_offset |
---|
| 2193 | !!---------------------------------------------------------------------- |
---|
| 2194 | IF( xios_is_valid_field (cdid) ) CALL xios_set_field_attr ( cdid, freq_op=freq_op, freq_offset=freq_offset ) |
---|
| 2195 | IF( xios_is_valid_fieldgroup(cdid) ) CALL xios_set_fieldgroup_attr( cdid, freq_op=freq_op, freq_offset=freq_offset ) |
---|
[4148] | 2196 | CALL xios_solve_inheritance() |
---|
[3695] | 2197 | END SUBROUTINE iom_set_field_attr |
---|
| 2198 | |
---|
| 2199 | |
---|
[4148] | 2200 | SUBROUTINE iom_set_file_attr( cdid, name, name_suffix ) |
---|
[9019] | 2201 | !!---------------------------------------------------------------------- |
---|
| 2202 | !!---------------------------------------------------------------------- |
---|
[4148] | 2203 | CHARACTER(LEN=*) , INTENT(in) :: cdid |
---|
[3695] | 2204 | CHARACTER(LEN=*),OPTIONAL , INTENT(in) :: name, name_suffix |
---|
[9019] | 2205 | !!---------------------------------------------------------------------- |
---|
| 2206 | IF( xios_is_valid_file (cdid) ) CALL xios_set_file_attr ( cdid, name=name, name_suffix=name_suffix ) |
---|
| 2207 | IF( xios_is_valid_filegroup(cdid) ) CALL xios_set_filegroup_attr( cdid, name=name, name_suffix=name_suffix ) |
---|
[4148] | 2208 | CALL xios_solve_inheritance() |
---|
[3771] | 2209 | END SUBROUTINE iom_set_file_attr |
---|
[3695] | 2210 | |
---|
| 2211 | |
---|
[4148] | 2212 | SUBROUTINE iom_get_file_attr( cdid, name, name_suffix, output_freq ) |
---|
[9019] | 2213 | !!---------------------------------------------------------------------- |
---|
| 2214 | !!---------------------------------------------------------------------- |
---|
[4148] | 2215 | CHARACTER(LEN=*) , INTENT(in ) :: cdid |
---|
[7646] | 2216 | CHARACTER(LEN=*),OPTIONAL , INTENT(out) :: name, name_suffix |
---|
| 2217 | TYPE(xios_duration), OPTIONAL , INTENT(out) :: output_freq |
---|
[4148] | 2218 | LOGICAL :: llexist1,llexist2,llexist3 |
---|
| 2219 | !--------------------------------------------------------------------- |
---|
| 2220 | IF( PRESENT( name ) ) name = '' ! default values |
---|
| 2221 | IF( PRESENT( name_suffix ) ) name_suffix = '' |
---|
[7646] | 2222 | IF( PRESENT( output_freq ) ) output_freq = xios_duration(0,0,0,0,0,0) |
---|
[9019] | 2223 | IF( xios_is_valid_file (cdid) ) THEN |
---|
[4148] | 2224 | CALL xios_solve_inheritance() |
---|
| 2225 | CALL xios_is_defined_file_attr ( cdid, name = llexist1, name_suffix = llexist2, output_freq = llexist3) |
---|
| 2226 | IF(llexist1) CALL xios_get_file_attr ( cdid, name = name ) |
---|
| 2227 | IF(llexist2) CALL xios_get_file_attr ( cdid, name_suffix = name_suffix ) |
---|
| 2228 | IF(llexist3) CALL xios_get_file_attr ( cdid, output_freq = output_freq ) |
---|
| 2229 | ENDIF |
---|
[9019] | 2230 | IF( xios_is_valid_filegroup(cdid) ) THEN |
---|
[4148] | 2231 | CALL xios_solve_inheritance() |
---|
| 2232 | CALL xios_is_defined_filegroup_attr( cdid, name = llexist1, name_suffix = llexist2, output_freq = llexist3) |
---|
| 2233 | IF(llexist1) CALL xios_get_filegroup_attr( cdid, name = name ) |
---|
| 2234 | IF(llexist2) CALL xios_get_filegroup_attr( cdid, name_suffix = name_suffix ) |
---|
| 2235 | IF(llexist3) CALL xios_get_filegroup_attr( cdid, output_freq = output_freq ) |
---|
| 2236 | ENDIF |
---|
| 2237 | END SUBROUTINE iom_get_file_attr |
---|
| 2238 | |
---|
| 2239 | |
---|
| 2240 | SUBROUTINE iom_set_grid_attr( cdid, mask ) |
---|
[9019] | 2241 | !!---------------------------------------------------------------------- |
---|
| 2242 | !!---------------------------------------------------------------------- |
---|
[4148] | 2243 | CHARACTER(LEN=*) , INTENT(in) :: cdid |
---|
[3771] | 2244 | LOGICAL, DIMENSION(:,:,:), OPTIONAL, INTENT(in) :: mask |
---|
[9019] | 2245 | !!---------------------------------------------------------------------- |
---|
| 2246 | IF( xios_is_valid_grid (cdid) ) CALL xios_set_grid_attr ( cdid, mask_3D=mask ) |
---|
| 2247 | IF( xios_is_valid_gridgroup(cdid) ) CALL xios_set_gridgroup_attr( cdid, mask_3D=mask ) |
---|
[4148] | 2248 | CALL xios_solve_inheritance() |
---|
[3771] | 2249 | END SUBROUTINE iom_set_grid_attr |
---|
[3695] | 2250 | |
---|
[4152] | 2251 | SUBROUTINE iom_setkt( kt, cdname ) |
---|
[9019] | 2252 | !!---------------------------------------------------------------------- |
---|
| 2253 | !!---------------------------------------------------------------------- |
---|
[14072] | 2254 | INTEGER , INTENT(in) :: kt |
---|
[4152] | 2255 | CHARACTER(LEN=*), INTENT(in) :: cdname |
---|
[9019] | 2256 | !!---------------------------------------------------------------------- |
---|
[4152] | 2257 | CALL iom_swap( cdname ) ! swap to cdname context |
---|
| 2258 | CALL xios_update_calendar(kt) |
---|
[13970] | 2259 | IF( cdname /= TRIM(cxios_context) ) CALL iom_swap( cxios_context ) ! return back to nemo context |
---|
[4152] | 2260 | END SUBROUTINE iom_setkt |
---|
[3695] | 2261 | |
---|
[4152] | 2262 | SUBROUTINE iom_context_finalize( cdname ) |
---|
[9019] | 2263 | !!---------------------------------------------------------------------- |
---|
| 2264 | !!---------------------------------------------------------------------- |
---|
[4152] | 2265 | CHARACTER(LEN=*), INTENT(in) :: cdname |
---|
[9367] | 2266 | CHARACTER(LEN=120) :: clname |
---|
[9019] | 2267 | !!---------------------------------------------------------------------- |
---|
[9367] | 2268 | clname = cdname |
---|
[14072] | 2269 | IF( TRIM(Agrif_CFixed()) .NE. '0' ) clname = TRIM(Agrif_CFixed())//"_"//clname |
---|
[9367] | 2270 | IF( xios_is_valid_context(clname) ) THEN |
---|
[4990] | 2271 | CALL iom_swap( cdname ) ! swap to cdname context |
---|
| 2272 | CALL xios_context_finalize() ! finalize the context |
---|
[13970] | 2273 | IF( cdname /= cxios_context ) CALL iom_swap( cxios_context ) ! return back to nemo context |
---|
[4990] | 2274 | ENDIF |
---|
[9367] | 2275 | ! |
---|
[4152] | 2276 | END SUBROUTINE iom_context_finalize |
---|
| 2277 | |
---|
| 2278 | |
---|
[9984] | 2279 | SUBROUTINE set_grid( cdgrd, plon, plat, ldxios, ldrxios ) |
---|
[1359] | 2280 | !!---------------------------------------------------------------------- |
---|
[4148] | 2281 | !! *** ROUTINE set_grid *** |
---|
[1359] | 2282 | !! |
---|
[1725] | 2283 | !! ** Purpose : define horizontal grids |
---|
[1359] | 2284 | !!---------------------------------------------------------------------- |
---|
[3771] | 2285 | CHARACTER(LEN=1) , INTENT(in) :: cdgrd |
---|
[1359] | 2286 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: plon |
---|
| 2287 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: plat |
---|
[3771] | 2288 | ! |
---|
| 2289 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: zmask |
---|
[9984] | 2290 | LOGICAL, INTENT(IN) :: ldxios, ldrxios |
---|
[9019] | 2291 | !!---------------------------------------------------------------------- |
---|
| 2292 | ! |
---|
[13286] | 2293 | CALL iom_set_domain_attr("grid_"//cdgrd, ni_glo=Ni0glo,nj_glo=Nj0glo,ibegin=mig0(Nis0)-1,jbegin=mjg0(Njs0)-1,ni=Ni_0,nj=Nj_0) |
---|
[14061] | 2294 | CALL iom_set_domain_attr("grid_"//cdgrd, data_dim=2, data_ibegin = -nn_hls, data_ni=jpi, data_jbegin = -nn_hls, data_nj=jpj) |
---|
[14072] | 2295 | !don't define lon and lat for restart reading context. |
---|
[9984] | 2296 | IF ( .NOT.ldrxios ) & |
---|
[13286] | 2297 | CALL iom_set_domain_attr("grid_"//cdgrd, lonvalue = real(RESHAPE(plon(Nis0:Nie0, Njs0:Nje0),(/ Ni_0*Nj_0 /)),dp), & |
---|
[14072] | 2298 | & latvalue = real(RESHAPE(plat(Nis0:Nie0, Njs0:Nje0),(/ Ni_0*Nj_0 /)),dp )) |
---|
[9019] | 2299 | ! |
---|
[9367] | 2300 | IF ( ln_mskland .AND. (.NOT.ldxios) ) THEN |
---|
[3771] | 2301 | ! mask land points, keep values on coast line -> specific mask for U, V and W points |
---|
| 2302 | SELECT CASE ( cdgrd ) |
---|
[14061] | 2303 | CASE('T') ; zmask( : , : ,:) = tmask(:,:,:) |
---|
| 2304 | CASE('U') ; zmask(2:jpim1, : ,:) = tmask(2:jpim1, : ,:) + tmask(3:jpi , : ,:) |
---|
| 2305 | CASE('V') ; zmask( : ,2:jpjm1,:) = tmask( : ,2:jpjm1,:) + tmask( : ,3:jpj,:) |
---|
| 2306 | CASE('F') ; zmask(2:jpim1,2:jpjm1,:) = tmask(2:jpim1,2:jpjm1,:) + tmask(2:jpim1,3:jpj,:) & |
---|
| 2307 | & + tmask(3:jpi ,2:jpjm1,:) + tmask(3:jpi ,3:jpj,:) |
---|
[3771] | 2308 | CASE('W') ; zmask(:,:,2:jpk ) = tmask(:,:,1:jpkm1) + tmask(:,:,2:jpk) ; zmask(:,:,1) = tmask(:,:,1) |
---|
| 2309 | END SELECT |
---|
| 2310 | ! |
---|
[13286] | 2311 | CALL iom_set_domain_attr( "grid_"//cdgrd , mask = RESHAPE(zmask(Nis0:Nie0,Njs0:Nje0,1),(/Ni_0*Nj_0 /)) /= 0. ) |
---|
| 2312 | CALL iom_set_grid_attr ( "grid_"//cdgrd//"_3D", mask = RESHAPE(zmask(Nis0:Nie0,Njs0:Nje0,:),(/Ni_0,Nj_0,jpk/)) /= 0. ) |
---|
[3771] | 2313 | ENDIF |
---|
[9019] | 2314 | ! |
---|
[1359] | 2315 | END SUBROUTINE set_grid |
---|
| 2316 | |
---|
[5415] | 2317 | SUBROUTINE set_grid_bounds( cdgrd, plon_cnr, plat_cnr, plon_pnt, plat_pnt ) |
---|
[5363] | 2318 | !!---------------------------------------------------------------------- |
---|
| 2319 | !! *** ROUTINE set_grid_bounds *** |
---|
| 2320 | !! |
---|
| 2321 | !! ** Purpose : define horizontal grid corners |
---|
| 2322 | !! |
---|
| 2323 | !!---------------------------------------------------------------------- |
---|
[9019] | 2324 | CHARACTER(LEN=1) , INTENT(in) :: cdgrd |
---|
| 2325 | REAL(wp), DIMENSION(jpi,jpj) , INTENT(in) :: plon_cnr, plat_cnr ! Lat/lon coord. of a contiguous vertex of cell (i,j) |
---|
| 2326 | REAL(wp), DIMENSION(jpi,jpj), OPTIONAL, INTENT(in) :: plon_pnt, plat_pnt ! Lat/lon coord. of the point of cell (i,j) |
---|
[5363] | 2327 | ! |
---|
[13286] | 2328 | INTEGER :: ji, jj, jn |
---|
[12377] | 2329 | INTEGER :: icnr, jcnr ! Offset such that the vertex coordinate (i+icnr,j+jcnr) |
---|
[13286] | 2330 | ! ! represents the |
---|
| 2331 | ! bottom-left corner of |
---|
| 2332 | ! cell (i,j) |
---|
[9019] | 2333 | REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) :: z_bnds ! Lat/lon coordinates of the vertices of cell (i,j) |
---|
| 2334 | REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: z_fld ! Working array to determine where to rotate cells |
---|
| 2335 | REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: z_rot ! Lat/lon working array for rotation of cells |
---|
| 2336 | !!---------------------------------------------------------------------- |
---|
[5415] | 2337 | ! |
---|
[9019] | 2338 | ALLOCATE( z_bnds(4,jpi,jpj,2), z_fld(jpi,jpj), z_rot(4,2) ) |
---|
[5363] | 2339 | ! |
---|
[5415] | 2340 | ! Offset of coordinate representing bottom-left corner |
---|
[5363] | 2341 | SELECT CASE ( TRIM(cdgrd) ) |
---|
[9019] | 2342 | CASE ('T', 'W') ; icnr = -1 ; jcnr = -1 |
---|
| 2343 | CASE ('U') ; icnr = 0 ; jcnr = -1 |
---|
| 2344 | CASE ('V') ; icnr = -1 ; jcnr = 0 |
---|
[14068] | 2345 | CASE ('F') ; icnr = 0 ; jcnr = 0 |
---|
[5363] | 2346 | END SELECT |
---|
[9019] | 2347 | ! |
---|
[5363] | 2348 | z_fld(:,:) = 1._wp |
---|
[13226] | 2349 | CALL lbc_lnk( 'iom', z_fld, cdgrd, -1.0_wp ) ! Working array for location of northfold |
---|
[9019] | 2350 | ! |
---|
[5363] | 2351 | ! Cell vertices that can be defined |
---|
[13295] | 2352 | DO_2D( 0, 0, 0, 0 ) |
---|
[13286] | 2353 | z_bnds(1,ji,jj,1) = plat_cnr(ji+icnr, jj+jcnr ) ! Bottom-left |
---|
| 2354 | z_bnds(2,ji,jj,1) = plat_cnr(ji+icnr+1,jj+jcnr ) ! Bottom-right |
---|
| 2355 | z_bnds(3,ji,jj,1) = plat_cnr(ji+icnr+1,jj+jcnr+1) ! Top-right |
---|
| 2356 | z_bnds(4,ji,jj,1) = plat_cnr(ji+icnr, jj+jcnr+1) ! Top-left |
---|
| 2357 | z_bnds(1,ji,jj,2) = plon_cnr(ji+icnr, jj+jcnr ) ! Bottom-left |
---|
| 2358 | z_bnds(2,ji,jj,2) = plon_cnr(ji+icnr+1,jj+jcnr ) ! Bottom-right |
---|
| 2359 | z_bnds(3,ji,jj,2) = plon_cnr(ji+icnr+1,jj+jcnr+1) ! Top-right |
---|
| 2360 | z_bnds(4,ji,jj,2) = plon_cnr(ji+icnr, jj+jcnr+1) ! Top-left |
---|
| 2361 | END_2D |
---|
[9019] | 2362 | ! |
---|
[13295] | 2363 | DO_2D( 0, 0, 0, 0 ) |
---|
[13286] | 2364 | IF( z_fld(ji,jj) == -1. ) THEN |
---|
| 2365 | z_rot(1,:) = z_bnds(3,ji,jj,:) ; z_rot(2,:) = z_bnds(4,ji,jj,:) |
---|
| 2366 | z_rot(3,:) = z_bnds(1,ji,jj,:) ; z_rot(4,:) = z_bnds(2,ji,jj,:) |
---|
| 2367 | z_bnds(:,ji,jj,:) = z_rot(:,:) |
---|
[5415] | 2368 | ENDIF |
---|
[13286] | 2369 | END_2D |
---|
[9019] | 2370 | ! |
---|
[13286] | 2371 | CALL iom_set_domain_attr("grid_"//cdgrd, bounds_lat = real(RESHAPE(z_bnds(:,Nis0:Nie0,Njs0:Nje0,1),(/ 4,Ni_0*Nj_0 /)), dp), & |
---|
| 2372 | & bounds_lon = real(RESHAPE(z_bnds(:,Nis0:Nie0,Njs0:Nje0,2),(/ 4,Ni_0*Nj_0 /)), dp), nvertex=4 ) |
---|
[9019] | 2373 | ! |
---|
[13286] | 2374 | DEALLOCATE( z_bnds, z_fld, z_rot ) |
---|
[9019] | 2375 | ! |
---|
[5363] | 2376 | END SUBROUTINE set_grid_bounds |
---|
| 2377 | |
---|
[5385] | 2378 | SUBROUTINE set_grid_znl( plat ) |
---|
| 2379 | !!---------------------------------------------------------------------- |
---|
| 2380 | !! *** ROUTINE set_grid_znl *** |
---|
| 2381 | !! |
---|
| 2382 | !! ** Purpose : define grids for zonal mean |
---|
| 2383 | !! |
---|
| 2384 | !!---------------------------------------------------------------------- |
---|
| 2385 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: plat |
---|
| 2386 | ! |
---|
[13286] | 2387 | INTEGER :: ix, iy |
---|
[5385] | 2388 | REAL(wp), DIMENSION(:), ALLOCATABLE :: zlon |
---|
[9019] | 2389 | !!---------------------------------------------------------------------- |
---|
| 2390 | ! |
---|
[13286] | 2391 | ALLOCATE( zlon(Ni_0*Nj_0) ) ; zlon(:) = 0._wp |
---|
[9019] | 2392 | ! |
---|
[13226] | 2393 | ! CALL dom_ngb( -168.53_wp, 65.03_wp, ix, iy, 'T' ) ! i-line that passes through Bering Strait: Reference latitude (used in plots) |
---|
| 2394 | CALL dom_ngb( 180.0_wp, 90.0_wp, ix, iy, 'T' ) ! i-line that passes near the North Pole : Reference latitude (used in plots) |
---|
[13286] | 2395 | CALL iom_set_domain_attr("gznl", ni_glo=Ni0glo, nj_glo=Nj0glo, ibegin=mig0(Nis0)-1, jbegin=mjg0(Njs0)-1, ni=Ni_0, nj=Nj_0) |
---|
[13747] | 2396 | CALL iom_set_domain_attr("gznl", data_dim=2, data_ibegin = -nn_hls, data_ni = jpi, data_jbegin = -nn_hls, data_nj = jpj) |
---|
[13226] | 2397 | CALL iom_set_domain_attr("gznl", lonvalue = real(zlon, dp), & |
---|
[14072] | 2398 | & latvalue = real(RESHAPE(plat(Nis0:Nie0, Njs0:Nje0),(/ Ni_0*Nj_0 /)),dp)) |
---|
[13716] | 2399 | CALL iom_set_zoom_domain_attr("ptr", ibegin=ix-1, jbegin=0, ni=1, nj=Nj0glo) |
---|
[5385] | 2400 | ! |
---|
| 2401 | CALL iom_update_file_name('ptr') |
---|
| 2402 | ! |
---|
| 2403 | END SUBROUTINE set_grid_znl |
---|
| 2404 | |
---|
[9019] | 2405 | |
---|
[1738] | 2406 | SUBROUTINE set_scalar |
---|
| 2407 | !!---------------------------------------------------------------------- |
---|
[4148] | 2408 | !! *** ROUTINE set_scalar *** |
---|
[1738] | 2409 | !! |
---|
| 2410 | !! ** Purpose : define fake grids for scalar point |
---|
| 2411 | !! |
---|
| 2412 | !!---------------------------------------------------------------------- |
---|
[13226] | 2413 | REAL(dp), DIMENSION(1) :: zz = 1. |
---|
[1738] | 2414 | !!---------------------------------------------------------------------- |
---|
[9019] | 2415 | ! |
---|
[7646] | 2416 | CALL iom_set_domain_attr('scalarpoint', ni_glo=jpnij, nj_glo=1, ibegin=narea-1, jbegin=0, ni=1, nj=1) |
---|
[5426] | 2417 | CALL iom_set_domain_attr('scalarpoint', data_dim=2, data_ibegin = 1, data_ni = 1, data_jbegin = 1, data_nj = 1) |
---|
[9019] | 2418 | ! |
---|
| 2419 | zz = REAL( narea, wp ) |
---|
[5426] | 2420 | CALL iom_set_domain_attr('scalarpoint', lonvalue=zz, latvalue=zz) |
---|
[9019] | 2421 | ! |
---|
[1738] | 2422 | END SUBROUTINE set_scalar |
---|
| 2423 | |
---|
| 2424 | |
---|
[1725] | 2425 | SUBROUTINE set_xmlatt |
---|
| 2426 | !!---------------------------------------------------------------------- |
---|
[4148] | 2427 | !! *** ROUTINE set_xmlatt *** |
---|
[1725] | 2428 | !! |
---|
| 2429 | !! ** Purpose : automatic definitions of some of the xml attributs... |
---|
| 2430 | !! |
---|
| 2431 | !!---------------------------------------------------------------------- |
---|
| 2432 | CHARACTER(len=1),DIMENSION( 3) :: clgrd ! suffix name |
---|
[4148] | 2433 | CHARACTER(len=256) :: clsuff ! suffix name |
---|
[1725] | 2434 | CHARACTER(len=1) :: cl1 ! 1 character |
---|
[5003] | 2435 | CHARACTER(len=2) :: cl2 ! 2 characters |
---|
| 2436 | CHARACTER(len=3) :: cl3 ! 3 characters |
---|
[4148] | 2437 | INTEGER :: ji, jg ! loop counters |
---|
[1725] | 2438 | INTEGER :: ix, iy ! i-,j- index |
---|
| 2439 | REAL(wp) ,DIMENSION(11) :: zlontao ! longitudes of tao moorings |
---|
| 2440 | REAL(wp) ,DIMENSION( 7) :: zlattao ! latitudes of tao moorings |
---|
| 2441 | REAL(wp) ,DIMENSION( 4) :: zlonrama ! longitudes of rama moorings |
---|
| 2442 | REAL(wp) ,DIMENSION(11) :: zlatrama ! latitudes of rama moorings |
---|
| 2443 | REAL(wp) ,DIMENSION( 3) :: zlonpira ! longitudes of pirata moorings |
---|
| 2444 | REAL(wp) ,DIMENSION( 9) :: zlatpira ! latitudes of pirata moorings |
---|
[7646] | 2445 | TYPE(xios_duration) :: f_op, f_of |
---|
[1725] | 2446 | !!---------------------------------------------------------------------- |
---|
[14072] | 2447 | ! |
---|
[1725] | 2448 | ! frequency of the call of iom_put (attribut: freq_op) |
---|
[9019] | 2449 | f_op%timestep = 1 ; f_of%timestep = 0 ; CALL iom_set_field_attr('field_definition', freq_op=f_op, freq_offset=f_of) |
---|
| 2450 | f_op%timestep = 2 ; f_of%timestep = 0 ; CALL iom_set_field_attr('trendT_even' , freq_op=f_op, freq_offset=f_of) |
---|
| 2451 | f_op%timestep = 2 ; f_of%timestep = -1 ; CALL iom_set_field_attr('trendT_odd' , freq_op=f_op, freq_offset=f_of) |
---|
| 2452 | f_op%timestep = nn_fsbc ; f_of%timestep = 0 ; CALL iom_set_field_attr('SBC' , freq_op=f_op, freq_offset=f_of) |
---|
| 2453 | f_op%timestep = nn_fsbc ; f_of%timestep = 0 ; CALL iom_set_field_attr('SBC_scalar' , freq_op=f_op, freq_offset=f_of) |
---|
[12377] | 2454 | f_op%timestep = nn_fsbc ; f_of%timestep = 0 ; CALL iom_set_field_attr('ABL' , freq_op=f_op, freq_offset=f_of) |
---|
[7646] | 2455 | |
---|
[1725] | 2456 | ! output file names (attribut: name) |
---|
[4148] | 2457 | DO ji = 1, 9 |
---|
[14072] | 2458 | WRITE(cl1,'(i1)') ji |
---|
[4148] | 2459 | CALL iom_update_file_name('file'//cl1) |
---|
[1725] | 2460 | END DO |
---|
[4148] | 2461 | DO ji = 1, 99 |
---|
[14072] | 2462 | WRITE(cl2,'(i2.2)') ji |
---|
[4148] | 2463 | CALL iom_update_file_name('file'//cl2) |
---|
| 2464 | END DO |
---|
[5003] | 2465 | DO ji = 1, 999 |
---|
[14072] | 2466 | WRITE(cl3,'(i3.3)') ji |
---|
[5003] | 2467 | CALL iom_update_file_name('file'//cl3) |
---|
| 2468 | END DO |
---|
[1725] | 2469 | |
---|
| 2470 | ! Zooms... |
---|
[14072] | 2471 | clgrd = (/ 'T', 'U', 'W' /) |
---|
[1725] | 2472 | DO jg = 1, SIZE(clgrd) ! grid type |
---|
| 2473 | cl1 = clgrd(jg) |
---|
| 2474 | ! Equatorial section (attributs: jbegin, ni, name_suffix) |
---|
[13226] | 2475 | CALL dom_ngb( 0.0_wp, 0.0_wp, ix, iy, cl1 ) |
---|
[13286] | 2476 | CALL iom_set_zoom_domain_attr('Eq'//cl1, ibegin=0, jbegin=iy-1, ni=Ni0glo, nj=1 ) |
---|
[4148] | 2477 | CALL iom_get_file_attr ('Eq'//cl1, name_suffix = clsuff ) |
---|
| 2478 | CALL iom_set_file_attr ('Eq'//cl1, name_suffix = TRIM(clsuff)//'_Eq') |
---|
| 2479 | CALL iom_update_file_name('Eq'//cl1) |
---|
[1725] | 2480 | END DO |
---|
| 2481 | ! TAO moorings (attributs: ibegin, jbegin, name_suffix) |
---|
| 2482 | zlontao = (/ 137.0, 147.0, 156.0, 165.0, -180.0, -170.0, -155.0, -140.0, -125.0, -110.0, -95.0 /) |
---|
| 2483 | zlattao = (/ -8.0, -5.0, -2.0, 0.0, 2.0, 5.0, 8.0 /) |
---|
| 2484 | CALL set_mooring( zlontao, zlattao ) |
---|
| 2485 | ! RAMA moorings (attributs: ibegin, jbegin, name_suffix) |
---|
| 2486 | zlonrama = (/ 55.0, 67.0, 80.5, 90.0 /) |
---|
| 2487 | zlatrama = (/ -16.0, -12.0, -8.0, -4.0, -1.5, 0.0, 1.5, 4.0, 8.0, 12.0, 15.0 /) |
---|
| 2488 | CALL set_mooring( zlonrama, zlatrama ) |
---|
| 2489 | ! PIRATA moorings (attributs: ibegin, jbegin, name_suffix) |
---|
| 2490 | zlonpira = (/ -38.0, -23.0, -10.0 /) |
---|
| 2491 | zlatpira = (/ -19.0, -14.0, -8.0, 0.0, 4.0, 8.0, 12.0, 15.0, 20.0 /) |
---|
| 2492 | CALL set_mooring( zlonpira, zlatpira ) |
---|
[9019] | 2493 | ! |
---|
[1725] | 2494 | END SUBROUTINE set_xmlatt |
---|
| 2495 | |
---|
| 2496 | |
---|
[9019] | 2497 | SUBROUTINE set_mooring( plon, plat ) |
---|
[1725] | 2498 | !!---------------------------------------------------------------------- |
---|
[4148] | 2499 | !! *** ROUTINE set_mooring *** |
---|
[1725] | 2500 | !! |
---|
| 2501 | !! ** Purpose : automatic definitions of moorings xml attributs... |
---|
| 2502 | !! |
---|
| 2503 | !!---------------------------------------------------------------------- |
---|
[9019] | 2504 | REAL(wp), DIMENSION(:), INTENT(in) :: plon, plat ! longitudes/latitudes oft the mooring |
---|
[1725] | 2505 | ! |
---|
| 2506 | !!$ CHARACTER(len=1),DIMENSION(4) :: clgrd = (/ 'T', 'U', 'V', 'W' /) ! suffix name |
---|
| 2507 | CHARACTER(len=1),DIMENSION(1) :: clgrd = (/ 'T' /) ! suffix name |
---|
[4148] | 2508 | CHARACTER(len=256) :: clname ! file name |
---|
| 2509 | CHARACTER(len=256) :: clsuff ! suffix name |
---|
[1725] | 2510 | CHARACTER(len=1) :: cl1 ! 1 character |
---|
| 2511 | CHARACTER(len=6) :: clon,clat ! name of longitude, latitude |
---|
| 2512 | INTEGER :: ji, jj, jg ! loop counters |
---|
| 2513 | INTEGER :: ix, iy ! i-,j- index |
---|
| 2514 | REAL(wp) :: zlon, zlat |
---|
| 2515 | !!---------------------------------------------------------------------- |
---|
| 2516 | DO jg = 1, SIZE(clgrd) |
---|
| 2517 | cl1 = clgrd(jg) |
---|
| 2518 | DO ji = 1, SIZE(plon) |
---|
| 2519 | DO jj = 1, SIZE(plat) |
---|
| 2520 | zlon = plon(ji) |
---|
| 2521 | zlat = plat(jj) |
---|
| 2522 | ! modifications for RAMA moorings |
---|
| 2523 | IF( zlon == 67. .AND. zlat == 15. ) zlon = 65. |
---|
| 2524 | IF( zlon == 90. .AND. zlat <= -4. ) zlon = 95. |
---|
| 2525 | IF( zlon == 95. .AND. zlat == -4. ) zlat = -5. |
---|
| 2526 | ! modifications for PIRATA moorings |
---|
| 2527 | IF( zlon == -38. .AND. zlat == -19. ) zlon = -34. |
---|
| 2528 | IF( zlon == -38. .AND. zlat == -14. ) zlon = -32. |
---|
| 2529 | IF( zlon == -38. .AND. zlat == -8. ) zlon = -30. |
---|
| 2530 | IF( zlon == -38. .AND. zlat == 0. ) zlon = -35. |
---|
| 2531 | IF( zlon == -23. .AND. zlat == 20. ) zlat = 21. |
---|
| 2532 | IF( zlon == -10. .AND. zlat == -14. ) zlat = -10. |
---|
| 2533 | IF( zlon == -10. .AND. zlat == -8. ) zlat = -6. |
---|
| 2534 | IF( zlon == -10. .AND. zlat == 4. ) THEN ; zlon = 0. ; zlat = 0. ; ENDIF |
---|
| 2535 | CALL dom_ngb( zlon, zlat, ix, iy, cl1 ) |
---|
[14072] | 2536 | IF( zlon >= 0. ) THEN |
---|
[1725] | 2537 | IF( zlon == REAL(NINT(zlon), wp) ) THEN ; WRITE(clon, '(i3, a)') NINT( zlon), 'e' |
---|
| 2538 | ELSE ; WRITE(clon, '(f5.1,a)') zlon , 'e' |
---|
| 2539 | ENDIF |
---|
[14072] | 2540 | ELSE |
---|
[1725] | 2541 | IF( zlon == REAL(NINT(zlon), wp) ) THEN ; WRITE(clon, '(i3, a)') NINT(-zlon), 'w' |
---|
| 2542 | ELSE ; WRITE(clon, '(f5.1,a)') -zlon , 'w' |
---|
| 2543 | ENDIF |
---|
| 2544 | ENDIF |
---|
[14072] | 2545 | IF( zlat >= 0. ) THEN |
---|
[1725] | 2546 | IF( zlat == REAL(NINT(zlat), wp) ) THEN ; WRITE(clat, '(i2, a)') NINT( zlat), 'n' |
---|
| 2547 | ELSE ; WRITE(clat, '(f4.1,a)') zlat , 'n' |
---|
| 2548 | ENDIF |
---|
[14072] | 2549 | ELSE |
---|
[1725] | 2550 | IF( zlat == REAL(NINT(zlat), wp) ) THEN ; WRITE(clat, '(i2, a)') NINT(-zlat), 's' |
---|
| 2551 | ELSE ; WRITE(clat, '(f4.1,a)') -zlat , 's' |
---|
| 2552 | ENDIF |
---|
| 2553 | ENDIF |
---|
| 2554 | clname = TRIM(ADJUSTL(clat))//TRIM(ADJUSTL(clon)) |
---|
[9930] | 2555 | CALL iom_set_zoom_domain_attr(TRIM(clname)//cl1, ibegin= ix-1, jbegin= iy-1, ni=1, nj=1) |
---|
[7646] | 2556 | |
---|
[4148] | 2557 | CALL iom_get_file_attr (TRIM(clname)//cl1, name_suffix = clsuff ) |
---|
| 2558 | CALL iom_set_file_attr (TRIM(clname)//cl1, name_suffix = TRIM(clsuff)//'_'//TRIM(clname)) |
---|
| 2559 | CALL iom_update_file_name(TRIM(clname)//cl1) |
---|
[1725] | 2560 | END DO |
---|
| 2561 | END DO |
---|
| 2562 | END DO |
---|
[14072] | 2563 | |
---|
[1725] | 2564 | END SUBROUTINE set_mooring |
---|
| 2565 | |
---|
[14072] | 2566 | |
---|
[4148] | 2567 | SUBROUTINE iom_update_file_name( cdid ) |
---|
| 2568 | !!---------------------------------------------------------------------- |
---|
| 2569 | !! *** ROUTINE iom_update_file_name *** |
---|
| 2570 | !! |
---|
[14072] | 2571 | !! ** Purpose : |
---|
[4148] | 2572 | !! |
---|
| 2573 | !!---------------------------------------------------------------------- |
---|
| 2574 | CHARACTER(LEN=*) , INTENT(in) :: cdid |
---|
| 2575 | ! |
---|
| 2576 | CHARACTER(LEN=256) :: clname |
---|
| 2577 | CHARACTER(LEN=20) :: clfreq |
---|
| 2578 | CHARACTER(LEN=20) :: cldate |
---|
| 2579 | INTEGER :: idx |
---|
| 2580 | INTEGER :: jn |
---|
| 2581 | INTEGER :: itrlen |
---|
| 2582 | INTEGER :: iyear, imonth, iday, isec |
---|
| 2583 | REAL(wp) :: zsec |
---|
| 2584 | LOGICAL :: llexist |
---|
[14072] | 2585 | TYPE(xios_duration) :: output_freq |
---|
[4148] | 2586 | !!---------------------------------------------------------------------- |
---|
[9019] | 2587 | ! |
---|
| 2588 | DO jn = 1, 2 |
---|
| 2589 | ! |
---|
[7646] | 2590 | output_freq = xios_duration(0,0,0,0,0,0) |
---|
| 2591 | IF( jn == 1 ) CALL iom_get_file_attr( cdid, name = clname, output_freq = output_freq ) |
---|
[4148] | 2592 | IF( jn == 2 ) CALL iom_get_file_attr( cdid, name_suffix = clname ) |
---|
[9019] | 2593 | ! |
---|
[14072] | 2594 | IF ( TRIM(clname) /= '' ) THEN |
---|
[9019] | 2595 | ! |
---|
[4148] | 2596 | idx = INDEX(clname,'@expname@') + INDEX(clname,'@EXPNAME@') |
---|
[14072] | 2597 | DO WHILE ( idx /= 0 ) |
---|
[4148] | 2598 | clname = clname(1:idx-1)//TRIM(cexper)//clname(idx+9:LEN_TRIM(clname)) |
---|
| 2599 | idx = INDEX(clname,'@expname@') + INDEX(clname,'@EXPNAME@') |
---|
| 2600 | END DO |
---|
[9019] | 2601 | ! |
---|
[4148] | 2602 | idx = INDEX(clname,'@freq@') + INDEX(clname,'@FREQ@') |
---|
[14072] | 2603 | DO WHILE ( idx /= 0 ) |
---|
[7646] | 2604 | IF ( output_freq%timestep /= 0) THEN |
---|
[14072] | 2605 | WRITE(clfreq,'(I18,A2)')INT(output_freq%timestep),'ts' |
---|
[7646] | 2606 | itrlen = LEN_TRIM(ADJUSTL(clfreq)) |
---|
[7764] | 2607 | ELSE IF ( output_freq%second /= 0 ) THEN |
---|
[14072] | 2608 | WRITE(clfreq,'(I19,A1)')INT(output_freq%second),'s' |
---|
[7764] | 2609 | itrlen = LEN_TRIM(ADJUSTL(clfreq)) |
---|
| 2610 | ELSE IF ( output_freq%minute /= 0 ) THEN |
---|
[14072] | 2611 | WRITE(clfreq,'(I18,A2)')INT(output_freq%minute),'mi' |
---|
[7764] | 2612 | itrlen = LEN_TRIM(ADJUSTL(clfreq)) |
---|
[7646] | 2613 | ELSE IF ( output_freq%hour /= 0 ) THEN |
---|
[14072] | 2614 | WRITE(clfreq,'(I19,A1)')INT(output_freq%hour),'h' |
---|
[7646] | 2615 | itrlen = LEN_TRIM(ADJUSTL(clfreq)) |
---|
| 2616 | ELSE IF ( output_freq%day /= 0 ) THEN |
---|
[14072] | 2617 | WRITE(clfreq,'(I19,A1)')INT(output_freq%day),'d' |
---|
[7646] | 2618 | itrlen = LEN_TRIM(ADJUSTL(clfreq)) |
---|
[14072] | 2619 | ELSE IF ( output_freq%month /= 0 ) THEN |
---|
| 2620 | WRITE(clfreq,'(I19,A1)')INT(output_freq%month),'m' |
---|
[7646] | 2621 | itrlen = LEN_TRIM(ADJUSTL(clfreq)) |
---|
[14072] | 2622 | ELSE IF ( output_freq%year /= 0 ) THEN |
---|
| 2623 | WRITE(clfreq,'(I19,A1)')INT(output_freq%year),'y' |
---|
[7646] | 2624 | itrlen = LEN_TRIM(ADJUSTL(clfreq)) |
---|
| 2625 | ELSE |
---|
[4148] | 2626 | CALL ctl_stop('error in the name of file id '//TRIM(cdid), & |
---|
| 2627 | & ' attribute output_freq is undefined -> cannot replace @freq@ in '//TRIM(clname) ) |
---|
[7646] | 2628 | ENDIF |
---|
| 2629 | clname = clname(1:idx-1)//TRIM(ADJUSTL(clfreq))//clname(idx+6:LEN_TRIM(clname)) |
---|
| 2630 | idx = INDEX(clname,'@freq@') + INDEX(clname,'@FREQ@') |
---|
[4148] | 2631 | END DO |
---|
[9019] | 2632 | ! |
---|
[4148] | 2633 | idx = INDEX(clname,'@startdate@') + INDEX(clname,'@STARTDATE@') |
---|
[14072] | 2634 | DO WHILE ( idx /= 0 ) |
---|
[12489] | 2635 | cldate = iom_sdate( fjulday - rn_Dt / rday ) |
---|
[4148] | 2636 | clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+11:LEN_TRIM(clname)) |
---|
| 2637 | idx = INDEX(clname,'@startdate@') + INDEX(clname,'@STARTDATE@') |
---|
| 2638 | END DO |
---|
[9019] | 2639 | ! |
---|
[4148] | 2640 | idx = INDEX(clname,'@startdatefull@') + INDEX(clname,'@STARTDATEFULL@') |
---|
[14072] | 2641 | DO WHILE ( idx /= 0 ) |
---|
[12489] | 2642 | cldate = iom_sdate( fjulday - rn_Dt / rday, ldfull = .TRUE. ) |
---|
[4148] | 2643 | clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+15:LEN_TRIM(clname)) |
---|
| 2644 | idx = INDEX(clname,'@startdatefull@') + INDEX(clname,'@STARTDATEFULL@') |
---|
| 2645 | END DO |
---|
[9019] | 2646 | ! |
---|
[4148] | 2647 | idx = INDEX(clname,'@enddate@') + INDEX(clname,'@ENDDATE@') |
---|
[14072] | 2648 | DO WHILE ( idx /= 0 ) |
---|
[12489] | 2649 | cldate = iom_sdate( fjulday + rn_Dt / rday * REAL( nitend - nit000, wp ), ld24 = .TRUE. ) |
---|
[4148] | 2650 | clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+9:LEN_TRIM(clname)) |
---|
| 2651 | idx = INDEX(clname,'@enddate@') + INDEX(clname,'@ENDDATE@') |
---|
| 2652 | END DO |
---|
[9019] | 2653 | ! |
---|
[4148] | 2654 | idx = INDEX(clname,'@enddatefull@') + INDEX(clname,'@ENDDATEFULL@') |
---|
[14072] | 2655 | DO WHILE ( idx /= 0 ) |
---|
[12489] | 2656 | cldate = iom_sdate( fjulday + rn_Dt / rday * REAL( nitend - nit000, wp ), ld24 = .TRUE., ldfull = .TRUE. ) |
---|
[4148] | 2657 | clname = clname(1:idx-1)//TRIM(cldate)//clname(idx+13:LEN_TRIM(clname)) |
---|
| 2658 | idx = INDEX(clname,'@enddatefull@') + INDEX(clname,'@ENDDATEFULL@') |
---|
| 2659 | END DO |
---|
[9019] | 2660 | ! |
---|
[12377] | 2661 | IF( jn == 1 .AND. TRIM(Agrif_CFixed()) /= '0' ) clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname) |
---|
[4148] | 2662 | IF( jn == 1 ) CALL iom_set_file_attr( cdid, name = clname ) |
---|
| 2663 | IF( jn == 2 ) CALL iom_set_file_attr( cdid, name_suffix = clname ) |
---|
[9019] | 2664 | ! |
---|
[4148] | 2665 | ENDIF |
---|
[9019] | 2666 | ! |
---|
[4148] | 2667 | END DO |
---|
[9019] | 2668 | ! |
---|
[4148] | 2669 | END SUBROUTINE iom_update_file_name |
---|
| 2670 | |
---|
| 2671 | |
---|
| 2672 | FUNCTION iom_sdate( pjday, ld24, ldfull ) |
---|
| 2673 | !!---------------------------------------------------------------------- |
---|
| 2674 | !! *** ROUTINE iom_sdate *** |
---|
| 2675 | !! |
---|
| 2676 | !! ** Purpose : send back the date corresponding to the given julian day |
---|
| 2677 | !!---------------------------------------------------------------------- |
---|
[9019] | 2678 | REAL(wp), INTENT(in ) :: pjday ! julian day |
---|
| 2679 | LOGICAL , INTENT(in ), OPTIONAL :: ld24 ! true to force 24:00 instead of 00:00 |
---|
| 2680 | LOGICAL , INTENT(in ), OPTIONAL :: ldfull ! true to get the compleate date: yyyymmdd_hh:mm:ss |
---|
[4148] | 2681 | ! |
---|
| 2682 | CHARACTER(LEN=20) :: iom_sdate |
---|
[14072] | 2683 | CHARACTER(LEN=50) :: clfmt ! format used to write the date |
---|
[4148] | 2684 | INTEGER :: iyear, imonth, iday, ihour, iminute, isec |
---|
| 2685 | REAL(wp) :: zsec |
---|
| 2686 | LOGICAL :: ll24, llfull |
---|
[9019] | 2687 | !!---------------------------------------------------------------------- |
---|
[4148] | 2688 | ! |
---|
| 2689 | IF( PRESENT(ld24) ) THEN ; ll24 = ld24 |
---|
| 2690 | ELSE ; ll24 = .FALSE. |
---|
| 2691 | ENDIF |
---|
[9019] | 2692 | ! |
---|
[4148] | 2693 | IF( PRESENT(ldfull) ) THEN ; llfull = ldfull |
---|
| 2694 | ELSE ; llfull = .FALSE. |
---|
| 2695 | ENDIF |
---|
[9019] | 2696 | ! |
---|
[4148] | 2697 | CALL ju2ymds( pjday, iyear, imonth, iday, zsec ) |
---|
| 2698 | isec = NINT(zsec) |
---|
[9019] | 2699 | ! |
---|
[4148] | 2700 | IF ( ll24 .AND. isec == 0 ) THEN ! 00:00 of the next day -> move to 24:00 of the current day |
---|
[13226] | 2701 | CALL ju2ymds( pjday - 1.0_wp, iyear, imonth, iday, zsec ) |
---|
[4148] | 2702 | isec = 86400 |
---|
| 2703 | ENDIF |
---|
[9019] | 2704 | ! |
---|
[14072] | 2705 | IF( iyear < 10000 ) THEN ; clfmt = "i4.4,2i2.2" ! format used to write the date |
---|
[4148] | 2706 | ELSE ; WRITE(clfmt, "('i',i1,',2i2.2')") INT(LOG10(REAL(iyear,wp))) + 1 |
---|
| 2707 | ENDIF |
---|
[9019] | 2708 | ! |
---|
[14072] | 2709 | !$AGRIF_DO_NOT_TREAT |
---|
[9019] | 2710 | ! needed in the conv |
---|
[14072] | 2711 | IF( llfull ) THEN |
---|
[4148] | 2712 | clfmt = TRIM(clfmt)//",'_',i2.2,':',i2.2,':',i2.2" |
---|
| 2713 | ihour = isec / 3600 |
---|
| 2714 | isec = MOD(isec, 3600) |
---|
| 2715 | iminute = isec / 60 |
---|
| 2716 | isec = MOD(isec, 60) |
---|
| 2717 | WRITE(iom_sdate, '('//TRIM(clfmt)//')') iyear, imonth, iday, ihour, iminute, isec ! date of the end of run |
---|
| 2718 | ELSE |
---|
| 2719 | WRITE(iom_sdate, '('//TRIM(clfmt)//')') iyear, imonth, iday ! date of the end of run |
---|
| 2720 | ENDIF |
---|
[14072] | 2721 | !$AGRIF_END_DO_NOT_TREAT |
---|
[9019] | 2722 | ! |
---|
[4148] | 2723 | END FUNCTION iom_sdate |
---|
| 2724 | |
---|
[1359] | 2725 | #else |
---|
[9019] | 2726 | !!---------------------------------------------------------------------- |
---|
[14822] | 2727 | !! NOT 'key_xios' a few dummy routines |
---|
[9019] | 2728 | !!---------------------------------------------------------------------- |
---|
[4152] | 2729 | SUBROUTINE iom_setkt( kt, cdname ) |
---|
[14072] | 2730 | INTEGER , INTENT(in):: kt |
---|
[4152] | 2731 | CHARACTER(LEN=*), INTENT(in) :: cdname |
---|
| 2732 | IF( .FALSE. ) WRITE(numout,*) kt, cdname ! useless test to avoid compilation warnings |
---|
[1359] | 2733 | END SUBROUTINE iom_setkt |
---|
| 2734 | |
---|
[4152] | 2735 | SUBROUTINE iom_context_finalize( cdname ) |
---|
| 2736 | CHARACTER(LEN=*), INTENT(in) :: cdname |
---|
| 2737 | IF( .FALSE. ) WRITE(numout,*) cdname ! useless test to avoid compilation warnings |
---|
| 2738 | END SUBROUTINE iom_context_finalize |
---|
| 2739 | |
---|
[12377] | 2740 | SUBROUTINE iom_update_file_name( cdid ) |
---|
| 2741 | CHARACTER(LEN=*), INTENT(in) :: cdid |
---|
| 2742 | IF( .FALSE. ) WRITE(numout,*) cdid ! useless test to avoid compilation warnings |
---|
| 2743 | END SUBROUTINE iom_update_file_name |
---|
| 2744 | |
---|
[1359] | 2745 | #endif |
---|
[4689] | 2746 | |
---|
| 2747 | LOGICAL FUNCTION iom_use( cdname ) |
---|
| 2748 | CHARACTER(LEN=*), INTENT(in) :: cdname |
---|
[14822] | 2749 | #if defined key_xios |
---|
[4689] | 2750 | iom_use = xios_field_is_active( cdname ) |
---|
| 2751 | #else |
---|
| 2752 | iom_use = .FALSE. |
---|
| 2753 | #endif |
---|
| 2754 | END FUNCTION iom_use |
---|
[11536] | 2755 | |
---|
| 2756 | SUBROUTINE iom_miss_val( cdname, pmiss_val ) |
---|
| 2757 | CHARACTER(LEN=*), INTENT(in ) :: cdname |
---|
[14072] | 2758 | REAL(wp) , INTENT(out) :: pmiss_val |
---|
| 2759 | REAL(dp) :: ztmp_pmiss_val |
---|
[14822] | 2760 | #if defined key_xios |
---|
[11536] | 2761 | ! get missing value |
---|
[13226] | 2762 | CALL xios_get_field_attr( cdname, default_value = ztmp_pmiss_val ) |
---|
| 2763 | pmiss_val = ztmp_pmiss_val |
---|
[11536] | 2764 | #else |
---|
| 2765 | IF( .FALSE. ) WRITE(numout,*) cdname, pmiss_val ! useless test to avoid compilation warnings |
---|
[12377] | 2766 | IF( .FALSE. ) pmiss_val = 0._wp ! useless assignment to avoid compilation warnings |
---|
[11536] | 2767 | #endif |
---|
| 2768 | END SUBROUTINE iom_miss_val |
---|
[14072] | 2769 | |
---|
[544] | 2770 | !!====================================================================== |
---|
| 2771 | END MODULE iom |
---|