Skip to content

generate square grid SCRIP files for coupling FastIsostasy to MALI#740

Draft
hollyhan wants to merge 2 commits into
MPAS-Dev:masterfrom
hollyhan:landice/fastisostasy-scripfile-tool
Draft

generate square grid SCRIP files for coupling FastIsostasy to MALI#740
hollyhan wants to merge 2 commits into
MPAS-Dev:masterfrom
hollyhan:landice/fastisostasy-scripfile-tool

Conversation

@hollyhan

@hollyhan hollyhan commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Add Python script to create square grid SCRIP files for
FastIsostasy MALI coupling

Summary

  • Add create_square_grid_scripfile.py tool to generate
    SCRIP-format files for FastIsostasy coupling
  • FastIsostasy requires a perfect square grid (nx × nx)
    for bedrock deformation coupling
  • Script reads MALI mesh SCRIP file, extracts domain
    bounds, and creates a square regular lat-lon grid
  • Enables users to generate mapping weight files with
    ESMF_RegridWeightGen

Motivation

FastIsostasy coupling in MALI requires two mapping weight
files:

  • mpas_to_fastisostasy.nc (MALI mesh → square grid)
  • fastisostasy_to_mpas.nc (square grid → MALI mesh)

The target grid must be a perfect square (code checks `nX

  • nX = nGridinmpas_li_bedtopo.F:1021-1027`). This
    script automates the creation of the required square grid
    SCRIP file.

Changes

  • New file: create_square_grid_scripfile.py
    • Reads MALI SCRIP file to determine domain extent
    • Creates nx × nx square grid with proper SCRIP format
    • Supports optional padding around domain
    • Includes usage documentation and example workflow

Usage Example

# Create 512×512 square grid for FastIsostasy
python create_square_grid_scripfile.py \
    --mali_scripfile mali_mesh.scripfile.nc \
    --nx 512 \
    --output fastisostasy_512x512.scripfile.nc

# Generate mapping weights with ESMF
ESMF_RegridWeightGen -s mali_mesh.scripfile.nc -d
fastisostasy_512x512.scripfile.nc \
    -w mpas_to_fastisostasy.nc -i --64bit_offset
--src_regional


Grid comparison:

┌─────┬──────────────┬──────────┬─────────────────────┐
│ nx  │     Lat      │  Memory  │      Use case       │
│     │  resolution  │          │                     │
├─────┼──────────────┼──────────┼─────────────────────┤
│ 128 │ ~24 km       │ Small    │ Quick testing       │
├─────┼──────────────┼──────────┼─────────────────────┤
│ 150 │ ~20 km       │ Small    │ Testing             │
├─────┼──────────────┼──────────┼─────────────────────┤
│ 256 │ ~12 km       │ Medium   │ Moderate runs       │
├─────┼──────────────┼──────────┼─────────────────────┤
│ 384 │ ~8 km        │ Large    │ Production          │
│     │              │          │ (stability limit)   │
├─────┼──────────────┼──────────┼─────────────────────┤
│ 512 │ ~6 km        │ Very     │ Too fine (unstable) │
│     │              │ large    │                     │
└─────┴──────────────┴──────────┴─────────────────────┘

Test Plan

- [ ] Run script on example MALI mesh SCRIP file
- [ ] Verify output SCRIP file has correct dimensions (nx
= ny)
- [ ] Generate weight files with ESMF_RegridWeightGen
- [ ] Test weight files in MALI run with
config_uplift_method='fastisostasy'

🤖 Generated with Claude Code

@hollyhan
hollyhan marked this pull request as draft July 17, 2026 19:20
@hollyhan
hollyhan requested a review from matthewhoffman July 17, 2026 19:21
@hollyhan

Copy link
Copy Markdown
Contributor Author

Hi @matthewhoffman,

This PR ready to be reviewed.

A sample test run result is shown below:

(e3sm-unified) hollyhan@login40:/pscratch/sd/h/hollyhan> python ~/scripfile_for_fastisostasy/create_square_grid_scripfile.py --mali_scripfile ~/scripfile_for_fastisostasy/relaxed_10yrs_4km.nc.scripfile --nx 384 --output fastisostasy_384x384.scripfile.nc
Reading MALI scripfile: /global/homes/h/hollyhan/scripfile_for_fastisostasy/relaxed_10yrs_4km.nc.scripfile
  Domain: lat [-89.93, -62.82]°
          lon [0.00, 360.00]°
  Longitude convention: [0, 360]
Creating 384x384 square grid:
  Resolution: dlat=0.0708°, dlon=0.9399°
  Total cells: 147456
Writing SCRIP file: fastisostasy_384x384.scripfile.nc
SUCCESS: Created fastisostasy_384x384.scripfile.nc

Next steps:
1. Generate weight files with ESMF_RegridWeightGen:
   # MALI to FastIsostasy
   ESMF_RegridWeightGen -s /global/homes/h/hollyhan/scripfile_for_fastisostasy/relaxed_10yrs_4km.nc.scripfile -d fastisostasy_384x384.scripfile.nc \
       -w mpas_to_fastisostasy.nc -i --64bit_offset --src_regional --dst_regional
   # FastIsostasy to MALI
   ESMF_RegridWeightGen -s fastisostasy_384x384.scripfile.nc -d /global/homes/h/hollyhan/scripfile_for_fastisostasy/relaxed_10yrs_4km.nc.scripfile \
       -w fastisostasy_to_mpas.nc -i --64bit_offset --src_regional --dst_regional

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant