Skip to content

Commit

Permalink
NamedTuple fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenworsley committed Nov 19, 2024
1 parent 4a56d2c commit cf3c954
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions esmf_regrid/schemes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Provides an iris interface for regridding."""

import copy
from typing import NamedTuple
from typing import Any, NamedTuple

from cf_units import Unit
import dask.array as da
Expand Down Expand Up @@ -440,7 +440,9 @@ def _create_cube(data, src_cube, src_dims, tgt_coords, num_tgt_dims):
grid_y_dim = src_dims[0]
grid_x_dim = grid_y_dim + 1
else:
e_msg = f"Source grid must be described by 1 or 2 dimensions, got {len(src_dims)}"
e_msg = (
f"Source grid must be described by 1 or 2 dimensions, got {len(src_dims)}"
)
raise ValueError(e_msg)
if num_tgt_dims == 1:
grid_y_dim = grid_x_dim = min(src_dims)
Expand Down Expand Up @@ -474,13 +476,17 @@ def copy_coords(src_coords, add_method):

class RegridInfo(NamedTuple):
dims: int
target: any
regridder: any
target: Any
regridder: Any


class GridRecord(NamedTuple):
grid_x: any
grid_y: any
grid_x: Any
grid_y: Any


class MeshRecord(NamedTuple):
mesh: any
mesh: Any
location: str


Expand Down Expand Up @@ -769,7 +775,7 @@ def _regrid_rectilinear_to_unstructured__perform(src_cube, regrid_info, mdtol):
elif location == "node":
chunk_shape = mesh.node_coords[0].shape
else:
e_msg =f"Unrecognised location {location}."
e_msg = f"Unrecognised location {location}."
raise NotImplementedError(e_msg)

out_dtype = regridder._out_dtype(src_cube.dtype)
Expand Down

0 comments on commit cf3c954

Please sign in to comment.