Skip to content

Conversation

@xylar
Copy link
Collaborator

@xylar xylar commented Jan 29, 2026

This merge applies the latest linting tools to mpas_tools.landice.interpolate.

Then, it fixes a print statement that was incorrectly copied over from the original script:

print(' Input layer {}, layer {} min/max: {} {}'.format(z, InputFieldName, InputField[:,z].min(), InputField[:,z].max()))

@xylar
Copy link
Collaborator Author

xylar commented Jan 29, 2026

@andrewdnolan, let me know if this works for you. I'll ask @trhille to review, but only after we know that it actually fixes the problem you had.

Comment on lines +465 to +466
f'{InputField[:, z].min()} {InputField[:, z].max()}'
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the only non-linting change in this PR.

Copy link
Collaborator

@trhille trhille left a comment

Choose a reason for hiding this comment

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

I tested this by creating a new Thwaites mesh using the default settings in mesh_gen.cfg, and then interpolated all fields from a previous optimized Thwaites mesh (interpolate_to_mpasli_grid -s /global/cfs/cdirs/fanssie/MALI_input_files/Thwaites_1to4km_r04/Thwaites_1to4km_r04_20250127.nc -d Thwaites.nc -m d). The print-outs for the 3D fields are correct:

## temperature ##
    ---- Interpolating time level 0 ----
  Using layer centers for the vertical coordinate of this field.
  Input layer 0, layer temperature min/max: 241.41179677598365 263.4898178707812
  ...Layer 0, Interpolating this layer to MPAS grid using built-in barycentric method...
  interpolated MPAS temperature, layer 0 min/max: 241.4693528651369 263.46292387664624
  Input layer 1, layer temperature min/max: 241.47488921045857 266.4047522034457
  ...Layer 1, Interpolating this layer to MPAS grid using built-in barycentric method...
  interpolated MPAS temperature, layer 1 min/max: 241.54983449344206 265.7005597930205
  Input layer 2, layer temperature min/max: 241.60280018996139 268.77289504790343
  ...Layer 2, Interpolating this layer to MPAS grid using built-in barycentric method...
  interpolated MPAS temperature, layer 2 min/max: 241.72883783988996 268.0380455487133
  Input layer 3, layer temperature min/max: 241.9699879796031 270.25775535505795
  ...Layer 3, Interpolating this layer to MPAS grid using built-in barycentric method...
  interpolated MPAS temperature, layer 3 min/max: 242.25711756180596 269.77152456380367
  Input layer 4, layer temperature min/max: 241.9213221418217 271.2944617092036
  ...Layer 4, Interpolating this layer to MPAS grid using built-in barycentric method...
  interpolated MPAS temperature, layer 4 min/max: 242.99108604353358 270.9689606201567
  Input layer 5, layer temperature min/max: 241.77675015641108 271.9431498528645
  ...Layer 5, Interpolating this layer to MPAS grid using built-in barycentric method...
  interpolated MPAS temperature, layer 5 min/max: 242.953669846482 271.743186272462
  Input layer 6, layer temperature min/max: 241.66053993303544 272.30730503882705
  ...Layer 6, Interpolating this layer to MPAS grid using built-in barycentric method...
  interpolated MPAS temperature, layer 6 min/max: 242.92657440594814 272.18251983560543
  Input layer 7, layer temperature min/max: 241.56316857654912 272.6256482905611
  ...Layer 7, Interpolating this layer to MPAS grid using built-in barycentric method...
  interpolated MPAS temperature, layer 7 min/max: 242.9057428223344 272.36337747442184
  Input layer 8, layer temperature min/max: 241.4783677377676 272.8191295575475
  ...Layer 8, Interpolating this layer to MPAS grid using built-in barycentric method...
  interpolated MPAS temperature, layer 8 min/max: 242.88865778700685 272.519402616403
  Input layer 9, layer temperature min/max: 241.40189332332608 272.8944958249406
  ...Layer 9, Interpolating this layer to MPAS grid using built-in barycentric method...
  interpolated MPAS temperature, layer 9 min/max: 242.87371628313343 272.7076423759683
  Input layer field nCells has layers: [0.11570248 0.31940618 0.47589305 0.59871996 0.69690098 0.77662037
 0.84223616 0.89689151 0.94289981 0.98199446]
  MPAS layer centers are: [0.11570248 0.31940618 0.47589305 0.59871996 0.69690098 0.77662037
 0.84223616 0.89689151 0.94289981 0.98199446]
  MPAS temperature on MPAS vertical layers, min/max of all layers: 241.4693528651369, 272.7076423759683
  interpolation done in 0.05921252002008259

@andrewdnolan
Copy link
Collaborator

@xylar Yes, the corrected print statements fixes the error I was running into.

@xylar xylar merged commit 5507780 into MPAS-Dev:master Jan 29, 2026
6 checks passed
@xylar xylar deleted the fix-print-in-mali-interpolate branch January 29, 2026 18:10
@xylar
Copy link
Collaborator Author

xylar commented Jan 29, 2026

@andrewdnolan and @trhille, thanks to you both for testing. Sorry about that typo!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants