88from pathlib import Path
99from typing import List , Optional , Union
1010
11- import numpy as np
11+ import numpy
1212import xarray
1313import xarray .testing
1414from xarray import DataArray
@@ -113,7 +113,7 @@ def _ascii_art(
113113 bottom = "\n └" + "─" * coarsened .sizes ["x" ] + "┘"
114114
115115 def _pixel_char (v ) -> str :
116- i = 0 if np .isnan (v ) else int (v * max_grayscale_idx / data_max )
116+ i = 0 if numpy .isnan (v ) else int (v * max_grayscale_idx / data_max )
117117 if v > 0 and i == 0 :
118118 i = 1 # don't show a blank for a difference above the threshold
119119 else :
@@ -149,7 +149,7 @@ def _compare_xarray_dataarray_xy(
149149 value_mapping = dict (map (lambda d : (d , expected_as_float [d ].data ), non_x_y_dims ))
150150 shape = tuple ([len (value_mapping [x ]) for x in non_x_y_dims ])
151151
152- for shape_index , v in np .ndenumerate (np .ndarray (shape )):
152+ for shape_index , v in numpy .ndenumerate (numpy .ndarray (shape )):
153153 indexers = {}
154154 for index , value_index in enumerate (shape_index ):
155155 indexers [non_x_y_dims [index ]] = value_mapping [non_x_y_dims [index ]][value_index ]
@@ -170,7 +170,7 @@ def _compare_xarray_dataarray_xy(
170170
171171 _log .warning (f"Difference (ascii art) for { key } :\n { _ascii_art (diff_data )} " )
172172
173- coord_grid = np .meshgrid (diff_data .coords ["x" ], diff_data .coords ["y" ])
173+ coord_grid = numpy .meshgrid (diff_data .coords ["x" ], diff_data .coords ["y" ])
174174 mask = diff_data .notnull ()
175175 if mask .dims [0 ] != "y" :
176176 mask = mask .transpose ()
0 commit comments