Skip to content

Commit

Permalink
update how methods are added to xr.da
Browse files Browse the repository at this point in the history
Update add_methids_to_xarrays so that it can work through a list of methods adding each one
  • Loading branch information
jkingslake committed Aug 30, 2024
1 parent 712bc28 commit 3435a56
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions xapres/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,11 @@ def generate_xarray(directory=None,

def add_methods_to_xarrays():




methods = [dB, sonify, displacement_timeseries, compute_displacement]


# add db function as new bound method of DataArrays
xr.DataArray.dB = dB

# add the sonify function as a bound method of DataArrays
xr.DataArray.sonify = sonify

# add the displacement_timeseries_NB function as a bound method of DataArrays
xr.DataArray.displacement_timeseries = displacement_timeseries

# add the compute_displacement function as a bound method of Datasets
xr.DataArray.compute_displacement = compute_displacement


for method in methods:
setattr(xr.DataArray, method.__name__, method)


class from_dats():
"""
Expand Down

0 comments on commit 3435a56

Please sign in to comment.