Skip to content

Commit

Permalink
Suppress annoying Dask warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyPechnikov committed Aug 18, 2023
1 parent 1912dd6 commit b034a3e
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions pygmtsar/pygmtsar/PRM.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,9 @@ def intf(self, other, basedir, topo_fromfile, basename=None, wavelength=200, psi
import numpy as np
import xarray as xr
import dask.array
import warnings
# suppress Dask warning "RuntimeWarning: divide by zero encountered in divide"
warnings.filterwarnings("ignore", category=RuntimeWarning, module="dask.core")

if not isinstance(other, PRM):
raise Exception('Argument "other" should be PRM class instance')
Expand All @@ -980,15 +983,6 @@ def intf(self, other, basedir, topo_fromfile, basename=None, wavelength=200, psi
# make full file name, use workaround for 'weight' argument name defined without extension
fullname = lambda name: os.path.join(basedir, basename + name if name[-4:]=='.grd' else f'{subswath}_{name}.grd')

# # weight can be None, xarray dataarray, NetCDF file name
# if weight is not None and isinstance(weight, str):
# if debug:
# print (f'DEBUG: intf weight from file {weight}')
# weight = xr.open_dataarray(fullname(weight), engine=self.engine, chunks=chunksize)
# # revert fake dimension names
# if weight.dims == ('a', 'r'):
# weight = weight.rename({'a': 'y', 'r': 'x'})

# prepare PRMs for the calculation below
other.set(self.SAT_baseline(other, tail=9))
self.set(self.SAT_baseline(self).sel('SC_height','SC_height_start','SC_height_end'))
Expand Down

0 comments on commit b034a3e

Please sign in to comment.