Skip to content

Loading old weights file for Mesh to Grid regridding fails with unexpected error #475

Open
@hdyson

Description

@hdyson

🐛 Bug Report

We're upgrading UG-ANTS to use the latest version of numerous packages, including moving from iris-esmf-regrid 0.9 to 0.11. One of our unittests for loading a regridding weights file is unexpectedly failing. Further investigation shows that iris-esmf-regrid 0.11 cannot load a weights file created with 0.9. Comments in the code suggest that this should be supported behaviour.

How To Reproduce

Steps to reproduce the behaviour:

  1. Get example file by checking out UG-ANTS trunk at 18117 (i.e. fcm co fcm:ancil_ugants.xm_tr@18117).
  2. Activate a conda environment containing iris-esmf-regrid 0.11
Python 3.12.9 | packaged by conda-forge | (main, Mar  4 2025, 22:48:41) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from esmf_regrid.experimental.io import load_regridder
>>> weights_path = 'lib/ugants/tests/resources/mesh_to_grid_output_weights_C4_to_n96.nc'
>>> load_regridder(weights_path)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<path removed>/lib/python3.12/site-packages/esmf_regrid/experimental/io.py", line 309, in load_regridder
    method = getattr(
             ^^^^^^^^
AttributeError: type object 'Method' has no attribute 'conservative'

Expected behaviour

I'd expect the weights file to be loaded.

Environment

  • OS and version: RHEL 9.5
  • esmf_regrid version: 0.11

Additional context

I'm surprised that this is not triggering a test failure within iris-esmf-regrid?

I think the fix is that this line needs a .upper().

Metadata

Metadata

Assignees

No one assigned

    Labels

    New: IssueHighlight a new community raised "generic" issueType: Bug

    Type

    No type

    Projects

    • Status

      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions