@@ -402,6 +402,14 @@ def load(self):
402402
403403 self .setup_coordinates ()
404404
405+ @staticmethod
406+ def get_mask (a ):
407+ if len (a .mask .shape ):
408+ m = a .mask
409+ else :
410+ m = ones (a .shape , dtype = 'bool' ) if a .mask else zeros (a .shape , dtype = 'bool' )
411+ return m
412+
405413 @staticmethod
406414 def c_to_bounds (c ):
407415 """
@@ -1126,7 +1134,7 @@ def _low_filter(self, grid_name, w_cut, factor=8.0):
11261134 bins = (x_array , y_array )
11271135
11281136 x_flat , y_flat , z_flat = x .reshape ((- 1 ,)), y .reshape ((- 1 ,)), data .reshape ((- 1 ,))
1129- m = ~ z_flat . mask
1137+ m = ~ self . get_mask ( z_flat )
11301138 x_flat , y_flat , z_flat = x_flat [m ], y_flat [m ], z_flat [m ]
11311139
11321140 nb_value , _ , _ = histogram2d (x_flat , y_flat , bins = bins )
@@ -1936,14 +1944,6 @@ def regrid(self, other, grid_name, new_name=None):
19361944 # self.variables_description[new_name]['infos'] = False
19371945 # self.variables_description[new_name]['kwargs']['dimensions'] = ...
19381946
1939- @staticmethod
1940- def get_mask (a ):
1941- if len (a .mask .shape ):
1942- m = a .mask
1943- else :
1944- m = ones (a .shape ) if a .mask else zeros (a .shape )
1945- return m
1946-
19471947 def interp (self , grid_name , lons , lats , method = "bilinear" ):
19481948 """
19491949 Compute z over lons, lats
0 commit comments