@@ -437,10 +437,12 @@ def test_xesmf_weight_cache_key_includes_mask_bounds_method_and_versions(tmp_pat
437437 target = xr .Dataset (coords = {"lat" : [0.0 , 1.0 ], "lon" : [10.0 , 11.0 ]})
438438
439439 base = xesmf_cache ._cache_path (source , target , "conservative" , cache_dir = tmp_path , periodic = False )
440- changed_mask = source .copy (deep = True )
441- changed_mask ["mask" ].values [0 , 0 ] = 0
442- changed_bounds = source .copy (deep = True )
443- changed_bounds ["lat_vertices" ].values [0 ] = - 1.0
440+ mask = source ["mask" ].to_numpy ().copy ()
441+ mask [0 , 0 ] = 0
442+ changed_mask = source .assign (mask = (source ["mask" ].dims , mask ))
443+ bounds = source ["lat_vertices" ].to_numpy ().copy ()
444+ bounds [0 ] = - 1.0
445+ changed_bounds = source .assign_coords (lat_vertices = ("lat_vertices" , bounds ))
444446
445447 assert xesmf_cache ._cache_path (changed_mask , target , "conservative" , cache_dir = tmp_path , periodic = False ) != base
446448 assert xesmf_cache ._cache_path (changed_bounds , target , "conservative" , cache_dir = tmp_path , periodic = False ) != base
@@ -461,8 +463,9 @@ def test_xesmf_weight_cache_key_recognizes_cf_units(tmp_path, monkeypatch):
461463 "yc" : (("y" , "x" ), [[0.0 , 0.0 ], [1.0 , 1.0 ]], {"units" : "degrees_north" }),
462464 }
463465 )
464- changed = source .copy (deep = True )
465- changed ["xc" ].values [0 , 0 ] = 9.0
466+ xc = source ["xc" ].to_numpy ().copy ()
467+ xc [0 , 0 ] = 9.0
468+ changed = source .assign_coords (xc = source ["xc" ].copy (data = xc ))
466469
467470 assert xesmf_cache ._cache_path (
468471 source , source , "conservative" , cache_dir = tmp_path , periodic = False
0 commit comments