@@ -226,12 +226,38 @@ subroutine initialize_regridding(CS, GV, US, max_depth, param_file, mdl, coord_m
226
226
real , dimension (:), allocatable :: dz_max ! Thicknesses used to find maximum interface depths
227
227
! [H ~> m or kg m-2] or other units
228
228
real , dimension (:), allocatable :: rho_target ! Target density used in HYBRID mode [kg m-3]
229
- ! > Thicknesses [m] that give level centers corresponding to table 2 of WOA09
230
- real , dimension (40 ) :: woa09_dz = (/ 5 ., 10 ., 10 ., 15 ., 22.5 , 25 ., 25 ., 25 ., &
231
- 37.5 , 50 ., 50 ., 75 ., 100 ., 100 ., 100 ., 100 ., &
232
- 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 175 ., &
233
- 250 ., 375 ., 500 ., 500 ., 500 ., 500 ., 500 ., 500 ., &
234
- 500 ., 500 ., 500 ., 500 ., 500 ., 500 ., 500 ., 500 . / )
229
+ ! Thicknesses [m] that give level centers approximately corresponding to table 2 of WOA09
230
+ ! These are approximate because the WOA09 depths are not smoothly spaced. Levels
231
+ ! 1, 4, 5, 9, 12, 24, and 36 are 2.5, 2.5, 1.25 12.5, 37.5 and 62.5 m deeper than WOA09
232
+ ! but all others are identical.
233
+ real , dimension (40 ) :: woa09_dz_approx = (/ 5 ., 10 ., 10 ., 15 ., 22.5 , 25 ., 25 ., 25 ., &
234
+ 37.5 , 50 ., 50 ., 75 ., 100 ., 100 ., 100 ., 100 ., &
235
+ 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 175 ., &
236
+ 250 ., 375 ., 500 ., 500 ., 500 ., 500 ., 500 ., 500 ., &
237
+ 500 ., 500 ., 500 ., 500 ., 500 ., 500 ., 500 ., 500 . / )
238
+ ! These are the actual spacings [m] between WOA09 depths which, if used for layer thickness, places
239
+ ! the interfaces at the WOA09 depths.
240
+ real , dimension (39 ) :: woa09_dzi = (/ 10 ., 10 ., 10 ., 20 ., 25 ., 25 ., 25 ., 25 ., &
241
+ 50 ., 50 ., 50 ., 100 ., 100 ., 100 ., 100 ., 100 ., &
242
+ 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 250 ., &
243
+ 250 ., 500 ., 500 ., 500 ., 500 ., 500 ., 500 ., 500 ., &
244
+ 500 ., 500 ., 500 ., 500 ., 500 ., 500 ., 500 . / )
245
+ ! These are the spacings [m] between WOA23 depths from table 3 of
246
+ ! https://www.ncei.noaa.gov/data/oceans/woa/WOA13/DOC/woa13documentation.pdf
247
+ real , dimension (136 ) :: woa23_dzi = (/ 5 ., 5 ., 5 ., 5 ., 5 ., 5 ., 5 ., 5 ., 5 ., 5 ., &
248
+ 5 ., 5 ., 5 ., 5 ., 5 ., 5 ., 5 ., 5 ., 5 ., 5 ., &
249
+ 25 ., 25 ., 25 ., 25 ., 25 ., 25 ., 25 ., 25 ., 25 ., 25 ., &
250
+ 25 ., 25 ., 25 ., 25 ., 25 ., 25 ., 50 ., 50 ., 50 ., 50 ., &
251
+ 50 ., 50 ., 50 ., 50 ., 50 ., 50 ., 50 ., 50 ., 50 ., 50 ., &
252
+ 50 ., 50 ., 50 ., 50 ., 50 ., 50 ., 50 ., 50 ., 50 ., 50 ., &
253
+ 50 ., 50 ., 50 ., 50 ., 50 ., 50 ., 100 ., 100 ., 100 ., 100 ., &
254
+ 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., &
255
+ 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., &
256
+ 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., &
257
+ 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., &
258
+ 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., &
259
+ 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., 100 ., &
260
+ 100 ., 100 ., 100 ., 100 ., 100 ., 100 . / )
235
261
236
262
call get_param(param_file, mdl, " INPUTDIR" , inputdir, default= " ." )
237
263
inputdir = slasher(inputdir)
@@ -325,6 +351,8 @@ subroutine initialize_regridding(CS, GV, US, max_depth, param_file, mdl, coord_m
325
351
" by a comma or space, e.g. FILE:lev.nc,dz\n" // &
326
352
" or FILE:lev.nc,interfaces=zw\n" // &
327
353
" WOA09[:N] - the WOA09 vertical grid (approximately)\n" // &
354
+ " WOA09INT[:N] - layers spanned by the WOA09 depths\n" // &
355
+ " WOA23INT[:N] - layers spanned by the WOA23 depths\n" // &
328
356
" FNC1:string - FNC1:dz_min,H_total,power,precision\n" // &
329
357
" HYBRID:string - read from a file. The string specifies\n" // &
330
358
" the filename and two variable names, separated\n" // &
@@ -458,29 +486,75 @@ subroutine initialize_regridding(CS, GV, US, max_depth, param_file, mdl, coord_m
458
486
call log_param(param_file, mdl, " !TARGET_DENSITIES" , rho_target, &
459
487
' HYBRID target densities for interfaces' , units= coordinateUnits(coord_mode))
460
488
endif
489
+ elseif (index (trim (string),' WOA09INT' )==1 ) then
490
+ if (len_trim (string)==8 ) then ! string=='WOA09INT'
491
+ tmpReal = 0 . ; ke = 0 ; dz_extra = 0 .
492
+ do while (tmpReal< maximum_depth)
493
+ ke = ke + 1
494
+ if (ke > size (woa09_dzi)) then
495
+ dz_extra = maximum_depth - tmpReal
496
+ exit
497
+ endif
498
+ tmpReal = tmpReal + woa09_dzi(ke)
499
+ enddo
500
+ elseif (index (trim (string),' WOA09INT:' )==1 ) then ! string starts with 'WOA09INT:'
501
+ if (len_trim (string)==9 ) call MOM_error(FATAL,trim (mdl)// ' , initialize_regridding: ' // &
502
+ ' Expected string of form "WOA09INT:N" but got "' // trim (string)// ' ".' )
503
+ ke = extract_integer(string (10 :len_trim (string)),' ' ,1 )
504
+ if (ke> 39 .or. ke< 1 ) call MOM_error(FATAL,trim (mdl)// ' , initialize_regridding: ' // &
505
+ ' For "WOA05INT:N" N must 0<N<40 but got "' // trim (string)// ' ".' )
506
+ endif
507
+ allocate (dz(ke))
508
+ do k= 1 ,min (ke, size (woa09_dzi))
509
+ dz(k) = woa09_dzi(k)
510
+ enddo
511
+ if (ke > size (woa09_dzi)) dz(ke) = dz_extra
512
+ elseif (index (trim (string),' WOA23INT' )==1 ) then
513
+ if (len_trim (string)==8 ) then ! string=='WOA23INT'
514
+ tmpReal = 0 . ; ke = 0 ; dz_extra = 0 .
515
+ do while (tmpReal< maximum_depth)
516
+ ke = ke + 1
517
+ if (ke > size (woa23_dzi)) then
518
+ dz_extra = maximum_depth - tmpReal
519
+ exit
520
+ endif
521
+ tmpReal = tmpReal + woa23_dzi(ke)
522
+ enddo
523
+ elseif (index (trim (string),' WOA23INT:' )==1 ) then ! string starts with 'WOA23INT:'
524
+ if (len_trim (string)==9 ) call MOM_error(FATAL,trim (mdl)// ' , initialize_regridding: ' // &
525
+ ' Expected string of form "WOA23INT:N" but got "' // trim (string)// ' ".' )
526
+ ke = extract_integer(string (10 :len_trim (string)),' ' ,1 )
527
+ if (ke> 39 .or. ke< 1 ) call MOM_error(FATAL,trim (mdl)// ' , initialize_regridding: ' // &
528
+ ' For "WOA05INT:N" N must 0<N<40 but got "' // trim (string)// ' ".' )
529
+ endif
530
+ allocate (dz(ke))
531
+ do k= 1 ,min (ke, size (woa23_dzi))
532
+ dz(k) = woa23_dzi(k)
533
+ enddo
534
+ if (ke > size (woa23_dzi)) dz(ke) = dz_extra
461
535
elseif (index (trim (string),' WOA09' )==1 ) then
462
- if (len_trim (string)==5 ) then
536
+ if (len_trim (string)==5 ) then ! string=='WOA09'
463
537
tmpReal = 0 . ; ke = 0 ; dz_extra = 0 .
464
538
do while (tmpReal< maximum_depth)
465
539
ke = ke + 1
466
- if (ke > size (woa09_dz )) then
540
+ if (ke > size (woa09_dz_approx )) then
467
541
dz_extra = maximum_depth - tmpReal
468
542
exit
469
543
endif
470
- tmpReal = tmpReal + woa09_dz (ke)
544
+ tmpReal = tmpReal + woa09_dz_approx (ke)
471
545
enddo
472
- elseif (index (trim (string),' WOA09:' )==1 ) then
546
+ elseif (index (trim (string),' WOA09:' )==1 ) then ! string starts with 'WOA09:'
473
547
if (len_trim (string)==6 ) call MOM_error(FATAL,trim (mdl)// ' , initialize_regridding: ' // &
474
548
' Expected string of form "WOA09:N" but got "' // trim (string)// ' ".' )
475
549
ke = extract_integer(string (7 :len_trim (string)),' ' ,1 )
476
550
if (ke> 40 .or. ke< 1 ) call MOM_error(FATAL,trim (mdl)// ' , initialize_regridding: ' // &
477
551
' For "WOA05:N" N must 0<N<41 but got "' // trim (string)// ' ".' )
478
552
endif
479
553
allocate (dz(ke))
480
- do k= 1 ,min (ke, size (woa09_dz ))
481
- dz(k) = woa09_dz (k)
554
+ do k= 1 ,min (ke, size (woa09_dz_approx ))
555
+ dz(k) = woa09_dz_approx (k)
482
556
enddo
483
- if (ke > size (woa09_dz )) dz(ke) = dz_extra
557
+ if (ke > size (woa09_dz_approx )) dz(ke) = dz_extra
484
558
else
485
559
call MOM_error(FATAL,trim (mdl)// " , initialize_regridding: " // &
486
560
" Unrecognized coordinate configuration" // trim (string))
0 commit comments