Skip to content

Commit

Permalink
Update cross_phase too
Browse files Browse the repository at this point in the history
  • Loading branch information
Takaya Uchida committed Jun 13, 2022
1 parent 20ecc58 commit 8a38e54
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions xrft/xrft.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ def cross_spectrum(
return cs


def cross_phase(da1, da2, dim=None, true_phase=False, **kwargs):
def cross_phase(da1, da2, dim=None, true_phase=True, **kwargs):
"""
Calculates the cross-phase between da1 and da2.
Expand All @@ -888,15 +888,15 @@ def cross_phase(da1, da2, dim=None, true_phase=False, **kwargs):
The data to be transformed
da2 : `xarray.DataArray`
The data to be transformed
dim : str or sequence of str, optional
The dimensions along which to take the transformation. If `None`, all
dimensions will be transformed.
true_phase : boolean
If True, the phase information is retained.
Set explicitly true_phase = False in cross_spectrum arguments list to ensure future compatibility
with numpy-like behavior where the coordinates are disregarded.
kwargs : dict : see xrft.fft for argument list
"""
if not true_phase:
msg = (
"true_phase flag will be set to True in future version of xrft.fft possibly impacting cross_phase output. "
+ "Set explicitely true_phase = False in cross_spectrum arguments list to ensure future compatibility "
+ "with numpy-like behavior where the coordinates are disregarded."
)
warnings.warn(msg, UserWarning)

cp = xr.ufuncs.angle(
cross_spectrum(da1, da2, dim=dim, true_phase=true_phase, **kwargs)
Expand Down

0 comments on commit 8a38e54

Please sign in to comment.