-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2dbe57
commit 241c4d9
Showing
26 changed files
with
669 additions
and
1,025 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Extract the data as a JAX array | ||
if isinstance(self.obj, xr.DataArray): | ||
data = self.obj.data | ||
elif isinstance(self.obj, xr.Dataset): | ||
# Handle Dataset by applying rolling to each DataArray within | ||
rolled_data = {} | ||
for var in self.obj.data_vars: | ||
rolled = self.reduce( | ||
self.obj[var], | ||
dim=self.dim, | ||
window=self.window, | ||
func=func, | ||
**kwargs | ||
) | ||
rolled_data[var] = rolled | ||
return xr.Dataset(rolled_data, coords=self.obj.coords) | ||
else: | ||
raise TypeError("Unsupported xarray object type.") | ||
|
||
# Apply the u_roll method from TimeSeriesOps | ||
rolled_array = TimeSeriesOps.u_roll( | ||
data=data, | ||
window_size=self.window, | ||
func=func, | ||
overlap_factor=kwargs.get('overlap_factor', None) | ||
) | ||
|
||
# Create a new xarray object with the rolled data | ||
rolled_obj = self.obj.copy(data=rolled_array) | ||
|
Oops, something went wrong.