From 8b019278ba2678d86f44c9356f0eefac0b744530 Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Thu, 28 Aug 2025 18:52:55 -0400 Subject: [PATCH 01/44] New ocean bathymetry v2 (OM4) is added --- .../Utils/Raster/makebcs/make_bcs_cube.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py index e603f411c..ec12b7dff 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py @@ -8,12 +8,16 @@ cube_template = """ -ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/360x200 data/MOM5/360x200 -ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/720x410 data/MOM5/720x410 -ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/1440x1080 data/MOM5/1440x1080 -ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/72x36 data/MOM6/72x36 -ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/540x458 data/MOM6/540x458 -ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/1440x1080 data/MOM6/1440x1080 +if ({lbcsv} == "v14_BETA") + ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/v2/1440x1080 data/MOM6/1440x1080 +else + ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/360x200 data/MOM5/360x200 + ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/720x410 data/MOM5/720x410 + ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/1440x1080 data/MOM5/1440x1080 + ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/v1/72x36 data/MOM6/72x36 + ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/v1/540x458 data/MOM6/540x458 + ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/v1/1440x1080 data/MOM6/1440x1080 +endif if( -e CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout ) /bin/rm -f CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout From 6cc2ea7b913de2b0bebef3cef613dbcdfe895e08 Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Thu, 28 Aug 2025 18:53:10 -0400 Subject: [PATCH 02/44] New ocean bathymetry v2 (OM4) is added --- .../Utils/Raster/makebcs/make_bcs_questionary.py | 1 + 1 file changed, 1 insertion(+) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py index 386d834c4..a0962d856 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py @@ -199,6 +199,7 @@ def ask_questions(default_grid="Cubed-Sphere"): "v11 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2", \ "v12 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix", \ "v13 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix + mean land elevation fix", \ + "v14_BETA : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix + mean land elevation fix + v2 (OM4) ocean-seaice bathymetry", \ "ICA : Icarus (archived*: /discover/nobackup/projects/gmao/bcs_shared/legacy_bcs/Icarus/)", \ "GM4 : Ganymed-4_0 (archived*: /discover/nobackup/projects/gmao/bcs_shared/legacy_bcs/Ganymed-4_0/)", \ "F25 : Fortuna-2_5 (archived*: n/a)"], From 392194c7203c86fdbdb3fdcc01b474bff81f808c Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Thu, 28 Aug 2025 18:53:27 -0400 Subject: [PATCH 03/44] New ocean bathymetry v2 (OM4) is added --- .../Raster/makebcs/rmTinyCatchParaMod.F90 | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 index 307934f61..55f3257e2 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 @@ -242,6 +242,21 @@ SUBROUTINE init_bcs_config(LBCSV) use_PEATMAP = .true. jpl_height = .true. + case ("v14_BETA") + + ! "v14", "v13", and "v12" are identical except for: + ! - topography used for the atm (processed outside of make_bcs) + ! - v14 is used for coupled atm-ocean-seaice with v2 (OM4) ocean bathymetry + + LAIBCS = 'MODGEO' + SOILBCS = 'HWSD_b' + MODALB = 'MODIS2' + SNOWALB = 'MODC061v2' + OUTLETV = "v2" + GNU = 1.0 + use_PEATMAP = .true. + jpl_height = .true. + case default print *,'init_bcs_config(): unknown land boundary conditions version (LBCSV)' @@ -5514,10 +5529,10 @@ SUBROUTINE svbksb(u,w,v,m,n,b,x) REAL*8 b(m),u(m,n),v(n,n),w(n),x(n) PARAMETER (NMAX=500) !Maximum anticipated value of n !------------------------------------------------------------------------------------------- - ! Solves A · X = B for a vector X, where A is specified by the arrays u, w, v as returned by + ! Solves A X = B for a vector X, where A is specified by the arrays u, w, v as returned by ! svdcmp. m and n are the dimensions of a, and will be equal for square matrices. b(1:m) is ! the input right-hand side. x(1:n) is the output solution vector. No input quantities are - ! destroyed, so the routine may be called sequentially with different b’s. + ! destroyed, so the routine may be called sequentially with different b?s. !------------------------------------------------------------------------------------------- INTEGER i,j,jj @@ -5552,7 +5567,7 @@ SUBROUTINE svdcmp(a,m,n,w,v) PARAMETER (NMAX=500) !Maximum anticipated value of n. !-------------------------------------------------------------------------------------- ! Given a matrix A(1:m,1:n), this routine computes its singular value decomposition, - ! A = U · W · Vt. The matrix U replaces A on output. The diagonal matrix of singular + ! A = U W Vt. The matrix U replaces A on output. The diagonal matrix of singular ! values W is output as a vector W(1:n). The matrix V (not the transpose Vt) is output ! as V(1:n,1:n). !-------------------------------------------------------------------------------------- From 43dc33d959f6ec6ffa80b12f6dcc920af209c5c2 Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Fri, 29 Aug 2025 09:52:44 -0400 Subject: [PATCH 04/44] A typo on text is fixed --- .../Utils/Raster/makebcs/rmTinyCatchParaMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 index 55f3257e2..cb6a8c640 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 @@ -5532,7 +5532,7 @@ SUBROUTINE svbksb(u,w,v,m,n,b,x) ! Solves A X = B for a vector X, where A is specified by the arrays u, w, v as returned by ! svdcmp. m and n are the dimensions of a, and will be equal for square matrices. b(1:m) is ! the input right-hand side. x(1:n) is the output solution vector. No input quantities are - ! destroyed, so the routine may be called sequentially with different b?s. + ! destroyed, so the routine may be called sequentially with different b's. !------------------------------------------------------------------------------------------- INTEGER i,j,jj From 87de89848e0208da0461383fe39a9c7831ebe671 Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Fri, 29 Aug 2025 11:50:10 -0400 Subject: [PATCH 05/44] MOM6 bathymetry version is added --- .../Utils/Raster/makebcs/make_bcs_cube.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py index ec12b7dff..b2709b91c 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py @@ -8,17 +8,20 @@ cube_template = """ -if ({lbcsv} == "v14_BETA") - ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/v2/1440x1080 data/MOM6/1440x1080 +if ({lbcsv} == "v14") + {ocean_bathy_version} = "v2" else - ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/360x200 data/MOM5/360x200 - ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/720x410 data/MOM5/720x410 - ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/1440x1080 data/MOM5/1440x1080 - ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/v1/72x36 data/MOM6/72x36 - ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/v1/540x458 data/MOM6/540x458 - ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/v1/1440x1080 data/MOM6/1440x1080 + {ocean_bathy_version} = "v1" endif +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/360x200 data/MOM5/360x200 +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/720x410 data/MOM5/720x410 +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/1440x1080 data/MOM5/1440x1080 +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{ocean_bathy_version}/72x36 data/MOM6/72x36 +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{ocean_bathy_version}/540x458 data/MOM6/540x458 +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{ocean_bathy_version}/1440x1080 data/MOM6/1440x1080 + + if( -e CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout ) /bin/rm -f CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout bin/mkCubeFVRaster.x -x {NX} -y {NY} {SGPARAM} {STRETCH} {NC} >/dev/null From 950b8e6238b125563de29bf3349e662759ca25b9 Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Fri, 29 Aug 2025 11:51:10 -0400 Subject: [PATCH 06/44] Updates on v14 bcs --- .../Utils/Raster/makebcs/make_bcs_questionary.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py index a0962d856..2d832958a 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py @@ -174,6 +174,14 @@ def ask_questions(default_grid="Cubed-Sphere"): ocean resolution. ", "choices": ["No", "Yes"], }, + + {"type": "select", + "name": "ocean_bathy_version", + "message": "Select ocean bathymetry version in coupled mode.", + "choices": [ \ + "v1 : MOM5 bathymetries and MOM6 bathymetries with v1 ocean grids",\ + "v2 : MOM6 bathymetries with OM4 ocean grids. For now, only available at 1440x1080. Select v14 for next question"], + }, { "type": "select", @@ -199,7 +207,7 @@ def ask_questions(default_grid="Cubed-Sphere"): "v11 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2", \ "v12 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix", \ "v13 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix + mean land elevation fix", \ - "v14_BETA : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix + mean land elevation fix + v2 (OM4) ocean-seaice bathymetry", \ + "v14 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix + mean land elevation fix + v2 (OM4) ocean-seaice bathymetry", \ "ICA : Icarus (archived*: /discover/nobackup/projects/gmao/bcs_shared/legacy_bcs/Icarus/)", \ "GM4 : Ganymed-4_0 (archived*: /discover/nobackup/projects/gmao/bcs_shared/legacy_bcs/Ganymed-4_0/)", \ "F25 : Fortuna-2_5 (archived*: n/a)"], From e796d0ad4577d6d43bbc5840cab97ee733bc985e Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Fri, 29 Aug 2025 11:51:51 -0400 Subject: [PATCH 07/44] Typo on text is fixed --- .../Utils/Raster/makebcs/rmTinyCatchParaMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 index cb6a8c640..096040b13 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 @@ -242,7 +242,7 @@ SUBROUTINE init_bcs_config(LBCSV) use_PEATMAP = .true. jpl_height = .true. - case ("v14_BETA") + case ("v14") ! "v14", "v13", and "v12" are identical except for: ! - topography used for the atm (processed outside of make_bcs) From 922e7352fbb5b9f9a522d4f253a7ad32463325e4 Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Fri, 29 Aug 2025 12:00:37 -0400 Subject: [PATCH 08/44] Typo on text is fixed --- .../Utils/Raster/makebcs/rmTinyCatchParaMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 index 096040b13..e613d5002 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 @@ -5529,7 +5529,7 @@ SUBROUTINE svbksb(u,w,v,m,n,b,x) REAL*8 b(m),u(m,n),v(n,n),w(n),x(n) PARAMETER (NMAX=500) !Maximum anticipated value of n !------------------------------------------------------------------------------------------- - ! Solves A X = B for a vector X, where A is specified by the arrays u, w, v as returned by + ! Solves A "A^" . X = B for a vector X, where A is specified by the arrays u, w, v as returned by ! svdcmp. m and n are the dimensions of a, and will be equal for square matrices. b(1:m) is ! the input right-hand side. x(1:n) is the output solution vector. No input quantities are ! destroyed, so the routine may be called sequentially with different b's. From 2ed8999bf27f4b4e8392f34ffdd06f4e6a1e3273 Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Fri, 29 Aug 2025 12:01:55 -0400 Subject: [PATCH 09/44] Typo on text is fixed --- .../Utils/Raster/makebcs/rmTinyCatchParaMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 index e613d5002..2cd00dd74 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 @@ -5567,7 +5567,7 @@ SUBROUTINE svdcmp(a,m,n,w,v) PARAMETER (NMAX=500) !Maximum anticipated value of n. !-------------------------------------------------------------------------------------- ! Given a matrix A(1:m,1:n), this routine computes its singular value decomposition, - ! A = U W Vt. The matrix U replaces A on output. The diagonal matrix of singular + ! A = U . W . Vt. The matrix U replaces A on output. The diagonal matrix of singular ! values W is output as a vector W(1:n). The matrix V (not the transpose Vt) is output ! as V(1:n,1:n). !-------------------------------------------------------------------------------------- From fb7adc0156880cdc7755daa642e9ba0028e7ece8 Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Fri, 29 Aug 2025 12:37:54 -0400 Subject: [PATCH 10/44] More clean-up for mom6 v2 bathymetry --- .../Utils/Raster/makebcs/make_bcs_cube.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py index b2709b91c..c4d5fe316 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py @@ -9,17 +9,17 @@ cube_template = """ if ({lbcsv} == "v14") - {ocean_bathy_version} = "v2" + {mom6_bathy_version} = "v2" else - {ocean_bathy_version} = "v1" + {mom6_bathy_version} = "v1" endif ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/360x200 data/MOM5/360x200 ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/720x410 data/MOM5/720x410 ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/1440x1080 data/MOM5/1440x1080 -ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{ocean_bathy_version}/72x36 data/MOM6/72x36 -ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{ocean_bathy_version}/540x458 data/MOM6/540x458 -ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{ocean_bathy_version}/1440x1080 data/MOM6/1440x1080 +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/72x36 data/MOM6/72x36 +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/540x458 data/MOM6/540x458 +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/1440x1080 data/MOM6/1440x1080 if( -e CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout ) /bin/rm -f CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout From 6d6f4bd84576331cd4bb5dae3b5f33f53c1249b7 Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Fri, 29 Aug 2025 12:38:07 -0400 Subject: [PATCH 11/44] More clean-up for mom6 v2 bathymetry --- .../Utils/Raster/makebcs/make_bcs_questionary.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py index 2d832958a..f8ef889cf 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py @@ -175,14 +175,6 @@ def ask_questions(default_grid="Cubed-Sphere"): "choices": ["No", "Yes"], }, - {"type": "select", - "name": "ocean_bathy_version", - "message": "Select ocean bathymetry version in coupled mode.", - "choices": [ \ - "v1 : MOM5 bathymetries and MOM6 bathymetries with v1 ocean grids",\ - "v2 : MOM6 bathymetries with OM4 ocean grids. For now, only available at 1440x1080. Select v14 for next question"], - }, - { "type": "select", "name": "bcs_version", @@ -207,7 +199,7 @@ def ask_questions(default_grid="Cubed-Sphere"): "v11 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2", \ "v12 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix", \ "v13 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix + mean land elevation fix", \ - "v14 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix + mean land elevation fix + v2 (OM4) ocean-seaice bathymetry", \ + "v14 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix + mean land elevation fix + MOM6 v2 (OM4) ocean-seaice bathymetry", \ "ICA : Icarus (archived*: /discover/nobackup/projects/gmao/bcs_shared/legacy_bcs/Icarus/)", \ "GM4 : Ganymed-4_0 (archived*: /discover/nobackup/projects/gmao/bcs_shared/legacy_bcs/Ganymed-4_0/)", \ "F25 : Fortuna-2_5 (archived*: n/a)"], From 02fe5c7cb1bf98164823d0ec932d2d1c0d5731b7 Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Fri, 29 Aug 2025 16:02:04 -0400 Subject: [PATCH 12/44] Merging v12, v13, and v14 bcs cases --- .../Raster/makebcs/rmTinyCatchParaMod.F90 | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 index 2cd00dd74..7ff196e07 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 @@ -226,28 +226,14 @@ SUBROUTINE init_bcs_config(LBCSV) use_PEATMAP = .true. jpl_height = .true. - case ("v12","v13") + case ("v12","v13","v14") - ! "v12" and "v13" are identical except for: + ! "v12", "v13", and "v14" are identical except for: ! - topography used for the atm (processed outside of make_bcs) ! - bug fix for land elevation in catchment.def file ! - generation of nc4-formatted tile file + ! - v14 is used for coupled atm-ocean-seaice with MOM6/v2 (OM4) ocean bathymetry - LAIBCS = 'MODGEO' - SOILBCS = 'HWSD_b' - MODALB = 'MODIS2' - SNOWALB = 'MODC061v2' - OUTLETV = "v2" - GNU = 1.0 - use_PEATMAP = .true. - jpl_height = .true. - - case ("v14") - - ! "v14", "v13", and "v12" are identical except for: - ! - topography used for the atm (processed outside of make_bcs) - ! - v14 is used for coupled atm-ocean-seaice with v2 (OM4) ocean bathymetry - LAIBCS = 'MODGEO' SOILBCS = 'HWSD_b' MODALB = 'MODIS2' From d157723aecae9bf080fe68291abf50d8daab52af Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Thu, 11 Sep 2025 12:34:06 -0400 Subject: [PATCH 13/44] add options so code is more flexiable --- .../Utils/Raster/makebcs/make_bcs_cube.py | 65 +++++++++++++++---- .../Utils/Raster/makebcs/make_bcs_shared.py | 38 +++++++++++ .../Raster/makebcs/rmTinyCatchParaMod.F90 | 12 ++-- 3 files changed, 97 insertions(+), 18 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py index c4d5fe316..680704953 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py @@ -5,21 +5,57 @@ import os from make_bcs_questionary import * from make_bcs_shared import * +import re +from datetime import datetime +import subprocess -cube_template = """ +def _resolve_versions(bcs_version: str): + """ + Returns (mom6_bathy_version, topo_version) as 'v1' or 'v2' + Rule: v14+ -> v2; else -> v1. Non-numeric (NL3, ICA, GM4...) -> v1. + """ + v = (bcs_version or "").strip() + m = re.match(r'[vV]?(\d+)', v) + vnum = int(m.group(1)) if m else None + use_v2 = vnum is not None and vnum >= 14 + return ("v2" if use_v2 else "v1", "v2" if use_v2 else "v1") -if ({lbcsv} == "v14") - {mom6_bathy_version} = "v2" -else - {mom6_bathy_version} = "v1" -endif +def _build_mom6_link_lines(inputdir: str, preferred_version: str) -> str: + """ + Build csh lines to symlink MOM6 datasets. + Prefer `preferred_version` (v1 or v2) per size; if missing, fall back to the other version. + Emits an echo note on fallback; warns if a size is missing in both. + """ + sizes = ["72x36", "540x458", "1440x1080"] + other = "v1" if preferred_version == "v2" else "v2" + + lines = ['if ( ! -d data/MOM6 ) mkdir -p data/MOM6'] + for size in sizes: + src_pref = os.path.join(inputdir, "ocean", "MOM6", preferred_version, size) + src_other = os.path.join(inputdir, "ocean", "MOM6", other, size) + + if os.path.isdir(src_pref): + src = src_pref + note = "" + elif os.path.isdir(src_other): + src = src_other + note = f'echo "NOTE: MOM6 {preferred_version}/{size} not found; using {other}/{size}"' + else: + lines.append(f'echo "WARNING: MOM6 {size} missing in both v1 and v2; skipping"') + continue + + lines.append(f'if ( -e data/MOM6/{size} ) /bin/rm -f data/MOM6/{size}') + if note: + lines.append(note) + lines.append(f'ln -s {src} data/MOM6/{size}') + return "\n".join(lines) + +cube_template = """ ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/360x200 data/MOM5/360x200 ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/720x410 data/MOM5/720x410 ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/1440x1080 data/MOM5/1440x1080 -ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/72x36 data/MOM6/72x36 -ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/540x458 data/MOM6/540x458 -ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/1440x1080 data/MOM6/1440x1080 +{MOM6_LINK_LINES} if( -e CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout ) /bin/rm -f CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout @@ -144,6 +180,9 @@ def make_bcs_cube(config): if not os.path.exists(log_dir): os.makedirs(log_dir) + MOM6_BATHY_VERSION, TOPO_VERSION = _resolve_versions(config['lbcsv']) + MOM6_LINK_LINES = _build_mom6_link_lines(config['inputdir'], MOM6_BATHY_VERSION) + script_template = get_script_head() + cube_template + get_script_mv(config['grid_type']) script_string = script_template.format(\ @@ -182,6 +221,9 @@ def make_bcs_cube(config): STRETCH = STRETCH, \ SGNAME = SGNAME, \ SGPARAM = SGPARAM, \ + TOPO_VERSION = TOPO_VERSION, + mom6_bathy_version = MOM6_BATHY_VERSION, + MOM6_LINK_LINES = MOM6_LINK_LINES, IS_STRETCHED = IS_STRETCHED, \ NCPUS = config['NCPUS']) @@ -218,6 +260,5 @@ def make_bcs_cube(config): answers = ask_questions() configs = get_configs_from_answers(answers) for config in configs: - if grid_type in ["Stretched_CS", "Cubed-Sphere"] : - make_bcs_cube(config) - + if config['grid_type'] in ["Stretched_CS", "Cubed-Sphere"]: + make_bcs_cube(config) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py index b5e651deb..78e5623db 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py @@ -4,6 +4,21 @@ import os import glob +import re + +def topo_version_for_bcs(bcs_version: str) -> str: + """ + Decide which TOPO set to use based on BCS version chosen in the questionnaire. + - v14 and later → TOPO v2 + - v13 and earlier (and NL*/ICA/GM4/F25) → TOPO v1 + """ + v = (bcs_version or "").strip() + ## m = re.fullmatch(r"[vV](\d+)", v) + m = re.match(r"[vV]?(\d+)", v) # relaxed tolerance if we change names + if m: + return "v2" if int(m.group(1)) >= 14 else "v1" + # NL3, NL4, NL5, ICA, GM4, F25, etc. + return "v1" def get_script_head() : @@ -172,6 +187,29 @@ def get_script_mv(grid_type): echo "Successfully copied CO2_MonthlyMean_DiurnalCycle.nc4 to bcs dir." endif + +# Link TOPO into this BCS directory based on bcs_version +# You can override with: setenv TOPO_VERSION v1|v2 before launching the job +if ( $?TOPO_VERSION ) then + set topo_version = $TOPO_VERSION +else + set topo_version = {TOPO_VERSION} +endif + +if ( ! -d TOPO ) mkdir -p TOPO +set topo_dir = CF{NC}x6C{SGNAME} # e.g., CF0024x6C or CF0540x6C-SG001 +set topo_root = {MAKE_BCS_INPUT_DIR}/atmosphere/TOPO +set topo_src = $topo_root/$topo_version/$topo_dir + +if ( -e TOPO/$topo_dir ) then + echo "TOPO/$topo_dir already exists; not relinking." +else if ( -d $topo_src ) then + /bin/ln -s $topo_src TOPO/$topo_dir + echo "Linked TOPO/$topo_dir -> $topo_src" +else + echo "WARNING: TOPO source not found: $topo_src" +endif + # adjust permissions chmod +rX -R geometry land logs diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 index 7ff196e07..4bbf7977f 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 @@ -227,12 +227,12 @@ SUBROUTINE init_bcs_config(LBCSV) jpl_height = .true. case ("v12","v13","v14") - - ! "v12", "v13", and "v14" are identical except for: - ! - topography used for the atm (processed outside of make_bcs) - ! - bug fix for land elevation in catchment.def file - ! - generation of nc4-formatted tile file - ! - v14 is used for coupled atm-ocean-seaice with MOM6/v2 (OM4) ocean bathymetry + ! "v12", "v13", and "v14" are identical except for: + ! - ATM topography: v12/v13 use TOPO v1; v14 uses TOPO v2. + ! - catchment.def land-elevation bug fix: absent in v12; present in v13/v14. + ! - netCDF-4 (NC4) tile-file generation: absent in v12; present in v13/v14. + ! - Coupled-model BC land properties vs AGCM: inconsistency present in v12; fixed in v13/v14. + ! - Coupled atmosphere-ocean-sea ice: v14 uses MOM6/v2 (OM4) ocean bathymetry; v12/v13 use v1. LAIBCS = 'MODGEO' SOILBCS = 'HWSD_b' From c16644cc356a765a28f42f7c03c98d44fea9ad0a Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Thu, 18 Sep 2025 09:52:15 -0400 Subject: [PATCH 14/44] refine options --- .../Utils/Raster/makebcs/make_bcs_cube.py | 85 +++++++++---------- .../Utils/Raster/makebcs/make_bcs_shared.py | 55 +++++++++--- 2 files changed, 82 insertions(+), 58 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py index 680704953..f7ae501c0 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py @@ -5,57 +5,29 @@ import os from make_bcs_questionary import * from make_bcs_shared import * -import re from datetime import datetime import subprocess -def _resolve_versions(bcs_version: str): - """ - Returns (mom6_bathy_version, topo_version) as 'v1' or 'v2' - Rule: v14+ -> v2; else -> v1. Non-numeric (NL3, ICA, GM4...) -> v1. - """ - v = (bcs_version or "").strip() - m = re.match(r'[vV]?(\d+)', v) - vnum = int(m.group(1)) if m else None - use_v2 = vnum is not None and vnum >= 14 - return ("v2" if use_v2 else "v1", "v2" if use_v2 else "v1") - -def _build_mom6_link_lines(inputdir: str, preferred_version: str) -> str: - """ - Build csh lines to symlink MOM6 datasets. - Prefer `preferred_version` (v1 or v2) per size; if missing, fall back to the other version. - Emits an echo note on fallback; warns if a size is missing in both. - """ - sizes = ["72x36", "540x458", "1440x1080"] - other = "v1" if preferred_version == "v2" else "v2" - - lines = ['if ( ! -d data/MOM6 ) mkdir -p data/MOM6'] - for size in sizes: - src_pref = os.path.join(inputdir, "ocean", "MOM6", preferred_version, size) - src_other = os.path.join(inputdir, "ocean", "MOM6", other, size) - - if os.path.isdir(src_pref): - src = src_pref - note = "" - elif os.path.isdir(src_other): - src = src_other - note = f'echo "NOTE: MOM6 {preferred_version}/{size} not found; using {other}/{size}"' - else: - lines.append(f'echo "WARNING: MOM6 {size} missing in both v1 and v2; skipping"') - continue - - lines.append(f'if ( -e data/MOM6/{size} ) /bin/rm -f data/MOM6/{size}') - if note: - lines.append(note) - lines.append(f'ln -s {src} data/MOM6/{size}') - return "\n".join(lines) - cube_template = """ ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/360x200 data/MOM5/360x200 ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/720x410 data/MOM5/720x410 ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/1440x1080 data/MOM5/1440x1080 -{MOM6_LINK_LINES} +if ( {TRIPOL_OCEAN} == True ) then + set mom6v = {mom6_bathy_version} + set mom6root = {MAKE_BCS_INPUT_DIR}/ocean/MOM6/$mom6v + set req = {imo}x{jmo} + + if ( ! -d $mom6root/$req ) then + echo "ERROR: MOM6/$mom6v/$req missing under {MAKE_BCS_INPUT_DIR}/ocean/MOM6" + echo " Selected via questionnaire '{lbcsv}' -> MOM6_BATHY_VERSION=$mom6v" + exit 10 + endif + + if ( ! -d data/MOM6 ) mkdir -p data/MOM6 + if ( -e data/MOM6/$req ) /bin/rm -f data/MOM6/$req + ln -s $mom6root/$req data/MOM6/$req +endif if( -e CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout ) /bin/rm -f CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout @@ -180,8 +152,30 @@ def make_bcs_cube(config): if not os.path.exists(log_dir): os.makedirs(log_dir) - MOM6_BATHY_VERSION, TOPO_VERSION = _resolve_versions(config['lbcsv']) - MOM6_LINK_LINES = _build_mom6_link_lines(config['inputdir'], MOM6_BATHY_VERSION) + TOPO_VERSION = topo_version_for_bcs(config['lbcsv']) + MOM6_BATHY_VERSION = mom6_bathy_version_for_bcs(config['lbcsv']) + + # ---------- INPUT CHECKS (abort before sbatch) ---------- + # 1) TOPO must exist for this grid + topo_dir = f"CF{NC}x6C{SGNAME}" # CF0090x6C or CF0540x6C-SG001 + topo_src = os.path.join(config['inputdir'], "atmosphere", "TOPO", TOPO_VERSION, topo_dir) + if not os.path.isdir(topo_src): + print(f"ABORT: Missing TOPO: {topo_src} " + f"(LBCSV={config['lbcsv']} TOPO_VERSION={TOPO_VERSION})") + return + + # 2) MOM6 bathymetry: strict, check ONLY the size used by this run + if config["TRIPOL_OCEAN"]: + req = f"{config['imo']}x{config['jmo']}" # 540x458 or 1440x1080 + mom6_src = os.path.join(config['inputdir'], "ocean", "MOM6", MOM6_BATHY_VERSION, req) + if not os.path.isdir(mom6_src): + print(f"ABORT: Missing MOM6 bathymetry: {mom6_src} " + f"(LBCSV={config['lbcsv']} MOM6={MOM6_BATHY_VERSION})") + return + + print(f"[make_bcs_cube] LBCSV={config['lbcsv']} TOPO={TOPO_VERSION} " + f"MOM6={MOM6_BATHY_VERSION} REQ={'{imo}x{jmo}'.format(**config)} GRID={GRIDNAME}") + # ------------------------------------------------------------------- script_template = get_script_head() + cube_template + get_script_mv(config['grid_type']) @@ -223,7 +217,6 @@ def make_bcs_cube(config): SGPARAM = SGPARAM, \ TOPO_VERSION = TOPO_VERSION, mom6_bathy_version = MOM6_BATHY_VERSION, - MOM6_LINK_LINES = MOM6_LINK_LINES, IS_STRETCHED = IS_STRETCHED, \ NCPUS = config['NCPUS']) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py index 78e5623db..ef6af1678 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py @@ -6,19 +6,50 @@ import glob import re +# --- BEGIN VERSION MATRIX --- + +# Independent version mapping per questionnaire 'lbcsv' +_VERSION_MATRIX = { + "NL3": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, + "NL4": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, + "NL5": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, + "ICA": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, + "GM4": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, + "F25": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, + "v06": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, + "v07": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, + "v08": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, + "v09": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, + "v10": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, + "v11": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, + "v12": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, + "v13": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, + "v14": {"TOPO_VERSION": "v2", "MOM6_BATHY_VERSION": "v2"}, +} + +_DEFAULTS = {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"} + +def _normalize_lbcsv(label: str) -> str: + v = (label or "").strip() + import re + m = re.match(r'[vV]?\d+|[A-Za-z0-9]+', v) # accepts v14 / 14 / NL3 / etc. + if not m: + return v + key = m.group(0) + # normalize numeric like '14' -> 'v14' + if key.isdigit(): + key = 'v' + key + return key + +def resolve_bcs_matrix(bcs_version: str): + key = _normalize_lbcsv(bcs_version) + return {**_DEFAULTS, **_VERSION_MATRIX.get(key, {})} + def topo_version_for_bcs(bcs_version: str) -> str: - """ - Decide which TOPO set to use based on BCS version chosen in the questionnaire. - - v14 and later → TOPO v2 - - v13 and earlier (and NL*/ICA/GM4/F25) → TOPO v1 - """ - v = (bcs_version or "").strip() - ## m = re.fullmatch(r"[vV](\d+)", v) - m = re.match(r"[vV]?(\d+)", v) # relaxed tolerance if we change names - if m: - return "v2" if int(m.group(1)) >= 14 else "v1" - # NL3, NL4, NL5, ICA, GM4, F25, etc. - return "v1" + return resolve_bcs_matrix(bcs_version)["TOPO_VERSION"] + +def mom6_bathy_version_for_bcs(bcs_version: str) -> str: + return resolve_bcs_matrix(bcs_version)["MOM6_BATHY_VERSION"] def get_script_head() : From adc768da148af0b659195f905e53097638423435 Mon Sep 17 00:00:00 2001 From: Biljana Orescanin <68251545+biljanaorescanin@users.noreply.github.com> Date: Thu, 18 Sep 2025 13:05:13 -0400 Subject: [PATCH 15/44] cleanup --- .../GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py | 1 - 1 file changed, 1 deletion(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py index ef6af1678..029ddc73d 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py @@ -31,7 +31,6 @@ def _normalize_lbcsv(label: str) -> str: v = (label or "").strip() - import re m = re.match(r'[vV]?\d+|[A-Za-z0-9]+', v) # accepts v14 / 14 / NL3 / etc. if not m: return v From 086cb4ec2f6e11f16be8caa062ad1317dea76c47 Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Thu, 8 Jan 2026 10:15:00 -0500 Subject: [PATCH 16/44] New ocean grids 720x576 and 2880x2240 for mom6/v2 are added --- .../GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py index c4d5fe316..4c48d723c 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py @@ -20,6 +20,8 @@ ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/72x36 data/MOM6/72x36 ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/540x458 data/MOM6/540x458 ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/1440x1080 data/MOM6/1440x1080 +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/720x576 data/MOM6/720x576 +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/2880x2240 data/MOM6/2880x2240 if( -e CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout ) /bin/rm -f CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout From c7f47fd9b9aec27b886b3f2c7016b5e0f8bccc4f Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Thu, 8 Jan 2026 10:15:22 -0500 Subject: [PATCH 17/44] New ocean grids 720x576 and 2880x2240 for mom6/v2 are added --- .../Utils/Raster/makebcs/make_bcs_questionary.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py index f8ef889cf..119969698 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py @@ -65,7 +65,7 @@ def get_configs_from_answers(answers): maskfile = '' - if orslv in['O1','T2','T3','T4','T1MOM6','T3MOM6','T4MOM6']: + if orslv in['O1','T2','T3','T4','T1MOM6','T3MOM6', 'T4MOM6', 'T5MOM6', 'T8MOM6']: maskfile = 'GEOS5_10arcsec_mask_freshwater-lakes.nc' if lbcsv in ['F25', 'GM4', 'ICA']: maskfile = 'global.cat_id.catch.DL' @@ -321,6 +321,8 @@ def ask_questions(default_grid="Cubed-Sphere"): "T1MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $72x36$ )", \ "T3MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $540x458$ )", \ "T4MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $1440x1080$)", \ + "T5MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $720x576$)", \ + "T8MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $2880x2240$)", \ "CS -- Cubed-Sphere Ocean (Cubed-Sphere Data-Ocean)"], "when": lambda x: "Stretched_CS" == x['grid_type'] or "Cubed-Sphere" == x['grid_type'], }, From f8a3597c8edc996e419cc99c82f75188296414d4 Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Thu, 8 Jan 2026 10:45:48 -0500 Subject: [PATCH 18/44] New ocean grids 720x576 and 2880x2240 for mom6/v2 are added --- .../Utils/Raster/makebcs/make_bcs_cube.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py index f7ae501c0..65ca03d91 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py @@ -13,6 +13,7 @@ ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/360x200 data/MOM5/360x200 ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/720x410 data/MOM5/720x410 ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM5/1440x1080 data/MOM5/1440x1080 +<<<<<<< HEAD if ( {TRIPOL_OCEAN} == True ) then set mom6v = {mom6_bathy_version} set mom6root = {MAKE_BCS_INPUT_DIR}/ocean/MOM6/$mom6v @@ -28,6 +29,13 @@ if ( -e data/MOM6/$req ) /bin/rm -f data/MOM6/$req ln -s $mom6root/$req data/MOM6/$req endif +======= +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/72x36 data/MOM6/72x36 +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/540x458 data/MOM6/540x458 +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/1440x1080 data/MOM6/1440x1080 +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/720x576 data/MOM6/720x576 +ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/2880x2240 data/MOM6/2880x2240 +>>>>>>> 086cb4ec (New ocean grids 720x576 and 2880x2240 for mom6/v2 are added) if( -e CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout ) /bin/rm -f CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout From 92a9f9181963259848b4d32d72f1f8feb1af9eb0 Mon Sep 17 00:00:00 2001 From: Sina Khani Date: Thu, 8 Jan 2026 10:15:22 -0500 Subject: [PATCH 19/44] New ocean grids 720x576 and 2880x2240 for mom6/v2 are added --- .../Utils/Raster/makebcs/make_bcs_questionary.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py index f8ef889cf..119969698 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py @@ -65,7 +65,7 @@ def get_configs_from_answers(answers): maskfile = '' - if orslv in['O1','T2','T3','T4','T1MOM6','T3MOM6','T4MOM6']: + if orslv in['O1','T2','T3','T4','T1MOM6','T3MOM6', 'T4MOM6', 'T5MOM6', 'T8MOM6']: maskfile = 'GEOS5_10arcsec_mask_freshwater-lakes.nc' if lbcsv in ['F25', 'GM4', 'ICA']: maskfile = 'global.cat_id.catch.DL' @@ -321,6 +321,8 @@ def ask_questions(default_grid="Cubed-Sphere"): "T1MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $72x36$ )", \ "T3MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $540x458$ )", \ "T4MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $1440x1080$)", \ + "T5MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $720x576$)", \ + "T8MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $2880x2240$)", \ "CS -- Cubed-Sphere Ocean (Cubed-Sphere Data-Ocean)"], "when": lambda x: "Stretched_CS" == x['grid_type'] or "Cubed-Sphere" == x['grid_type'], }, From 6bf328fa3efb30f3c5d3e99139841ade1ab7f540 Mon Sep 17 00:00:00 2001 From: bzhao Date: Wed, 9 Jul 2025 15:00:47 -0400 Subject: [PATCH 20/44] disable RUNOFF in DataAtm; let DISCHARGE and CALVING propagate to be filled by Extdata when running in DataAtm --- GEOSdataatm_GridComp/GEOS_DataAtmGridComp.F90 | 12 ++---------- GEOSogcm_GridComp/GEOS_OgcmGridComp.F90 | 12 +++++++++--- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/GEOSdataatm_GridComp/GEOS_DataAtmGridComp.F90 b/GEOSdataatm_GridComp/GEOS_DataAtmGridComp.F90 index 95964a7e4..fcaef2eac 100644 --- a/GEOSdataatm_GridComp/GEOS_DataAtmGridComp.F90 +++ b/GEOSdataatm_GridComp/GEOS_DataAtmGridComp.F90 @@ -154,13 +154,6 @@ subroutine SetServices ( GC, RC ) DIMS = MAPL_DimsHorzOnly, & VLOCATION = MAPL_VLocationNone, __RC__) - call MAPL_AddImportSpec(GC, & - SHORT_NAME = 'RUNOFF', & - LONG_NAME = 'overland_runoff_including_throughflow', & - UNITS = 'kg m-2 s-1', & - DIMS = MAPL_DimsHorzOnly, & - VLOCATION = MAPL_VLocationNone, __RC__) - call MAPL_AddImportSpec(GC, & SHORT_NAME = 'PCU', & LONG_NAME = 'convective_rainfall', & @@ -462,7 +455,6 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) real, pointer, dimension(:,:) :: QA ! => null() real, pointer, dimension(:,:) :: UA ! => null() real, pointer, dimension(:,:) :: VA ! => null() - real, pointer, dimension(:,:) :: RUNOFF ! => null() real, pointer, dimension(:,:) :: PCU ! => null() real, pointer, dimension(:,:) :: PLS ! => null() real, pointer, dimension(:,:) :: SNO ! => null() @@ -606,8 +598,8 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) ! River runoff ! call ReadForcingData(impName='DISCHARGE', frcName='RR', default=0., __RC__) call MAPL_GetPointer(SurfImport, DISCHARGE, 'DISCHARGE', __RC__) - call MAPL_GetPointer(import, RUNOFF, 'RUNOFF', __RC__) - DISCHARGE=RUNOFF +! runoff is provided directly by Ocean Gc on the tripolar grid + DISCHARGE=0.0 !ALT: we should read topo, but for now over ocean this is fine call SetVarToZero('PHIS', __RC__) diff --git a/GEOSogcm_GridComp/GEOS_OgcmGridComp.F90 b/GEOSogcm_GridComp/GEOS_OgcmGridComp.F90 index 38832aed0..f6ab954a4 100644 --- a/GEOSogcm_GridComp/GEOS_OgcmGridComp.F90 +++ b/GEOSogcm_GridComp/GEOS_OgcmGridComp.F90 @@ -848,7 +848,11 @@ subroutine SetServices ( GC, RC ) call MAPL_TerminateImport ( GC, ["DATA_KPAR "], [orad], RC=STATUS ) ! need to terminate others as well: cosz, discharge, frocean, pice, taux, tauy endif else - call MAPL_TerminateImport(GC, ['DATA_UW', 'DATA_VW'], [OCEAN, OCEAN], _RC) + if(DO_DATA_ATM4OCN) then + call MAPL_TerminateImport(GC, ['DATA_UW', 'DATA_VW', 'DISCHARGE', 'CALVING'], [OCEAN, OCEAN, OCEAN, OCEAN], _RC) + else + call MAPL_TerminateImport(GC, ['DATA_UW', 'DATA_VW'], [OCEAN, OCEAN], _RC) + endif endif ! Set the Profiling timers @@ -1824,8 +1828,10 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) VERIFY_(STATUS) if(DO_DATASEAONLY==0) then - call MAPL_LocStreamTransform( ExchGrid, DISCHARGEO, DISCHARGE, RC=STATUS) - VERIFY_(STATUS) + if(.not. DO_DATA_ATM4OCN) then + call MAPL_LocStreamTransform( ExchGrid, DISCHARGEO, DISCHARGE, RC=STATUS) + VERIFY_(STATUS) + endif PENUVRM= PENUVRO PENUVFM= PENUVFO From d75ffa3c6797505fe9ff98859754a2cb8487d0f0 Mon Sep 17 00:00:00 2001 From: bzhao Date: Thu, 10 Jul 2025 15:43:09 -0400 Subject: [PATCH 21/44] add remapped friver and licalvf collections and provide DISCHARGE and CALVING on tripolar grid --- .../JRA55-DO_DataAtm_Forcings_ExtData.yaml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/GEOSdataatm_GridComp/JRA55-DO_DataAtm_Forcings_ExtData.yaml b/GEOSdataatm_GridComp/JRA55-DO_DataAtm_Forcings_ExtData.yaml index 5da6f8658..4ff171080 100755 --- a/GEOSdataatm_GridComp/JRA55-DO_DataAtm_Forcings_ExtData.yaml +++ b/GEOSdataatm_GridComp/JRA55-DO_DataAtm_Forcings_ExtData.yaml @@ -41,6 +41,24 @@ Collections: friver_1_5_0_1: template: ExtData/JRA55-DO/v1-5-0-1/friver/friver_input4MIPs_atmosphericState_OMIP_MRI-JRA55-do-1-5-0-1_gr_%y40101-%y41231.nc valid_range: "2020-01-01T00:00:00/2024-02-02T00:00:00" + friver_remap_1_5_0: + template: ExtData/JRA55-DO/v1-5-0/friver_remap/%OCN_RES%/friver_input4MIPs_atmosphericState_OMIP_MRI-JRA55-do-1-5-0_gr_%y40101-%y41231.nc + valid_range: "1958-01-01T00:00:00/2020-01-01T00:00:00" + friver_remap_1_5_0_1: + template: ExtData/JRA55-DO/v1-5-0-1/friver_remap/%OCN_RES%/friver_input4MIPs_atmosphericState_OMIP_MRI-JRA55-do-1-5-0-1_gr_%y40101-%y41231.nc + valid_range: "2020-01-01T00:00:00/2024-02-02T00:00:00" + licalvf_1_5_0: + template: ExtData/JRA55-DO/v1-5-0/licalvf/licalvf_input4MIPs_atmosphericState_OMIP_MRI-JRA55-do-1-5-0_gr_%y40101-%y41231.nc + valid_range: "1958-01-01T00:00:00/2020-01-01T00:00:00" + licalvf_1_5_0_1: + template: ExtData/JRA55-DO/v1-5-0-1/licalvf/licalvf_input4MIPs_atmosphericState_OMIP_MRI-JRA55-do-1-5-0-1_gr_%y40101-%y41231.nc + valid_range: "2020-01-01T00:00:00/2024-02-02T00:00:00" + licalvf_remap_1_5_0: + template: ExtData/JRA55-DO/v1-5-0/licalvf_remap/%OCN_RES%/licalvf_input4MIPs_atmosphericState_OMIP_MRI-JRA55-do-1-5-0_gr_%y40101-%y41231.nc + valid_range: "1958-01-01T00:00:00/2020-01-01T00:00:00" + licalvf_remap_1_5_0_1: + template: ExtData/JRA55-DO/v1-5-0-1/licalvf_remap/%OCN_RES%/licalvf_input4MIPs_atmosphericState_OMIP_MRI-JRA55-do-1-5-0_gr_%y40101-%y41231.nc + valid_range: "2020-01-01T00:00:00/2024-02-02T00:00:00" prra_1_5_0: template: ExtData/JRA55-DO/v1-5-0/prra/prra_input4MIPs_atmosphericState_OMIP_MRI-JRA55-do-1-5-0_gr_%y401010130-%y412312230.nc valid_range: "1958-01-01T00:00:00/2020-01-01T00:00:00" @@ -91,6 +109,12 @@ Exports: RUNOFF: - {starting: "1958-01-01T00:00:00", collection: friver_1_5_0, regrid: CONSERVE, sample: river_conserve_sample, variable: friver} - {starting: "2020-01-01T00:00:00", collection: friver_1_5_0_1, regrid: CONSERVE, sample: river_conserve_sample, variable: friver} + DISCHARGE: + - {starting: "1958-01-01T00:00:00", collection: friver_remap_1_5_0, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: friver} + - {starting: "2020-01-01T00:00:00", collection: friver_remap_1_5_0_1, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: friver} + CALVING: + - {starting: "1958-01-01T00:00:00", collection: licalvf_remap_1_5_0, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: licalvf} + - {starting: "2020-01-01T00:00:00", collection: licalvf_remap_1_5_0_1, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: licalvf} PCU: - {starting: "1958-01-01T00:00:00", collection: prra_1_5_0, regrid: CONSERVE, sample: flux_conserve_sample, variable: prra} - {starting: "2020-01-01T00:00:00", collection: prra_1_5_0_1, regrid: CONSERVE, sample: flux_conserve_sample, variable: prra} From d615259192dafc171c09e7a8c342e91cf7009545 Mon Sep 17 00:00:00 2001 From: bzhao Date: Thu, 10 Jul 2025 22:26:16 -0400 Subject: [PATCH 22/44] fixed a typo --- GEOSdataatm_GridComp/JRA55-DO_DataAtm_Forcings_ExtData.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GEOSdataatm_GridComp/JRA55-DO_DataAtm_Forcings_ExtData.yaml b/GEOSdataatm_GridComp/JRA55-DO_DataAtm_Forcings_ExtData.yaml index 4ff171080..df16846e6 100755 --- a/GEOSdataatm_GridComp/JRA55-DO_DataAtm_Forcings_ExtData.yaml +++ b/GEOSdataatm_GridComp/JRA55-DO_DataAtm_Forcings_ExtData.yaml @@ -57,7 +57,7 @@ Collections: template: ExtData/JRA55-DO/v1-5-0/licalvf_remap/%OCN_RES%/licalvf_input4MIPs_atmosphericState_OMIP_MRI-JRA55-do-1-5-0_gr_%y40101-%y41231.nc valid_range: "1958-01-01T00:00:00/2020-01-01T00:00:00" licalvf_remap_1_5_0_1: - template: ExtData/JRA55-DO/v1-5-0-1/licalvf_remap/%OCN_RES%/licalvf_input4MIPs_atmosphericState_OMIP_MRI-JRA55-do-1-5-0_gr_%y40101-%y41231.nc + template: ExtData/JRA55-DO/v1-5-0-1/licalvf_remap/%OCN_RES%/licalvf_input4MIPs_atmosphericState_OMIP_MRI-JRA55-do-1-5-0-1_gr_%y40101-%y41231.nc valid_range: "2020-01-01T00:00:00/2024-02-02T00:00:00" prra_1_5_0: template: ExtData/JRA55-DO/v1-5-0/prra/prra_input4MIPs_atmosphericState_OMIP_MRI-JRA55-do-1-5-0_gr_%y401010130-%y412312230.nc @@ -110,10 +110,10 @@ Exports: - {starting: "1958-01-01T00:00:00", collection: friver_1_5_0, regrid: CONSERVE, sample: river_conserve_sample, variable: friver} - {starting: "2020-01-01T00:00:00", collection: friver_1_5_0_1, regrid: CONSERVE, sample: river_conserve_sample, variable: friver} DISCHARGE: - - {starting: "1958-01-01T00:00:00", collection: friver_remap_1_5_0, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: friver} + - {starting: "1958-01-01T00:00:00", collection: friver_remap_1_5_0, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: friver} - {starting: "2020-01-01T00:00:00", collection: friver_remap_1_5_0_1, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: friver} CALVING: - - {starting: "1958-01-01T00:00:00", collection: licalvf_remap_1_5_0, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: licalvf} + - {starting: "1958-01-01T00:00:00", collection: licalvf_remap_1_5_0, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: licalvf} - {starting: "2020-01-01T00:00:00", collection: licalvf_remap_1_5_0_1, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: licalvf} PCU: - {starting: "1958-01-01T00:00:00", collection: prra_1_5_0, regrid: CONSERVE, sample: flux_conserve_sample, variable: prra} From e5a729ca14cfb92311ab5ef597551ee50b97f64d Mon Sep 17 00:00:00 2001 From: bzhao Date: Mon, 28 Jul 2025 11:13:46 -0400 Subject: [PATCH 23/44] claving causes huge frazil generation at isolated locations near icesheet; disable for now --- GEOSdataatm_GridComp/JRA55-DO_DataAtm_Forcings_ExtData.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GEOSdataatm_GridComp/JRA55-DO_DataAtm_Forcings_ExtData.yaml b/GEOSdataatm_GridComp/JRA55-DO_DataAtm_Forcings_ExtData.yaml index df16846e6..091debba8 100755 --- a/GEOSdataatm_GridComp/JRA55-DO_DataAtm_Forcings_ExtData.yaml +++ b/GEOSdataatm_GridComp/JRA55-DO_DataAtm_Forcings_ExtData.yaml @@ -112,9 +112,9 @@ Exports: DISCHARGE: - {starting: "1958-01-01T00:00:00", collection: friver_remap_1_5_0, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: friver} - {starting: "2020-01-01T00:00:00", collection: friver_remap_1_5_0_1, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: friver} - CALVING: - - {starting: "1958-01-01T00:00:00", collection: licalvf_remap_1_5_0, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: licalvf} - - {starting: "2020-01-01T00:00:00", collection: licalvf_remap_1_5_0_1, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: licalvf} + CALVING: {collection: /dev/null} +# - {starting: "1958-01-01T00:00:00", collection: licalvf_remap_1_5_0, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: licalvf} +# - {starting: "2020-01-01T00:00:00", collection: licalvf_remap_1_5_0_1, regrid: NEAREST_STOD, sample: river_conserve_sample, variable: licalvf} PCU: - {starting: "1958-01-01T00:00:00", collection: prra_1_5_0, regrid: CONSERVE, sample: flux_conserve_sample, variable: prra} - {starting: "2020-01-01T00:00:00", collection: prra_1_5_0_1, regrid: CONSERVE, sample: flux_conserve_sample, variable: prra} From 656728ad0e8b42f1f425674e27e80ccd6e0be8c7 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Fri, 21 Nov 2025 12:07:12 -0500 Subject: [PATCH 24/44] Fix for gfortran --- GEOSogcm_GridComp/GEOS_OgcmGridComp.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GEOSogcm_GridComp/GEOS_OgcmGridComp.F90 b/GEOSogcm_GridComp/GEOS_OgcmGridComp.F90 index f6ab954a4..96206daf4 100644 --- a/GEOSogcm_GridComp/GEOS_OgcmGridComp.F90 +++ b/GEOSogcm_GridComp/GEOS_OgcmGridComp.F90 @@ -849,7 +849,7 @@ subroutine SetServices ( GC, RC ) endif else if(DO_DATA_ATM4OCN) then - call MAPL_TerminateImport(GC, ['DATA_UW', 'DATA_VW', 'DISCHARGE', 'CALVING'], [OCEAN, OCEAN, OCEAN, OCEAN], _RC) + call MAPL_TerminateImport(GC, ['DATA_UW ', 'DATA_VW ', 'DISCHARGE', 'CALVING '], [OCEAN, OCEAN, OCEAN, OCEAN], _RC) else call MAPL_TerminateImport(GC, ['DATA_UW', 'DATA_VW'], [OCEAN, OCEAN], _RC) endif From cb905bcc364560bd796cd41aa3439e823deaaf66 Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Fri, 3 Oct 2025 12:50:10 -0400 Subject: [PATCH 25/44] Topo docs & cleanup: add README_topo.md; move generate_topo.sh to preproc/topography/obsolete; update headers in Fortran/Python drivers --- .../Raster/makebcs/utils_topo/README_topo.md | 228 ++++++++++++++++++ .../utils_topo/convert_bin_to_netcdf.F90 | 37 +++ .../utils_topo/convert_to_gmao_output.F90 | 35 +++ .../utils_topo/generate_scrip_cube.F90 | 31 +++ .../Raster/makebcs/utils_topo/make_topo.py | 29 +++ .../makebcs/utils_topo/scrip_to_cube_topo.py | 28 +++ .../utils_topo/scrip_to_restart_topo.py | 17 +- .../topography/obsolete}/generate_topo.sh | 0 8 files changed, 404 insertions(+), 1 deletion(-) create mode 100755 GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md rename GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/{makebcs/utils_topo => preproc/topography/obsolete}/generate_topo.sh (100%) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md new file mode 100755 index 000000000..b0a0fd334 --- /dev/null +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md @@ -0,0 +1,228 @@ +# Topography Pipeline — Quickstart & Reference + +This repository builds **GWD-ready topography** on cubed‑sphere grids (uniform and Schmidt‑stretched). The entry point for most users is **`make_topo.py`**, which interactively generates a Slurm job script and runs the full pipeline end‑to‑end via compiled utilities in `bin/`. + +--- + +## Quickstart + +```bash +# 1) Ensure binaries and modules are available +ls bin/{bin_to_cube.x,generate_scrip_cube_topo.x,cube_to_target.x,convert_to_gmao_output_topo.x} # should exist + +source g5_modules + +# 2) Run the driver +./make_topo.py + +# 3) Answer prompts (bin dir, output dir, input GMTED path, and resolutions) +# The script writes a Slurm job like topo_c360.j in your chosen out_dir. + +# 4) Submit +cd +sbatch topo_c360.j +``` + +Outputs (per‑resolution) in `out_dir/output_/` as NetCDF files and binary alongside a GMAO restart. + +--- + +## What the pipeline does + +1. **Prepare a high‑res intermediate cube (`c3000`)** + + * Converts the global GMTED lat‑lon input + * Produces: `c3000.gmted_fixedanarticasuperior.nc` + +2. **Generate a SCRIP descriptor** (`generate_scrip_cube_topo.x`) + + * Uniform or Schmidt‑stretched (SG001/SG002) per `GenScrip.yaml` built by the job + * Writes `PEx-CF.nc4` + `c_coords.nc4` + +3. **Select `rrfac_max` (stretched grids only)** using `cdo` + `awk` + + * For **uniform grids**, `rrfac ≡ 1` everywhere, so `rrfac_max=1` and the flag is effectively a no‑op. + +4. **Remap to target grid** (`cube_to_target.x`) + + * Uses the intermediate cube + `--smoothing_scale` + optional `--rrfac_max` and Laplacian iterations + * Produces PE* NetCDF in `output_/` + +5. **Convert to restart + GMAO outputs** + + * `scrip_to_restart_topo.py` (adds `-g sg001/sg002` as needed) + * `convert_to_gmao_output_topo.x -i PE* --im ` + +--- + +## Inputs & dependencies + +* **Topography source (lat‑lon):** `gmted_fixed_anartica_superior_caspian.nc4` +* **Binaries (in `bin/`):** + + * `bin_to_cube.x` + * `generate_scrip_cube_topo.x` + * `cube_to_target.x` + * `convert_to_gmao_output_topo.x` + * `scrip_to_restart_topo.py` +* **Environment** + + * `bin/g5_modules` (loads platform compilers/MPI) + * Modules: `nco`, `cdo` , `python` + * `mpirun` available in `$PATH` +* **Scheduler:** Slurm (`sbatch`) + +> The driver writes a **csh** job file + +--- + +## Running `make_topo.py` + +`make_topo.py` prompts for: + +* **bin_dir**: Absolute path to the `bin/` directory containing the compiled tools. +* **out_dir**: Where to put the generated Slurm script and outputs. Default: `/discover/nobackup//BCS_TOPO/`. +* **path_latlon**: Directory containing `gmted_fixed_anartica_superior_caspian.nc4`. +* **resolutions**: Pick from uniform (`C12 … C5760`) and stretched families (`SG001`, `SG002`). + + * If you choose a stretched family, you will be asked for its concrete IM sizes (e.g., `C270`, `C540`). + +The script writes **`topo_.j`** in `out_dir` and sets sane defaults for time, nodes, and job name. + +--- + +## Smoothing & GWD knobs + +* **`smoothing_scale`** (per grid) lives in the Python map inside `make_topo.py`. + + * *Bigger* `smoothing_scale` ⇒ *stronger* smoothing ⇒ *smaller* GWD (less roughness). +* **`ALPHA`** (stretched only) scales the Laplacian smooth step. Injected into `GenScrip.yaml` when applicable. +* **`RRFAC`** (regional refinement factor) **exists only on stretched grids**. Uniform grids have `rrfac=1` everywhere; you can ignore any `rrfac_max` logic for uniform runs. +* **Extra Laplacian cycles**: For `IM=5760`, the job adds `-l 13` to `cube_to_target.x`. + +### Defaults table + +| Grid | smoothing_scale | alpha (stretched only) | +| ------------- | --------------: | ---------------------: | +| C12 | 512.0 | – | +| C24 | 305.0 | – | +| C48 | 166.0 | – | +| C90 | 96.2 | – | +| C180 | 51.21 | – | +| C360 | 28.95 | – | +| C720 | 19.5 | – | +| C1120 | 8.26 | – | +| C1440 | 12.0 | – | +| C2880 | 3.285 | – | +| C5760 | 3.0 | – | +| C270 (SG001) | 100.0 | 2.9 | +| C540 (SG001) | 53.3 | 2.73 | +| C1080 (SG001) | 17.0 | 7.0 | +| C1536 (SG002) | 26.8 | 12.1 | +| C2160 (SG001) | 2.98 | 14.25 | + +> To add/retune a grid, edit the `smoothmap`/`alpha` dicts in `make_topo.py` and re‑run. + +--- + +## Runtime guidance (from header comments) + +> Wall estimates assume GMAO/Discover‑like nodes; adjust for your system. + +* `c180 … c2880, c1536, c1120, c2160`: **1 node**, ~**1h** +* `c5760, c540, c270, c48`: **2 nodes**, ~**4h** +* `c90`: **1 node**, ~**3h** +* `c24`: **2 nodes**, ~**8h** +* `c12`: **2 nodes**, ~**19h**, use `qos=long` + +> The driver currently sets 1 node in the Slurm header by default; edit the generated job for heavy cases. + +--- + +## Outputs & where to find them + +For each `IM`: + +``` +/ + topo_.j # the job script you submit + output_/ + PEx* .nc # remapped topography (latest picked by timestamp) + gwd_internal_rst.* # restart written by scrip_to_restart_topo.py + *_gmao_*.nc # GMAO‑formatted outputs from convert_to_gmao_output_topo.x +``` + +The job also leaves the descriptor in `/PEx-CF.nc4`. + +--- + +## Stretching presets + +* **SG001** ⇒ `TARGET_LON=-98.35`, `TARGET_LAT=39.5`, `STRETCH_FACTOR=2.5` and `IM ∈ {270,540,1080,2160}` +* **SG002** ⇒ `TARGET_LON=-98.35`, `TARGET_LAT=39.5`, `STRETCH_FACTOR=3.0` and `IM = 1536` + +These are injected into `GenScrip.yaml` only for matching resolutions. +Users may add new stretching options with different target centers and stretch factors. Note, however, that the stretch factor must be less than 3.0 (3.0 is the maximum supported). + +--- + +## How to add a new resolution + +1. Edit `smoothmap` (and `alpha` if stretched) in `make_topo.py`. +2. If it’s a *stretched* grid, extend the SG001/SG002 lists in the job template section. +3. Re‑run `make_topo.py` and select the new resolution. + +--- + +## Design notes + +* The pipeline **builds `c3000` once** and **reuses** it across resolutions for consistency and speed. +* For **stretched** grids, `rrfac_max` is computed via `cdo infon` + `awk` on the SCRIP file to inform `cube_to_target.x`. +* For **uniform** grids, `rrfac=1`, so `rrfac_max` is 1 and can be omitted. +* For `IM=5760`, the driver adds `-l 13` Laplacian cycles for additional smoothing. + +--- + +## Example for one session + +``` +$ ./make_topo.py +Enter the root path of the bin: /home/me/topo/bin +Enter the path of the output directory: /discover/nobackup/me/BCS_TOPO +Enter the path contains gmted_fixed_anartica_superior_caspian.nc4 (confirm selection): + /discover/nobackup/projects/gmao/bcs_shared/preprocessing_bcs_inputs/land/topo/v1/ +Select resolutions: [x] C360 [x] SG001 +Select resolution of SG001 grid: [x] C540 [ ] C1080 [ ] C2160 [ ] C270 +# => writes topo_c360_c540.j under out_dir +$ cd /discover/nobackup/me/BCS_TOPO +$ sbatch topo_c360_c540.j +# or submit one job at the time to have clean run log for each job: topo_c360.j. Save it is res dependent dir to have whole run isolated: /discover/nobackup/me/BCS_TOPO/c360/ +``` + +--- + +## FAQ + +**Q: Can I reuse an existing `c3000`?** +A: Yes. The job checks and reuses `c3000.gmted_fixedanarticasuperior.nc` if present. + +**Q: Where do I change the stretch center/factor?** +A: Inside the job template section (look for `TARGET_LON/LAT` and `STRETCH_FACTOR`). + +**Q: Do uniform grids use RRFAC?** +A: No. Uniform grids have `rrfac=1` everywhere. The `rrfac_max` step is only meaningful for stretched grids. + +**Q: Can I tune GWD magnitude or general smoothing?** +A: Yes. smoothing_scale (all grids) and alpha (stretched only) control smoothing strength and GWD amplitude. Be cautious: aggressive changes can destabilize the Laplacian smoother. In such cases you may need to recode the smoother or carefully retune these knobs. + +**Q: Why does this code differ from the NCAR_Topo repository?** +A: There are several reasons: +This repository started from an outdated fork of NCAR_Topo. +We introduced major improvements in job submission and processing, especially through dynamic segments. +We cannot push changes back upstream (no test platform there), so their repo may follow different design choices. + +**Q: Can I widen or narrow the stretched‑grid refinement “dome”?** +A: Yes. The dome’s footprint is set by the half‑power radius (half_power_radius_deg) inside the stretched‑grid rrfac logic. By default it’s ~40°/sqrt(max(1, stretch_factor)), so for SF≈2.5 the half‑power radius is ~25° (covers most of CONUS). Increase the constant (e.g., 45–50) to broaden the dome; decrease to tighten it. This only affects stretched grids. + +*Last updated: 2025‑10‑03* + diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_bin_to_netcdf.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_bin_to_netcdf.F90 index 86244ad16..ba1d3d055 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_bin_to_netcdf.F90 +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_bin_to_netcdf.F90 @@ -1,4 +1,41 @@ program create_example +!------------------------------------------------------------------------------ +! Program: create_example +! +! Purpose: +! Convert a raw, unformatted 2D topography field (binary) into: +! (a) GEOS-style NetCDF with Xdim/Ydim and a 2D variable "z" (--output) +! (b) NCAR/SE-style NetCDF with 1D "ncol" and variable "PHIS" (--ncar) +! +! Inputs: +! -i, --input : raw unformatted binary (REAL*4/REAL*8) of size (IM, JM) +! --im : IM (x) size of the field +! --jm : JM (y) size; if omitted, assumes a cubed-sphere layout with JM=IM*6 +! +! Outputs (optional; supply flags to enable): +! -o, --output : write GEOS-style NetCDF to this path +! --ncar : write NCAR/SE-style NetCDF to this path +! +! Notes: +! * If --jm is not provided, JM defaults to IM*6 (cubed-sphere “isCube” mode). +! * GEOS output: +! - Dimensions: Xdim=IM, Ydim=JM +! - Variable: z(Xdim,Ydim) [units: m], with coordinate vars Xdim/Ydim (1..IM, 1..JM) +! * NCAR output: +! - Dimension: ncol = IM*JM (row-major flattening) +! - Variable: PHIS(ncol) [units: m] +! * Basic error handling via subroutine `check` (aborts with NetCDF error message). +! +! Examples: +! # GEOS-style 2D NetCDF, assuming cubed-sphere (JM = 6*IM) +! create_example -i topo.bin --im 540 -o geos_topo.nc +! +! # NCAR-style 1D ncol NetCDF for a general (IM,JM) +! create_example -i topo.bin --im 720 --jm 361 --ncar ncar_topo.nc +! +!------------------------------------------------------------------------------ + + use netcdf use, intrinsic :: iso_fortran_env, only: REAL64 implicit none diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_to_gmao_output.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_to_gmao_output.F90 index 9df4a7292..e1bf251d9 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_to_gmao_output.F90 +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_to_gmao_output.F90 @@ -1,4 +1,39 @@ program create_example +!------------------------------------------------------------------------------ +! Program: convert_to_gmao_output (entry point: program create_example) +! +! Purpose: +! Convert NCAR-format PE topography outputs (with PHIS, SGH, SGH30) into +! GMAO-standard NetCDF and binary files, split into three deliverables: +! +! * gmted_DYN_ave_IMxJM.{nc4,data} → mean elevation (DYN), in meters +! * gmted_GWD_var_IMxJM.{nc4,data} → variance for Gravity Wave Drag (GWD), m^2 +! * gmted_TRB_var_IMxJM.{nc4,data} → variance for Turbulent Orography (TRB), m^2 +! +! Inputs: +! -i, --input : NCAR-style NetCDF containing +! * PHIS (m^2 s^-2) → converted to meters by dividing g +! * SGH (std. dev. for GWD, m) +! * SGH30 (std. dev. for TRB, m) +! --im : IM (x) size of the grid +! --jm : JM (y) size of the grid; if omitted, JM = IM*6 (cubed-sphere) +! +! Outputs: +! * NetCDF4 + raw unformatted binary pairs (.nc4 + .data) for each of DYN/GWD/TRB. +! * Dimensions: lon=IM, lat=JM. +! * Units: +! - DYN: meters (mean elevation) +! - GWD: m^2 (variance of subgrid orography for GWD) +! - TRB: m^2 (variance of subgrid orography for TRB) +! +! Notes: +! * Converts PHIS → elevation by dividing by g=9.80616. +! * Squares SGH/SGH30 (std. dev. in m) to produce variance in m^2. +! * Guards against missing/sentinel values (≈1e36). +! * Optionally smooths the poles in lat-lon mode (--jm given). +! +!------------------------------------------------------------------------------ + use netcdf implicit none diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/generate_scrip_cube.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/generate_scrip_cube.F90 index 881bc0a9e..a3eea5233 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/generate_scrip_cube.F90 +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/generate_scrip_cube.F90 @@ -2,6 +2,37 @@ #define _VERIFY(A) if(A/=0) call local_abort(A,__LINE__) program ESMF_GenerateCSGridDescription +!------------------------------------------------------------------------------ +! Program: ESMF_GenerateCSGridDescription (binary: generate_scrip_cube_topo.x) +! +! Purpose: +! Build a SCRIP descriptor and GEOS coordinate file for a cubed-sphere grid. +! Supports both uniform and Schmidt-stretched grids (target_lon/lat + factor). +! Writes per-cell centers/corners (deg), spherical area (sr), imask, and: +! - grid_fallback_mask : 1 if a tiny safe polygon was used for geometry +! - rrfac (stretched only) and rrfac_max (global attribute) +! +! Key features: +! • Robust corner ordering & periodicity handling (0/360 wraps). +! • Degeneracy repair & tiny-polygon fallback for bad cells. +! • Global min/max edge-length diagnostics and Gaussian rrfac for stretched. +! • MPI layout requires 6 PETs (one per cube face). +! +! Inputs: +! GenScrip.yaml with keys: +! CUBE_DIM, output_scrip, output_geos, +! [optional] DO_SCHMIDT, TARGET_LON, TARGET_LAT, STRETCH_FACTOR +! +! Outputs: +! - : SCRIP NetCDF (unstructured 1D layout) +! - : GEOS-style per-face centers/corners (deg) +! +! Notes: +! • Uniform grids do NOT carry rrfac (it is implicitly 1 everywhere). +! • For stretched grids, rrfac is radial (Gaussian) about the chosen midpoint. +! • Fallback cells are flagged; their areas are kept small but positive. +! +!------------------------------------------------------------------------------- ! ESMF Framework module use ESMF diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/make_topo.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/make_topo.py index ef9f29dd5..446216289 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/make_topo.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/make_topo.py @@ -8,6 +8,35 @@ # c90 1 node : 3h # c24 2 nodes : 8h # c12 2 nodes : 19h - has to be run with qos=long +#!/usr/bin/env python3 +""" +make_topo.py + +Purpose +------- +Interactive driver for the topography build pipeline. Prompts the user +for paths and resolutions, then writes a Slurm job script +(topo_.j) that runs the full sequence: + + 1. Build/reuse c3000 intermediate from GMTED lat-lon. + 2. Generate a SCRIP descriptor (uniform or Schmidt-stretched). + 3. Compute rrfac_max (stretched grids only). + 4. Run cube_to_target.x with smoothing/alpha. + 5. Convert outputs to GMAO restart and deliverables. + +Key knobs +--------- +- smoothing_scale : controls roughness → GWD amplitude (all grids). +- alpha : Laplacian scaling (stretched only). +- stretch center/factor : hard-coded for SG001/SG002, can be modified. +- runtime : varies by resolution; edit nodes/time in job if needed. + +Usage +----- + ./make_topo.py # interactively answer prompts + sbatch topo_.j # submit generated job script +""" + # import os import subprocess diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_cube_topo.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_cube_topo.py index 9608a1456..9332969af 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_cube_topo.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_cube_topo.py @@ -1,4 +1,32 @@ #!/usr/bin/env python3 +""" +scrip_to_cube_topo.py + +Purpose +------- +Convert old-style cubed-sphere data stored on a flat 'ncol' dimension +(ncol = 6 * IM * IM) into a GEOS-style cubed-sphere file with explicit +faces and (Xdim,Ydim), using an example file to copy the grid geometry. + +Inputs +------ +-i, --input : source NetCDF with 'ncol' (and optional 'nrdg') +-e, --example : GEOS-style example NetCDF providing 'lons', 'lats', + 'corner_lons', 'corner_lats', and Xdim/Ydim sizes +-o, --output : destination NetCDF4 +-v, --vars ... : optional list of variable names to convert (defaults to all) + +What it does +-------- +• Infers IM from the example file's Xdim; sets dims: + nf = 6, Xdim = IM, Ydim = IM, XCdim = IM+1, YCdim = IM+1 +• Reshapes variables: + (ncol) -> (nf, Ydim, Xdim) + (nrdg, ncol) -> (nrdg, nf, Ydim, Xdim) +• Copies variable attributes (excluding _FillValue). +• Writes grid-mapping metadata and coordinates ('lons','lats','corner_*') + by copying them from the example file. +""" #------------- # Load modules diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_restart_topo.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_restart_topo.py index 351a62039..69ed7d75b 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_restart_topo.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_restart_topo.py @@ -1,5 +1,20 @@ #!/usr/bin/env python3 - +""" +scrip_to_restart_topo.py + +Purpose: + Convert old-style cubed-sphere NetCDF files with a flat 'ncol' dimension + into new-style cube files with explicit (lat, lon) dimensions. + Optionally annotate stretched grids (sg001, sg002) with STRETCH_FACTOR + and target center information. + +Key points: + - Input: NetCDF with dimension 'ncol' (and possibly 'nrdg') + - Output: NetCDF with dimensions ('lat','lon'[,'unknown_dim1']) + - Reshapes variables from (ncol) → (lat, lon) or (nrdg,ncol) → (nrdg,lat,lon) + - Adds lon/lat index coordinate variables (1..IM, 1..6*IM) + - Sets global attrs for sg001/sg002 grids +""" #------------- # Load modules #------------- diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/generate_topo.sh b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/obsolete/generate_topo.sh similarity index 100% rename from GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/generate_topo.sh rename to GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/obsolete/generate_topo.sh From 7e6fae630299018e672dc885bbeb47eeb5c3fce7 Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Fri, 3 Oct 2025 13:00:33 -0400 Subject: [PATCH 26/44] remove example to make it simetric to other file --- .../Raster/makebcs/utils_topo/convert_bin_to_netcdf.F90 | 7 ------- 1 file changed, 7 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_bin_to_netcdf.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_bin_to_netcdf.F90 index ba1d3d055..197af5568 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_bin_to_netcdf.F90 +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_bin_to_netcdf.F90 @@ -26,13 +26,6 @@ program create_example ! - Variable: PHIS(ncol) [units: m] ! * Basic error handling via subroutine `check` (aborts with NetCDF error message). ! -! Examples: -! # GEOS-style 2D NetCDF, assuming cubed-sphere (JM = 6*IM) -! create_example -i topo.bin --im 540 -o geos_topo.nc -! -! # NCAR-style 1D ncol NetCDF for a general (IM,JM) -! create_example -i topo.bin --im 720 --jm 361 --ncar ncar_topo.nc -! !------------------------------------------------------------------------------ From 4fafcfbff704a8adf6e8749b440630525bfecbb8 Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Fri, 3 Oct 2025 13:04:01 -0400 Subject: [PATCH 27/44] fix example --- .../Utils/Raster/makebcs/utils_topo/README_topo.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md index b0a0fd334..2eb3018a5 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md @@ -16,11 +16,11 @@ source g5_modules ./make_topo.py # 3) Answer prompts (bin dir, output dir, input GMTED path, and resolutions) -# The script writes a Slurm job like topo_c360.j in your chosen out_dir. +# The script writes a Slurm job like topo_{res}.j in your chosen out_dir. # 4) Submit cd -sbatch topo_c360.j +sbatch topo_c{res}.j ``` Outputs (per‑resolution) in `out_dir/output_/` as NetCDF files and binary alongside a GMAO restart. From bbbd66e9ad8576d52a3312e0095e1afbea1cd8dd Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Fri, 3 Oct 2025 13:13:04 -0400 Subject: [PATCH 28/44] moved to obsolete --- .../Utils/Raster/makebcs/utils_topo/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/CMakeLists.txt b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/CMakeLists.txt index d7fe66616..828e2ed7d 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/CMakeLists.txt +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/CMakeLists.txt @@ -27,5 +27,4 @@ endif () install(PROGRAMS scrip_to_cube_topo.py DESTINATION bin) install(PROGRAMS scrip_to_restart_topo.py DESTINATION bin) -install(PROGRAMS generate_topo.sh DESTINATION bin) install(PROGRAMS make_topo.py DESTINATION bin) From b8328144cd1017d47bd90c7a908f9c30927f4218 Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Fri, 3 Oct 2025 13:16:27 -0400 Subject: [PATCH 29/44] add more text to readme --- .../Raster/makebcs/utils_topo/README_topo.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md index 2eb3018a5..b6521c749 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md @@ -224,5 +224,18 @@ We cannot push changes back upstream (no test platform there), so their repo may **Q: Can I widen or narrow the stretched‑grid refinement “dome”?** A: Yes. The dome’s footprint is set by the half‑power radius (half_power_radius_deg) inside the stretched‑grid rrfac logic. By default it’s ~40°/sqrt(max(1, stretch_factor)), so for SF≈2.5 the half‑power radius is ~25° (covers most of CONUS). Increase the constant (e.g., 45–50) to broaden the dome; decrease to tighten it. This only affects stretched grids. -*Last updated: 2025‑10‑03* +## List of Files in utils_topo +Below are the main files in this directory, with one-line summaries. +Each file also has its own inline header with more detail. + +- **CMakeLists.txt** — builds the utilities. +- **convert_bin_to_netcdf.F90** — small helper to convert raw binary topography into NetCDF (intermediate or testing). +- **convert_to_gmao_output.F90** — final step: produces GMAO deliverables (`gmted_DYN_ave_*.nc4`, `gmted_GWD_var_*.nc4`, `gmted_TRB_var_*.nc4`). +- **geompack.F90** — bundled geometry library (Burkardt routines: convex hull, triangle quality, etc.), needed for SCRIP generation. +- **generate_scrip_cube.F90** — builds SCRIP descriptors (uniform or Schmidt-stretched). +- **make_topo.py** — interactive driver, generates the Slurm job script to run the full pipeline. +- **scrip_to_cube_topo.py** — converts flat `ncol` → cube layout, using example file geometry. +- **scrip_to_restart_topo.py** — converts PE outputs into GWD restart format. + +*Last updated: 2025-10-03* From 4894b0d8590165496145b394730dda61a82a3bb3 Mon Sep 17 00:00:00 2001 From: Biljana Orescanin <68251545+biljanaorescanin@users.noreply.github.com> Date: Fri, 3 Oct 2025 15:37:25 -0400 Subject: [PATCH 30/44] update readme --- .../Utils/Raster/makebcs/utils_topo/README_topo.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md index b6521c749..c2d5d0c77 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md @@ -125,9 +125,9 @@ The script writes **`topo_.j`** in `out_dir` and sets sane defaults for tim --- -## Runtime guidance (from header comments) +## Runtime guidance -> Wall estimates assume GMAO/Discover‑like nodes; adjust for your system. +> Wall estimates assume Discover nodes; adjust for your system. * `c180 … c2880, c1536, c1120, c2160`: **1 node**, ~**1h** * `c5760, c540, c270, c48`: **2 nodes**, ~**4h** From 52d257f833c81f89837e661e0a82dcb25c9c7d10 Mon Sep 17 00:00:00 2001 From: Biljana Orescanin <68251545+biljanaorescanin@users.noreply.github.com> Date: Fri, 3 Oct 2025 15:42:38 -0400 Subject: [PATCH 31/44] update readme again --- .../Utils/Raster/makebcs/utils_topo/README_topo.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md index c2d5d0c77..aae1084e6 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md @@ -72,7 +72,7 @@ Outputs (per‑resolution) in `out_dir/output_/` as NetCDF files and binary * `mpirun` available in `$PATH` * **Scheduler:** Slurm (`sbatch`) -> The driver writes a **csh** job file +The driver writes a **csh** job file --- @@ -87,7 +87,7 @@ Outputs (per‑resolution) in `out_dir/output_/` as NetCDF files and binary * If you choose a stretched family, you will be asked for its concrete IM sizes (e.g., `C270`, `C540`). -The script writes **`topo_.j`** in `out_dir` and sets sane defaults for time, nodes, and job name. +The script writes **`topo_.j`** in `out_dir` and sets sane defaults for time, nodes, and job name. --- @@ -121,13 +121,13 @@ The script writes **`topo_.j`** in `out_dir` and sets sane defaults for tim | C1536 (SG002) | 26.8 | 12.1 | | C2160 (SG001) | 2.98 | 14.25 | -> To add/retune a grid, edit the `smoothmap`/`alpha` dicts in `make_topo.py` and re‑run. +To add/retune a grid, edit the `smoothmap`/`alpha` dicts in `make_topo.py` and re‑run. --- ## Runtime guidance -> Wall estimates assume Discover nodes; adjust for your system. +Wall estimates assume Discover nodes; adjust for your system. * `c180 … c2880, c1536, c1120, c2160`: **1 node**, ~**1h** * `c5760, c540, c270, c48`: **2 nodes**, ~**4h** @@ -135,7 +135,7 @@ The script writes **`topo_.j`** in `out_dir` and sets sane defaults for tim * `c24`: **2 nodes**, ~**8h** * `c12`: **2 nodes**, ~**19h**, use `qos=long` -> The driver currently sets 1 node in the Slurm header by default; edit the generated job for heavy cases. +The driver currently sets 1 node in the Slurm header by default; edit the generated job for heavy cases. --- From e03cbec811267c21e158b86b1a7b439835df8d41 Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Wed, 8 Oct 2025 09:35:16 -0400 Subject: [PATCH 32/44] add to readme and move --- .../utils_topo/scrip_to_restart_topo.py | 66 +++++++---- .../topography}/README_topo.md | 103 ++++++++++++++---- 2 files changed, 130 insertions(+), 39 deletions(-) rename GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/{makebcs/utils_topo => preproc/topography}/README_topo.md (79%) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_restart_topo.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_restart_topo.py index 69ed7d75b..f45d379b3 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_restart_topo.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_restart_topo.py @@ -85,27 +85,53 @@ def parse_args(): if haveRdg: temp2d = numpy.zeros([rdgSize,6*cRes,cRes]) -exclude = ['lon','lat'] +exclude = ['lon', 'lat'] for var in ncFid.variables: - if var not in exclude: - temp = ncFid.variables[var][:] - dim_size =len(temp.shape) - - if dim_size == 2: - tout = ncFidOut.createVariable(var,'f8',('unknown_dim1','lat','lon'),fill_value=1.0e15) - for att in ncFid.variables[var].ncattrs(): - if att != "_FillValue": - setattr(ncFidOut.variables[var],att,getattr(ncFid.variables[var],att)) - temp2d = numpy.reshape(temp,[rdgSize,cRes*6,cRes]) - tout[:,:,:] = temp2d[:,:,:] - - elif dim_size == 1: - tout = ncFidOut.createVariable(var,'f8',('lat','lon'),fill_value=1.0e15) - for att in ncFid.variables[var].ncattrs(): - if att != "_FillValue": - setattr(ncFidOut.variables[var],att,getattr(ncFid.variables[var],att)) - temp1d = numpy.reshape(temp,[cRes*6,cRes]) - tout[:,:] = temp1d[:,:] + if var in exclude: + continue + + v = ncFid.variables[var] + temp = v[:] + nd = temp.ndim + + # Choose fill value at creation time + is_angle = var.upper() in ('ANGLX', 'ANGLL') + fv = -9999.0 if is_angle else 1.0e15 + + # Create destination variable with correct fill immediately + if nd == 2: # (nrdg, ncol) -> (unknown_dim1, lat, lon) + tout = ncFidOut.createVariable( + var, 'f8', ('unknown_dim1', 'lat', 'lon'), + fill_value=fv + ) + elif nd == 1: # (ncol) -> (lat, lon) + tout = ncFidOut.createVariable( + var, 'f8', ('lat', 'lon'), + fill_value=fv + ) + else: + # unexpected rank — skip safely + continue + + # Copy attributes verbatim EXCEPT _FillValue (already set) + for att in v.ncattrs(): + if att != '_FillValue': + setattr(tout, att, getattr(v, att)) + + # For angle variables, make the metadata sentinel explicit + if is_angle: + setattr(tout, 'missing_value', -9999.0) + + # Simple reshape write (no masking/NaN munging in this tool) + if nd == 2: + tout[:, :, :] = numpy.reshape(temp, (len(ncFid.dimensions['nrdg']), + int((len(ncFid.dimensions['ncol'])//6)**0.5)*6, + int((len(ncFid.dimensions['ncol'])//6)**0.5))) + else: + tout[:, :] = numpy.reshape(temp, + (int((len(ncFid.dimensions['ncol'])//6)**0.5)*6, + int((len(ncFid.dimensions['ncol'])//6)**0.5))) + #----------------- # Closing the file #---------------- diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/README_topo.md similarity index 79% rename from GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md rename to GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/README_topo.md index aae1084e6..12d9008bf 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/README_topo.md +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/README_topo.md @@ -187,20 +187,99 @@ Users may add new stretching options with different target centers and stretch f ``` $ ./make_topo.py -Enter the root path of the bin: /home/me/topo/bin -Enter the path of the output directory: /discover/nobackup/me/BCS_TOPO +Enter the root path of the bin. Where code was compiled install/bin. +Enter the path of the output directory: /discover/nobackup/{USER}/BCS_TOPO Enter the path contains gmted_fixed_anartica_superior_caspian.nc4 (confirm selection): /discover/nobackup/projects/gmao/bcs_shared/preprocessing_bcs_inputs/land/topo/v1/ Select resolutions: [x] C360 [x] SG001 Select resolution of SG001 grid: [x] C540 [ ] C1080 [ ] C2160 [ ] C270 # => writes topo_c360_c540.j under out_dir -$ cd /discover/nobackup/me/BCS_TOPO +$ cd /discover/nobackup/{USER}/BCS_TOPO $ sbatch topo_c360_c540.j -# or submit one job at the time to have clean run log for each job: topo_c360.j. Save it is res dependent dir to have whole run isolated: /discover/nobackup/me/BCS_TOPO/c360/ +# or submit one job at the time to have clean run log for each job: topo_c360.j. +Save it is res dependent dir to have whole run isolated: /discover/nobackup/{USER}/BCS_TOPO/c360/ ``` --- +## **List of Files in directory `utils_topo`** + +Below are the main files in this directory, with one-line summaries. +Each file also has its own inline header with more detail. + +- **CMakeLists.txt** — builds the utilities. +- **convert_bin_to_netcdf.F90** — small helper to convert raw binary topography into NetCDF (intermediate or testing). +- **convert_to_gmao_output.F90** — final step: produces GMAO deliverables (`gmted_DYN_ave_*.nc4`, `gmted_GWD_var_*.nc4`, `gmted_TRB_var_*.nc4`). +- **geompack.F90** — bundled geometry library (Burkardt routines: convex hull, triangle quality, etc.), needed for SCRIP generation. +- **generate_scrip_cube.F90** — builds SCRIP descriptors (uniform or Schmidt-stretched). +- **make_topo.py** — interactive driver, generates the Slurm job script to run the full pipeline. +- **scrip_to_cube_topo.py** — converts flat `ncol` → cube layout, using example file geometry. +- **scrip_to_restart_topo.py** — converts PE outputs into GWD restart format. + +--- + +## **List of Files in directory `@ncar_topo`** + +# **@ncar_topo — GMAO Version of NCAR Topography Tools** + +This directory contains the **GMAO-adapted version** of the NCAR *Topography Generation Software* +(originally `NCAR_Topo_2_0_1`, February 2023). +It provides the core Fortran utilities used to build cubed-sphere topography for the **GEOS** model. + +For the original NCAR user guide, see: +➡️ [https://github.com/NCAR/Topo/wiki/User's-Guide](https://github.com/NCAR/Topo/wiki/User's-Guide) + +### **`bin_to_cube/`** +Utility to **bin high-resolution global elevation data** (e.g., GMTED) from a latitude–longitude grid +onto a **cubed-sphere intermediate grid**. + +**Purpose:** +Creates an intermediate cube (e.g., `c3000.gmted_fixedanarticasuperior.nc`) used by the next stage, +`cube_to_target`. + +**Key files:** +- **bin_to_cube.F90** — main Fortran program +- **bin_to_cube\*.nl** — sample namelists for various cube sizes (e.g., 540, 3000) + +- Normally run **once** unless the source dataset or cube resolution changes. +- Generates data used for all downstream remapping and smoothing. + +--- + +### **`cube_to_target/`** +Utility to **process, smooth, and remap** the cubed-sphere intermediate topography to a **target model grid**, +either **uniform** or **Schmidt-stretched** variable resolution. + +**Capabilities:** +- Iterative **Laplacian “no-leak” smoother** +- Ridge detection and sub-grid statistics (`SGH`, `SGH30`, etc.) +- Seamless **variable-resolution** support using `rrfac` and `STRETCH_FACTOR` + +**Key files:** +- **cube_to_target.F90** — main driver +- **neighbor_search_mod.F90**, **kdtree_mod.F90** — geometric utilities +- **f90getopt.F90** — command line argument parser + +--- + +### **Upstream NCAR Software** + +Peter H. Lauritzen, Julio T. Bacmeister, Patrick Callaghan, and Mark A. Taylor (2015). +*NCAR Global Model Topography Generation Software for Unstructured Grids.* +*Geosci. Model Dev.*, **8**, 3975–3986. +DOI: **10.5194/gmd-8-3975-2015** + +--- + +### **GMAO Modifications** + +- Discover-compatible (Slurm) version +- Schmidt stretching and `rrfac` support +- Neighbor-repair logic using KD-tree search +- NetCDF compliance +- GEOS restart generation cleanup + +--- ## FAQ **Q: Can I reuse an existing `c3000`?** @@ -224,18 +303,4 @@ We cannot push changes back upstream (no test platform there), so their repo may **Q: Can I widen or narrow the stretched‑grid refinement “dome”?** A: Yes. The dome’s footprint is set by the half‑power radius (half_power_radius_deg) inside the stretched‑grid rrfac logic. By default it’s ~40°/sqrt(max(1, stretch_factor)), so for SF≈2.5 the half‑power radius is ~25° (covers most of CONUS). Increase the constant (e.g., 45–50) to broaden the dome; decrease to tighten it. This only affects stretched grids. -## List of Files in utils_topo - -Below are the main files in this directory, with one-line summaries. -Each file also has its own inline header with more detail. - -- **CMakeLists.txt** — builds the utilities. -- **convert_bin_to_netcdf.F90** — small helper to convert raw binary topography into NetCDF (intermediate or testing). -- **convert_to_gmao_output.F90** — final step: produces GMAO deliverables (`gmted_DYN_ave_*.nc4`, `gmted_GWD_var_*.nc4`, `gmted_TRB_var_*.nc4`). -- **geompack.F90** — bundled geometry library (Burkardt routines: convex hull, triangle quality, etc.), needed for SCRIP generation. -- **generate_scrip_cube.F90** — builds SCRIP descriptors (uniform or Schmidt-stretched). -- **make_topo.py** — interactive driver, generates the Slurm job script to run the full pipeline. -- **scrip_to_cube_topo.py** — converts flat `ncol` → cube layout, using example file geometry. -- **scrip_to_restart_topo.py** — converts PE outputs into GWD restart format. - -*Last updated: 2025-10-03* +*Last updated: 2025-10-08* From 9afd2a68bf3fdfb426421152d6d237962a77ab42 Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Wed, 8 Oct 2025 13:43:13 -0400 Subject: [PATCH 33/44] move utils_topo dir to new location --- .../{makebcs => preproc/topography}/utils_topo/CMakeLists.txt | 0 .../topography}/utils_topo/convert_bin_to_netcdf.F90 | 0 .../topography}/utils_topo/convert_to_gmao_output.F90 | 0 .../topography}/utils_topo/generate_scrip_cube.F90 | 0 .../{makebcs => preproc/topography}/utils_topo/geompack.F90 | 0 .../{makebcs => preproc/topography}/utils_topo/make_topo.py | 0 .../topography}/utils_topo/scrip_to_cube_topo.py | 0 .../topography}/utils_topo/scrip_to_restart_topo.py | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/{makebcs => preproc/topography}/utils_topo/CMakeLists.txt (100%) rename GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/{makebcs => preproc/topography}/utils_topo/convert_bin_to_netcdf.F90 (100%) rename GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/{makebcs => preproc/topography}/utils_topo/convert_to_gmao_output.F90 (100%) rename GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/{makebcs => preproc/topography}/utils_topo/generate_scrip_cube.F90 (100%) rename GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/{makebcs => preproc/topography}/utils_topo/geompack.F90 (100%) rename GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/{makebcs => preproc/topography}/utils_topo/make_topo.py (100%) rename GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/{makebcs => preproc/topography}/utils_topo/scrip_to_cube_topo.py (100%) rename GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/{makebcs => preproc/topography}/utils_topo/scrip_to_restart_topo.py (100%) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/CMakeLists.txt b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/CMakeLists.txt similarity index 100% rename from GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/CMakeLists.txt rename to GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/CMakeLists.txt diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_bin_to_netcdf.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/convert_bin_to_netcdf.F90 similarity index 100% rename from GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_bin_to_netcdf.F90 rename to GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/convert_bin_to_netcdf.F90 diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_to_gmao_output.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/convert_to_gmao_output.F90 similarity index 100% rename from GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/convert_to_gmao_output.F90 rename to GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/convert_to_gmao_output.F90 diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/generate_scrip_cube.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/generate_scrip_cube.F90 similarity index 100% rename from GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/generate_scrip_cube.F90 rename to GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/generate_scrip_cube.F90 diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/geompack.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/geompack.F90 similarity index 100% rename from GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/geompack.F90 rename to GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/geompack.F90 diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/make_topo.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/make_topo.py similarity index 100% rename from GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/make_topo.py rename to GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/make_topo.py diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_cube_topo.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/scrip_to_cube_topo.py similarity index 100% rename from GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_cube_topo.py rename to GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/scrip_to_cube_topo.py diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_restart_topo.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/scrip_to_restart_topo.py similarity index 100% rename from GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/utils_topo/scrip_to_restart_topo.py rename to GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/utils_topo/scrip_to_restart_topo.py From 9c3d8b8014c7bda8f5382f754863fb6f47c50217 Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Wed, 8 Oct 2025 14:10:31 -0400 Subject: [PATCH 34/44] add cmake file --- .../Utils/Raster/makebcs/CMakeLists.txt | 1 - .../{makebcs => preproc/topography}/.gitignore | 0 .../Utils/Raster/preproc/topography/CMakeLists.txt | 12 ++++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) rename GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/{makebcs => preproc/topography}/.gitignore (100%) create mode 100644 GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/CMakeLists.txt diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/CMakeLists.txt b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/CMakeLists.txt index 895b59f9d..bd8458931 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/CMakeLists.txt +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/CMakeLists.txt @@ -37,7 +37,6 @@ else () target_compile_definitions(${this} PRIVATE STDC) endif () -esma_add_subdirectories (@ncar_topo utils_topo) ecbuild_add_executable (TARGET CombineRasters.x SOURCES CombineRasters.F90 LIBS MAPL ${this}) ecbuild_add_executable (TARGET mkCatchParam.x SOURCES mkCatchParam.F90 LIBS MAPL ${this} OpenMP::OpenMP_Fortran) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/.gitignore b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/.gitignore similarity index 100% rename from GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/.gitignore rename to GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/.gitignore diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/CMakeLists.txt b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/CMakeLists.txt new file mode 100644 index 000000000..a8fe29cff --- /dev/null +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/CMakeLists.txt @@ -0,0 +1,12 @@ +# CMakeLists.txt for Utils/Raster/preproc/topography +if(COMMAND esma_add_subdirectories) + esma_add_subdirectories(@ncar_topo utils_topo) +else() + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/@ncar_topo/CMakeLists.txt") + add_subdirectory(@ncar_topo) + endif() + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/utils_topo/CMakeLists.txt") + add_subdirectory(utils_topo) + endif() +endif() + From 6963c041b960433836f0e4d34c26b11acfa92527 Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Wed, 8 Oct 2025 15:24:19 -0400 Subject: [PATCH 35/44] add dir to build --- .../GEOSsurface_GridComp/Utils/Raster/preproc/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/CMakeLists.txt b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/CMakeLists.txt index d4eca3cfc..cc745169e 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/CMakeLists.txt +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/CMakeLists.txt @@ -1 +1 @@ -esma_add_subdirectories (soil routing) +esma_add_subdirectories (soil routing topography) From d5467db1d6ffa212689edd0ce04dca31cc50ad27 Mon Sep 17 00:00:00 2001 From: Biljana Orescanin <68251545+biljanaorescanin@users.noreply.github.com> Date: Mon, 3 Nov 2025 15:26:03 -0500 Subject: [PATCH 36/44] we don't need all this --- .../Utils/Raster/preproc/topography/CMakeLists.txt | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/CMakeLists.txt b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/CMakeLists.txt index a8fe29cff..19f653d8b 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/CMakeLists.txt +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/preproc/topography/CMakeLists.txt @@ -1,12 +1,2 @@ # CMakeLists.txt for Utils/Raster/preproc/topography -if(COMMAND esma_add_subdirectories) - esma_add_subdirectories(@ncar_topo utils_topo) -else() - if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/@ncar_topo/CMakeLists.txt") - add_subdirectory(@ncar_topo) - endif() - if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/utils_topo/CMakeLists.txt") - add_subdirectory(utils_topo) - endif() -endif() - +esma_add_subdirectories(ncar_topo utils_topo) From dcad50ce52690c09540115ff0f2bc5a889e36411 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 5 Mar 2025 11:43:23 -0500 Subject: [PATCH 37/44] Fixes #1069. Clean up WW3 Cmake --- .../ww3_multi_esmf/CMakeLists.txt | 45 ++++--------------- 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/GEOSwgcm_GridComp/GEOSwavewatch_GridComp/ww3_multi_esmf/CMakeLists.txt b/GEOSwgcm_GridComp/GEOSwavewatch_GridComp/ww3_multi_esmf/CMakeLists.txt index 416e6e57a..ab3d08bc5 100644 --- a/GEOSwgcm_GridComp/GEOSwavewatch_GridComp/ww3_multi_esmf/CMakeLists.txt +++ b/GEOSwgcm_GridComp/GEOSwavewatch_GridComp/ww3_multi_esmf/CMakeLists.txt @@ -91,43 +91,16 @@ set_property (SOURCE ${WW3_path}/model/src/w3initmd.F90 "__WW3_SWITCHES__=\'${switch_strings}\'" ) +# We are duplicating info here. The switch_strings above is used below for defs +# but with W3_ prefix. We can use CMake to prevent this duplication. -list (APPEND defs - W3_NOGRB - W3_DIST - W3_MPI - W3_SCRIP - W3_PR3 - W3_UQ - W3_FLX0 - W3_LN1 - W3_FLD2 - W3_ST4 - W3_STAB0 - W3_NL1 - W3_BT1 - W3_DB1 - W3_MLIM - W3_TR0 - W3_BS0 - W3_XX0 - W3_WNX0 - W3_WNT0 - W3_CRX0 - W3_CRT0 - W3_O0 - W3_O1 - W3_O2 - W3_O3 - W3_O4 - W3_O5 - W3_O6 - W3_O7 - W3_IC0 - W3_IS0 - W3_REF0 -) +# 1. Create a list from the switch_strings space-separated string +string(REPLACE " " ";" switch_list ${switch_strings}) -target_compile_definitions(${this} PRIVATE ${defs}) +# 2. Add W3_ prefix to each element in the list +foreach(switch ${switch_list}) + list(APPEND defs W3_${switch}) +endforeach() +target_compile_definitions(${this} PRIVATE ${defs}) From cf890bbd05d51ad12c4389cbe8da24f189b63b9c Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Thu, 22 Jan 2026 12:23:27 -0500 Subject: [PATCH 38/44] using v13 for this coupled grids bathymetry update --- .../Utils/Raster/makebcs/make_bcs_questionary.py | 3 +-- .../Utils/Raster/makebcs/make_bcs_shared.py | 7 +++---- .../Utils/Raster/makebcs/mkCatchParam.F90 | 2 +- .../Utils/Raster/makebcs/rmTinyCatchParaMod.F90 | 13 ++++++------- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py index 119969698..7186f66ff 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py @@ -198,8 +198,7 @@ def ask_questions(default_grid="Cubed-Sphere"): "v10 : NL3 + PEATMAP + MODIS snow alb v2", \ "v11 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2", \ "v12 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix", \ - "v13 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix + mean land elevation fix", \ - "v14 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix + mean land elevation fix + MOM6 v2 (OM4) ocean-seaice bathymetry", \ + "v13 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix + mean land elevation fix + MOM6 v2 (OM4) ocean-seaice bathymetry", \ "ICA : Icarus (archived*: /discover/nobackup/projects/gmao/bcs_shared/legacy_bcs/Icarus/)", \ "GM4 : Ganymed-4_0 (archived*: /discover/nobackup/projects/gmao/bcs_shared/legacy_bcs/Ganymed-4_0/)", \ "F25 : Fortuna-2_5 (archived*: n/a)"], diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py index 029ddc73d..0603cdc61 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py @@ -23,19 +23,18 @@ "v10": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, "v11": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, "v12": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, - "v13": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, - "v14": {"TOPO_VERSION": "v2", "MOM6_BATHY_VERSION": "v2"}, + "v13": {"TOPO_VERSION": "v2", "MOM6_BATHY_VERSION": "v2"}, } _DEFAULTS = {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"} def _normalize_lbcsv(label: str) -> str: v = (label or "").strip() - m = re.match(r'[vV]?\d+|[A-Za-z0-9]+', v) # accepts v14 / 14 / NL3 / etc. + m = re.match(r'[vV]?\d+|[A-Za-z0-9]+', v) # accepts v13 / 13 / NL3 / etc. if not m: return v key = m.group(0) - # normalize numeric like '14' -> 'v14' + # normalize numeric like '13' -> 'v13' if key.isdigit(): key = 'v' + key return key diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/mkCatchParam.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/mkCatchParam.F90 index fcafbf333..6ce9859aa 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/mkCatchParam.F90 +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/mkCatchParam.F90 @@ -12,7 +12,7 @@ PROGRAM mkCatchParam ! -y: Size of latitude dimension of input raster. DEFAULT: 4320 ! -b: Position of dateline w.r.t. first grid cell boundaries. DEFAULT: DC (dateline-on-center) ! -g: Gridname (name of the .til or .rst file without file extension) -! -v: LBCSV : Land bcs version (F25, GM4, ICA, NL3, NL4, NL5, v06, v07, v08, v09) +! -v: LBCSV : Land bcs version (F25, GM4, ICA, NL3, NL4, NL5, v06, v07, v08, v09, v11, v12 and v13 ) ! ! ! This program is good to generate diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 index 4bbf7977f..69935abbf 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 @@ -226,13 +226,12 @@ SUBROUTINE init_bcs_config(LBCSV) use_PEATMAP = .true. jpl_height = .true. - case ("v12","v13","v14") - ! "v12", "v13", and "v14" are identical except for: - ! - ATM topography: v12/v13 use TOPO v1; v14 uses TOPO v2. - ! - catchment.def land-elevation bug fix: absent in v12; present in v13/v14. - ! - netCDF-4 (NC4) tile-file generation: absent in v12; present in v13/v14. - ! - Coupled-model BC land properties vs AGCM: inconsistency present in v12; fixed in v13/v14. - ! - Coupled atmosphere-ocean-sea ice: v14 uses MOM6/v2 (OM4) ocean bathymetry; v12/v13 use v1. + case ("v12","v13") + ! "v12" are "v13" are identical except for: + ! - catchment.def land-elevation bug fix: absent in v12; present in v13. + ! - netCDF-4 (NC4) tile-file generation: absent in v12; present in v13. + ! - Coupled-model BC land properties vs AGCM: inconsistency present in v12; fixed in v13. + ! - Coupled atmosphere-ocean-sea ice: v13 uses MOM6/v2 (OM4) ocean bathymetry; v12 v1. LAIBCS = 'MODGEO' SOILBCS = 'HWSD_b' From 442009d1d1ccc6c899eeaaf340aceadd5af4edfb Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Thu, 22 Jan 2026 13:07:33 -0500 Subject: [PATCH 39/44] fix for easy --- .../Utils/Raster/makebcs/make_bcs_ease.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_ease.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_ease.py index 590b65b8b..993c00815 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_ease.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_ease.py @@ -64,8 +64,11 @@ def make_bcs_ease(config): os.makedirs(log_dir) account = get_account() + TOPO_VERSION = topo_version_for_bcs(config['lbcsv']) ims = '%04d'%config['im'] jms = '%04d'%config['jm'] + NC = ims + SGNAME = "" RS = str(config['im'])+'x'+ str(config['jm']) script_template = get_script_head() + ease_template + get_script_mv(config['grid_type']) @@ -80,6 +83,8 @@ def make_bcs_ease(config): MAKE_BCS_INPUT_DIR = config['inputdir'], \ IM = ims, \ JM = jms, \ + NC = NC, \ + SGNAME = SGNAME, \ MASKFILE = config['MASKFILE'], \ lbcsv = config['lbcsv'], \ TRIPOL_OCEAN = False, \ @@ -88,6 +93,7 @@ def make_bcs_ease(config): RS = '_'+RS,\ RC = RS+'_DE',\ SCRATCH_DIR = scratch_dir, \ + TOPO_VERSION = TOPO_VERSION, \ NCPUS = config['NCPUS']) ease_job = open(bcjob,'wt') From 14adacab5502c6e4a3857be777a590ec8e2d9c84 Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Thu, 22 Jan 2026 13:35:18 -0500 Subject: [PATCH 40/44] right topo version --- .../Utils/Raster/makebcs/make_bcs_shared.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py index 0603cdc61..2dd1a349b 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py @@ -23,7 +23,7 @@ "v10": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, "v11": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, "v12": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, - "v13": {"TOPO_VERSION": "v2", "MOM6_BATHY_VERSION": "v2"}, + "v13": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v2"}, } _DEFAULTS = {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"} From f4485878bed28044c9fac8f33c57ab234ca8e6e9 Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Thu, 22 Jan 2026 14:12:17 -0500 Subject: [PATCH 41/44] better info message --- .../Utils/Raster/makebcs/make_bcs_cube.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py index b55f34c71..b9b6f1eae 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py @@ -180,9 +180,13 @@ def make_bcs_cube(config): print(f"ABORT: Missing MOM6 bathymetry: {mom6_src} " f"(LBCSV={config['lbcsv']} MOM6={MOM6_BATHY_VERSION})") return + + msg = f"[make_bcs_cube] LBCSV={config['lbcsv']} TOPO={TOPO_VERSION} GRID={GRIDNAME}" + + if config["TRIPOL_OCEAN"]: + msg = msg + f" MOM6={MOM6_BATHY_VERSION} REQ={config['imo']}x{config['jmo']}" - print(f"[make_bcs_cube] LBCSV={config['lbcsv']} TOPO={TOPO_VERSION} " - f"MOM6={MOM6_BATHY_VERSION} REQ={'{imo}x{jmo}'.format(**config)} GRID={GRIDNAME}") + print(msg) # ------------------------------------------------------------------- script_template = get_script_head() + cube_template + get_script_mv(config['grid_type']) From 1fd603eac2a2b0ca3def0440859a3bbf32bd02c0 Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Thu, 22 Jan 2026 21:50:40 -0500 Subject: [PATCH 42/44] smarter cleanup --- .../Utils/Raster/makebcs/make_bcs_cube.py | 3 +-- .../Utils/Raster/makebcs/make_bcs_ease.py | 8 +++++++- .../Utils/Raster/makebcs/make_bcs_latlon.py | 12 ++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py index b9b6f1eae..c7487fad7 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_cube.py @@ -29,13 +29,12 @@ if ( -e data/MOM6/$req ) /bin/rm -f data/MOM6/$req ln -s $mom6root/$req data/MOM6/$req endif -======= + ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/72x36 data/MOM6/72x36 ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/540x458 data/MOM6/540x458 ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/1440x1080 data/MOM6/1440x1080 ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/720x576 data/MOM6/720x576 ln -s {MAKE_BCS_INPUT_DIR}/ocean/MOM6/{mom6_bathy_version}/2880x2240 data/MOM6/2880x2240 -======= if( -e CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout ) /bin/rm -f CF{NC}x6C{SGNAME}_{DATENAME}{IMO}x{POLENAME}{JMO}.stdout diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_ease.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_ease.py index 993c00815..c34d08c0f 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_ease.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_ease.py @@ -15,6 +15,10 @@ chmod 755 bin/create_README.csh bin/create_README.csh +# Prevent shared CF TOPO linking for non-cube grids: +if ( ! -d TOPO ) mkdir -p TOPO +if ( ! -e TOPO/CF{NC}x6C{SGNAME} ) mkdir -p TOPO/CF{NC}x6C{SGNAME} + """ def make_bcs_ease(config): @@ -67,7 +71,7 @@ def make_bcs_ease(config): TOPO_VERSION = topo_version_for_bcs(config['lbcsv']) ims = '%04d'%config['im'] jms = '%04d'%config['jm'] - NC = ims + NC = "0000" SGNAME = "" RS = str(config['im'])+'x'+ str(config['jm']) @@ -88,6 +92,8 @@ def make_bcs_ease(config): MASKFILE = config['MASKFILE'], \ lbcsv = config['lbcsv'], \ TRIPOL_OCEAN = False, \ + LATLON_OCEAN = False, \ + CUBED_SPHERE_OCEAN = False, \ NX = config['NX'], \ NY = config['NY'], \ RS = '_'+RS,\ diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_latlon.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_latlon.py index 7050a1f9f..c565f63a9 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_latlon.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_latlon.py @@ -49,6 +49,10 @@ bin/create_README.csh endif +# Prevent shared CF TOPO linking for non-cube grids: +if ( ! -d TOPO ) mkdir -p TOPO +if ( ! -e TOPO/CF{NC}x6C{SGNAME} ) mkdir -p TOPO/CF{NC}x6C{SGNAME} + """ def make_bcs_latlon(config): @@ -65,6 +69,10 @@ def make_bcs_latlon(config): JMO = '%04d'%config['jmo'] IM = '%04d'%config['im'] JM = '%04d'%config['jm'] + TOPO_VERSION = topo_version_for_bcs(config['lbcsv']) + NC = "0000" + SGNAME = "" + CUBED_SPHERE_OCEAN = False RC = str(config['im']) +'x' +str(config['jm'])+'_DC' @@ -114,6 +122,10 @@ def make_bcs_latlon(config): JM = JM, \ IMO = IMO, \ JMO = JMO, \ + TOPO_VERSION = TOPO_VERSION, \ + NC = NC, \ + SGNAME = SGNAME, \ + CUBED_SPHERE_OCEAN = CUBED_SPHERE_OCEAN, \ MASKFILE = config['MASKFILE'], \ lbcsv = config['lbcsv'], \ NX = config['NX'], \ From 297db4ba82353b44b9b40ae09f0638d58cb997ae Mon Sep 17 00:00:00 2001 From: biljanaorescanin Date: Tue, 27 Jan 2026 10:27:48 -0500 Subject: [PATCH 43/44] code simplification / cleanup --- .../Utils/Raster/makebcs/make_bcs_ease.py | 12 ----------- .../Utils/Raster/makebcs/make_bcs_latlon.py | 12 ----------- .../Utils/Raster/makebcs/make_bcs_shared.py | 20 ++++++++++--------- 3 files changed, 11 insertions(+), 33 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_ease.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_ease.py index c34d08c0f..590b65b8b 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_ease.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_ease.py @@ -15,10 +15,6 @@ chmod 755 bin/create_README.csh bin/create_README.csh -# Prevent shared CF TOPO linking for non-cube grids: -if ( ! -d TOPO ) mkdir -p TOPO -if ( ! -e TOPO/CF{NC}x6C{SGNAME} ) mkdir -p TOPO/CF{NC}x6C{SGNAME} - """ def make_bcs_ease(config): @@ -68,11 +64,8 @@ def make_bcs_ease(config): os.makedirs(log_dir) account = get_account() - TOPO_VERSION = topo_version_for_bcs(config['lbcsv']) ims = '%04d'%config['im'] jms = '%04d'%config['jm'] - NC = "0000" - SGNAME = "" RS = str(config['im'])+'x'+ str(config['jm']) script_template = get_script_head() + ease_template + get_script_mv(config['grid_type']) @@ -87,19 +80,14 @@ def make_bcs_ease(config): MAKE_BCS_INPUT_DIR = config['inputdir'], \ IM = ims, \ JM = jms, \ - NC = NC, \ - SGNAME = SGNAME, \ MASKFILE = config['MASKFILE'], \ lbcsv = config['lbcsv'], \ TRIPOL_OCEAN = False, \ - LATLON_OCEAN = False, \ - CUBED_SPHERE_OCEAN = False, \ NX = config['NX'], \ NY = config['NY'], \ RS = '_'+RS,\ RC = RS+'_DE',\ SCRATCH_DIR = scratch_dir, \ - TOPO_VERSION = TOPO_VERSION, \ NCPUS = config['NCPUS']) ease_job = open(bcjob,'wt') diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_latlon.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_latlon.py index c565f63a9..7050a1f9f 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_latlon.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_latlon.py @@ -49,10 +49,6 @@ bin/create_README.csh endif -# Prevent shared CF TOPO linking for non-cube grids: -if ( ! -d TOPO ) mkdir -p TOPO -if ( ! -e TOPO/CF{NC}x6C{SGNAME} ) mkdir -p TOPO/CF{NC}x6C{SGNAME} - """ def make_bcs_latlon(config): @@ -69,10 +65,6 @@ def make_bcs_latlon(config): JMO = '%04d'%config['jmo'] IM = '%04d'%config['im'] JM = '%04d'%config['jm'] - TOPO_VERSION = topo_version_for_bcs(config['lbcsv']) - NC = "0000" - SGNAME = "" - CUBED_SPHERE_OCEAN = False RC = str(config['im']) +'x' +str(config['jm'])+'_DC' @@ -122,10 +114,6 @@ def make_bcs_latlon(config): JM = JM, \ IMO = IMO, \ JMO = JMO, \ - TOPO_VERSION = TOPO_VERSION, \ - NC = NC, \ - SGNAME = SGNAME, \ - CUBED_SPHERE_OCEAN = CUBED_SPHERE_OCEAN, \ MASKFILE = config['MASKFILE'], \ lbcsv = config['lbcsv'], \ NX = config['NX'], \ diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py index 2dd1a349b..b1ad2419b 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py @@ -216,14 +216,13 @@ def get_script_mv(grid_type): echo "Successfully copied CO2_MonthlyMean_DiurnalCycle.nc4 to bcs dir." endif +""" + + if grid_type in ("Cubed-Sphere", "Stretched_CS"): + mv_template = mv_template + """ # Link TOPO into this BCS directory based on bcs_version -# You can override with: setenv TOPO_VERSION v1|v2 before launching the job -if ( $?TOPO_VERSION ) then - set topo_version = $TOPO_VERSION -else - set topo_version = {TOPO_VERSION} -endif +set topo_version = {TOPO_VERSION} if ( ! -d TOPO ) mkdir -p TOPO set topo_dir = CF{NC}x6C{SGNAME} # e.g., CF0024x6C or CF0540x6C-SG001 @@ -233,18 +232,21 @@ def get_script_mv(grid_type): if ( -e TOPO/$topo_dir ) then echo "TOPO/$topo_dir already exists; not relinking." else if ( -d $topo_src ) then - /bin/ln -s $topo_src TOPO/$topo_dir + /bin/ln -s $topo_src TOPO/$topo_dir echo "Linked TOPO/$topo_dir -> $topo_src" else echo "WARNING: TOPO source not found: $topo_src" endif -# adjust permissions +""" + + # always include permissions block for all grids + mv_template = mv_template + """ +# adjust permissions chmod +rX -R geometry land logs """ - return mv_template def check_script(expdir, script): From a264bbe29e3b54614f195a6bad50ac62389e52f0 Mon Sep 17 00:00:00 2001 From: Rolf Reichle Date: Wed, 28 Jan 2026 14:10:26 -0500 Subject: [PATCH 44/44] minor updates to comments and white space (make_bcs_questionary.py, make_bcs_shared.py, rmTinyCatchParaMod.F90) --- .../Raster/makebcs/make_bcs_questionary.py | 8 +++---- .../Utils/Raster/makebcs/make_bcs_shared.py | 8 ++++--- .../Raster/makebcs/rmTinyCatchParaMod.F90 | 22 +++++++++---------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py index 7186f66ff..bd660418b 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_questionary.py @@ -65,7 +65,7 @@ def get_configs_from_answers(answers): maskfile = '' - if orslv in['O1','T2','T3','T4','T1MOM6','T3MOM6', 'T4MOM6', 'T5MOM6', 'T8MOM6']: + if orslv in['O1','T2','T3','T4','T1MOM6','T3MOM6','T4MOM6','T5MOM6','T8MOM6']: maskfile = 'GEOS5_10arcsec_mask_freshwater-lakes.nc' if lbcsv in ['F25', 'GM4', 'ICA']: maskfile = 'global.cat_id.catch.DL' @@ -174,7 +174,7 @@ def ask_questions(default_grid="Cubed-Sphere"): ocean resolution. ", "choices": ["No", "Yes"], }, - + { "type": "select", "name": "bcs_version", @@ -198,7 +198,7 @@ def ask_questions(default_grid="Cubed-Sphere"): "v10 : NL3 + PEATMAP + MODIS snow alb v2", \ "v11 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2", \ "v12 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix", \ - "v13 : NL3 + JPL veg height + PEATMAP + MODIS snow alb v2 + Argentina peatland fix + mean land elevation fix + MOM6 v2 (OM4) ocean-seaice bathymetry", \ + "v13 : As in v13 + mean land elevation fix + MOM6 v2 (OM4) ocean-seaice bathymetry", \ "ICA : Icarus (archived*: /discover/nobackup/projects/gmao/bcs_shared/legacy_bcs/Icarus/)", \ "GM4 : Ganymed-4_0 (archived*: /discover/nobackup/projects/gmao/bcs_shared/legacy_bcs/Ganymed-4_0/)", \ "F25 : Fortuna-2_5 (archived*: n/a)"], @@ -320,7 +320,7 @@ def ask_questions(default_grid="Cubed-Sphere"): "T1MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $72x36$ )", \ "T3MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $540x458$ )", \ "T4MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $1440x1080$)", \ - "T5MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $720x576$)", \ + "T5MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $720x576$ )", \ "T8MOM6 -- Tripolar (MOM6-Tripolar-Ocean: $2880x2240$)", \ "CS -- Cubed-Sphere Ocean (Cubed-Sphere Data-Ocean)"], "when": lambda x: "Stretched_CS" == x['grid_type'] or "Cubed-Sphere" == x['grid_type'], diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py index b1ad2419b..605833640 100755 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/make_bcs_shared.py @@ -9,6 +9,9 @@ # --- BEGIN VERSION MATRIX --- # Independent version mapping per questionnaire 'lbcsv' +# +# TOPO_VERSION refers to topography inputs for atm model + _VERSION_MATRIX = { "NL3": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, "NL4": {"TOPO_VERSION": "v1", "MOM6_BATHY_VERSION": "v1"}, @@ -221,7 +224,7 @@ def get_script_mv(grid_type): if grid_type in ("Cubed-Sphere", "Stretched_CS"): mv_template = mv_template + """ -# Link TOPO into this BCS directory based on bcs_version +# Link (atm) TOPO into this BCS directory based on bcs_version (only needed if grid_type is [stretched] cube-sphere) set topo_version = {TOPO_VERSION} if ( ! -d TOPO ) mkdir -p TOPO @@ -240,10 +243,9 @@ def get_script_mv(grid_type): """ - # always include permissions block for all grids mv_template = mv_template + """ -# adjust permissions +# adjust permissions (for all grid types) chmod +rX -R geometry land logs """ diff --git a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 index 69935abbf..bb16c87a3 100644 --- a/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 +++ b/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSsurface_GridComp/Utils/Raster/makebcs/rmTinyCatchParaMod.F90 @@ -56,7 +56,7 @@ module rmTinyCatchParaMod public Get_MidTime, Time_Interp_Fac public ascat_r0, jpl_canoph, NC_VarID, init_bcs_config - ! The following variables define the details of the BCS version (data sources). + ! The following variables define the details of the BCs versions (data sources). ! Initialize to dummy values here and set to desired values in init_bcs_config(). logical, public, save :: use_PEATMAP = .false. @@ -227,11 +227,11 @@ SUBROUTINE init_bcs_config(LBCSV) jpl_height = .true. case ("v12","v13") - ! "v12" are "v13" are identical except for: - ! - catchment.def land-elevation bug fix: absent in v12; present in v13. - ! - netCDF-4 (NC4) tile-file generation: absent in v12; present in v13. - ! - Coupled-model BC land properties vs AGCM: inconsistency present in v12; fixed in v13. - ! - Coupled atmosphere-ocean-sea ice: v13 uses MOM6/v2 (OM4) ocean bathymetry; v12 v1. + ! v12 are v13 BCs are identical except for the following updates and bug fixes in v13: + ! - Fix for land elevation in catchment.def file. + ! - Generation of netCDF-4 (NC4) tile file (supplemental to ASCII file). + ! - Fix for inconsistency in land tile properties of coupled-model BCs vs. AGCM BCs. + ! - Coupled-model BCs use MOM6/v2 (OM4) ocean bathymetry. LAIBCS = 'MODGEO' SOILBCS = 'HWSD_b' @@ -5514,10 +5514,10 @@ SUBROUTINE svbksb(u,w,v,m,n,b,x) REAL*8 b(m),u(m,n),v(n,n),w(n),x(n) PARAMETER (NMAX=500) !Maximum anticipated value of n !------------------------------------------------------------------------------------------- - ! Solves A "A^" . X = B for a vector X, where A is specified by the arrays u, w, v as returned by - ! svdcmp. m and n are the dimensions of a, and will be equal for square matrices. b(1:m) is - ! the input right-hand side. x(1:n) is the output solution vector. No input quantities are - ! destroyed, so the routine may be called sequentially with different b's. + ! Solves A . X = B for a vector X, where A is specified by the arrays u, w, v as returned by + ! svdcmp. m and n are the dimensions of a, and will be equal for square matrices. b(1:m) is + ! the input right-hand side. x(1:n) is the output solution vector. No input quantities are + ! destroyed, so the routine may be called sequentially with different b values. !------------------------------------------------------------------------------------------- INTEGER i,j,jj @@ -5552,7 +5552,7 @@ SUBROUTINE svdcmp(a,m,n,w,v) PARAMETER (NMAX=500) !Maximum anticipated value of n. !-------------------------------------------------------------------------------------- ! Given a matrix A(1:m,1:n), this routine computes its singular value decomposition, - ! A = U . W . Vt. The matrix U replaces A on output. The diagonal matrix of singular + ! A = U . W . Vt. The matrix U replaces A on output. The diagonal matrix of singular ! values W is output as a vector W(1:n). The matrix V (not the transpose Vt) is output ! as V(1:n,1:n). !--------------------------------------------------------------------------------------