| 160 | |
| 161 | The following changes to rebuild_nemo.F90 achieve the required result: |
| 162 | |
| 163 | {{{#!diff |
| 164 | --- REBUILD_NEMO/src/org.rebuild_nemo.F90 2020-08-12 17:28:17.562148712 +0100 |
| 165 | +++ REBUILD_NEMO/src/rebuild_nemo.F90 2020-08-12 20:01:36.044158059 +0100 |
| 166 | @@ -70,8 +70,8 @@ |
| 167 | CHARACTER(LEN=50) :: clibnc ! netcdf library version |
| 168 | |
| 169 | INTEGER :: ndomain, ifile, ndomain_file, nslicesize, deflate_level |
| 170 | - INTEGER :: ncid, outid, idim, istop |
| 171 | - INTEGER :: natts, attid, xtype, varid, rbdims |
| 172 | + INTEGER :: ncid, outid, idim, istop, istat |
| 173 | + INTEGER :: natts, attid, xtype, varid, rbdims, rbdims1 |
| 174 | INTEGER :: jv, ndims, nvars, dimlen, dimids(4) |
| 175 | INTEGER :: dimid, unlimitedDimId, di, dj, dr |
| 176 | INTEGER :: nmax_unlimited, nt, ntslice |
| 177 | @@ -92,6 +92,8 @@ |
| 178 | INTEGER, DIMENSION(2) :: halo_start, halo_end, local_sizes |
| 179 | INTEGER, DIMENSION(2) :: idomain, jdomain, rdomain, start_pos |
| 180 | INTEGER :: ji, jj, jk, jl, jr |
| 181 | + INTEGER :: ni_zoom, nj_zoom, ni_off, nj_off |
| 182 | + LOGICAL :: iszoom |
| 183 | INTEGER :: nargs ! number of arguments |
| 184 | INTEGER, EXTERNAL :: iargc |
| 185 | |
| 186 | @@ -252,10 +254,16 @@ |
| 187 | |
| 188 | CALL check_nf90( nf90_get_att( ncid, nf90_global, 'DOMAIN_number_total', ndomain_file ) ) |
| 189 | IF( ndomain /= ndomain_file ) THEN |
| 190 | - WRITE(numerr,*) 'ERROR! : number of files to rebuild in file does not agree with namelist' |
| 191 | + WRITE(numerr,*) 'WARNING! : number of files to rebuild in file does not agree with namelist' |
| 192 | WRITE(numerr,*) 'Attribute DOMAIN_number_total is : ', ndomain_file |
| 193 | WRITE(numerr,*) 'Number of files specified in namelist is: ', ndomain |
| 194 | - STOP 2 |
| 195 | + istat = nf90_inquire_attribute( ncid, nf90_global, 'DOMAIN_size_zoom_i', xtype, rbdims, attid ) |
| 196 | + IF ( istat == nf90_noerr ) THEN |
| 197 | + WRITE(numerr,*) 'This looks like a zoom region so I will assume you know what you are doing' |
| 198 | + ELSE |
| 199 | + WRITE(numerr,*) 'This is a potentially fatal error' |
| 200 | + STOP 2 |
| 201 | + ENDIF |
| 202 | ENDIF |
| 203 | |
| 204 | !2.1 Set up the output file |
| 205 | @@ -275,6 +283,29 @@ |
| 206 | |
| 207 | ALLOCATE(global_sizes(rbdims)) |
| 208 | CALL check_nf90( nf90_get_att( ncid, nf90_global, 'DOMAIN_size_global', global_sizes ) ) |
| 209 | + |
| 210 | +!2.2.0.1 Override global sizes if zoom attributes are found |
| 211 | + istat = nf90_inquire_attribute( ncid, nf90_global, 'DOMAIN_size_zoom_i', xtype, rbdims1, attid ) |
| 212 | + IF ( istat == nf90_noerr ) THEN |
| 213 | + CALL check_nf90( nf90_get_att( ncid, nf90_global, 'DOMAIN_size_zoom_i', ni_zoom ) ) |
| 214 | + iszoom = .true. |
| 215 | + ELSE |
| 216 | + iszoom = .false. |
| 217 | + ENDIF |
| 218 | + istat = nf90_inquire_attribute( ncid, nf90_global, 'DOMAIN_size_zoom_j', xtype, rbdims1, attid ) |
| 219 | + IF ( istat == nf90_noerr ) THEN |
| 220 | + CALL check_nf90( nf90_get_att( ncid, nf90_global, 'DOMAIN_size_zoom_j', nj_zoom ) ) |
| 221 | + iszoom = .true. |
| 222 | + ELSE |
| 223 | + iszoom = .false. |
| 224 | + ENDIF |
| 225 | + IF( iszoom ) THEN |
| 226 | + global_sizes(1) = ni_zoom |
| 227 | + global_sizes(2) = nj_zoom |
| 228 | + CALL check_nf90( nf90_get_att( ncid, nf90_global, 'ibegin', ni_off ) ) |
| 229 | + CALL check_nf90( nf90_get_att( ncid, nf90_global, 'jbegin', nj_off ) ) |
| 230 | + ENDIF |
| 231 | + |
| 232 | IF (l_verbose) WRITE(numout,*) 'Size of global arrays: ', global_sizes |
| 233 | |
| 234 | |
| 235 | @@ -773,6 +804,9 @@ |
| 236 | halo_start(2) = 0 |
| 237 | di=rebuild_dims(1) |
| 238 | dj=3-di |
| 239 | + ELSEIF ( iszoom ) THEN |
| 240 | + start_pos(di) = start_pos(di) - ni_off |
| 241 | + start_pos(dj) = start_pos(dj) - nj_off |
| 242 | ENDIF |
| 243 | |
| 244 | !3.3.1 Generate local domain interior sizes from local_sizes and halo sizes |
| 245 | }}} |