Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
8b01927
New ocean bathymetry v2 (OM4) is added
sinakhani Aug 28, 2025
6cc2ea7
New ocean bathymetry v2 (OM4) is added
sinakhani Aug 28, 2025
392194c
New ocean bathymetry v2 (OM4) is added
sinakhani Aug 28, 2025
43dc33d
A typo on text is fixed
sinakhani Aug 29, 2025
87de898
MOM6 bathymetry version is added
sinakhani Aug 29, 2025
950b8e6
Updates on v14 bcs
sinakhani Aug 29, 2025
e796d0a
Typo on text is fixed
sinakhani Aug 29, 2025
922e735
Typo on text is fixed
sinakhani Aug 29, 2025
2ed8999
Typo on text is fixed
sinakhani Aug 29, 2025
fb7adc0
More clean-up for mom6 v2 bathymetry
sinakhani Aug 29, 2025
6d6f4bd
More clean-up for mom6 v2 bathymetry
sinakhani Aug 29, 2025
02fe5c7
Merging v12, v13, and v14 bcs cases
sinakhani Aug 29, 2025
d157723
add options so code is more flexiable
biljanaorescanin Sep 11, 2025
185f585
Merge branch 'develop' into skhani/develop
biljanaorescanin Sep 11, 2025
c16644c
refine options
biljanaorescanin Sep 18, 2025
2a6c530
Merge branch 'develop' into skhani/develop
biljanaorescanin Sep 18, 2025
adc768d
cleanup
biljanaorescanin Sep 18, 2025
2dd6fe2
Merge branch 'develop' into skhani/develop
biljanaorescanin Oct 22, 2025
ce3a46b
Merge branch 'develop' into skhani/develop
biljanaorescanin Dec 5, 2025
086cb4e
New ocean grids 720x576 and 2880x2240 for mom6/v2 are added
sinakhani Jan 8, 2026
c7f47fd
New ocean grids 720x576 and 2880x2240 for mom6/v2 are added
sinakhani Jan 8, 2026
b2ca659
Merge branch 'develop' into skhani/develop
sinakhani Jan 8, 2026
f8a3597
New ocean grids 720x576 and 2880x2240 for mom6/v2 are added
sinakhani Jan 8, 2026
92a9f91
New ocean grids 720x576 and 2880x2240 for mom6/v2 are added
sinakhani Jan 8, 2026
6bf328f
disable RUNOFF in DataAtm; let DISCHARGE and CALVING propagate to be …
zhaobin74 Jul 9, 2025
d75ffa3
add remapped friver and licalvf collections and provide DISCHARGE and…
zhaobin74 Jul 10, 2025
d615259
fixed a typo
zhaobin74 Jul 11, 2025
e5a729c
claving causes huge frazil generation at isolated locations near ices…
zhaobin74 Jul 28, 2025
656728a
Fix for gfortran
mathomp4 Nov 21, 2025
cb905bc
Topo docs & cleanup: add README_topo.md; move generate_topo.sh to pre…
biljanaorescanin Oct 3, 2025
7e6fae6
remove example to make it simetric to other file
biljanaorescanin Oct 3, 2025
4fafcfb
fix example
biljanaorescanin Oct 3, 2025
bbbd66e
moved to obsolete
biljanaorescanin Oct 3, 2025
b832814
add more text to readme
biljanaorescanin Oct 3, 2025
4894b0d
update readme
biljanaorescanin Oct 3, 2025
52d257f
update readme again
biljanaorescanin Oct 3, 2025
e03cbec
add to readme and move
biljanaorescanin Oct 8, 2025
9afd2a6
move utils_topo dir to new location
biljanaorescanin Oct 8, 2025
9c3d8b8
add cmake file
biljanaorescanin Oct 8, 2025
6963c04
add dir to build
biljanaorescanin Oct 8, 2025
d5467db
we don't need all this
biljanaorescanin Nov 3, 2025
dcad50c
Fixes #1069. Clean up WW3 Cmake
mathomp4 Mar 5, 2025
74b9a9d
New ocean grids added to mom6/v2
sinakhani Jan 8, 2026
cf890bb
using v13 for this coupled grids bathymetry update
biljanaorescanin Jan 22, 2026
442009d
fix for easy
biljanaorescanin Jan 22, 2026
14adaca
right topo version
biljanaorescanin Jan 22, 2026
f448587
better info message
biljanaorescanin Jan 22, 2026
1fd603e
smarter cleanup
biljanaorescanin Jan 23, 2026
297db4b
code simplification / cleanup
biljanaorescanin Jan 27, 2026
a264bbe
minor updates to comments and white space (make_bcs_questionary.py, m…
gmao-rreichle Jan 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,37 @@
import os
from make_bcs_questionary import *
from make_bcs_shared import *
from datetime import datetime
import subprocess

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 ( {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

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

Expand Down Expand Up @@ -137,6 +159,35 @@ def make_bcs_cube(config):
if not os.path.exists(log_dir):
os.makedirs(log_dir)

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

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(msg)
# -------------------------------------------------------------------

script_template = get_script_head() + cube_template + get_script_mv(config['grid_type'])

script_string = script_template.format(\
Expand Down Expand Up @@ -175,6 +226,8 @@ def make_bcs_cube(config):
STRETCH = STRETCH, \
SGNAME = SGNAME, \
SGPARAM = SGPARAM, \
TOPO_VERSION = TOPO_VERSION,
mom6_bathy_version = MOM6_BATHY_VERSION,
Comment on lines +229 to +230
Copy link
Contributor

@gmao-rreichle gmao-rreichle Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to end these lines with "\"?

IS_STRETCHED = IS_STRETCHED, \
NCPUS = config['NCPUS'])

Expand Down Expand Up @@ -211,6 +264,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)
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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", \
"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)"],
Expand Down Expand Up @@ -320,6 +320,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'],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,53 @@

import os
import glob
import re

# --- 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"},
"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": "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 v13 / 13 / NL3 / etc.
if not m:
return v
key = m.group(0)
# normalize numeric like '13' -> 'v13'
if key.isdigit():
key = 'v' + key
return key
Comment on lines +34 to +43
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this "normalize" function? Don't we always have a 3-char alphanumeric string for "bcs_version"? When would we have "bcs_version=13" (without the leading "v")?


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:
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() :

Expand Down Expand Up @@ -172,12 +219,36 @@ def get_script_mv(grid_type):
echo "Successfully copied CO2_MonthlyMean_DiurnalCycle.nc4 to bcs dir."
endif

# adjust permissions
"""

if grid_type in ("Cubed-Sphere", "Stretched_CS"):
mv_template = mv_template + """

chmod +rX -R geometry land logs
# 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
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

"""

mv_template = mv_template + """

# adjust permissions (for all grid types)
chmod +rX -R geometry land logs

"""
return mv_template

def check_script(expdir, script):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -227,17 +227,17 @@ SUBROUTINE init_bcs_config(LBCSV)
jpl_height = .true.

case ("v12","v13")

! "v12" and "v13" 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
! 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'
MODALB = 'MODIS2'
SNOWALB = 'MODC061v2'
OUTLETV = "v2"
OUTLETV = "v2"
GNU = 1.0
use_PEATMAP = .true.
jpl_height = .true.
Expand Down Expand Up @@ -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 · 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
Expand Down Expand Up @@ -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).
!--------------------------------------------------------------------------------------
Expand Down