Skip to content

Instantly share code, notes, and snippets.

@dgergel
Created February 25, 2016 18:02
Show Gist options
  • Save dgergel/4d471e6900ac9699e275 to your computer and use it in GitHub Desktop.
Save dgergel/4d471e6900ac9699e275 to your computer and use it in GitHub Desktop.
A few small functions:
def slice_dataset_space(ds_array, ds_to_slice):
'''
slices second Dataset to fit first Dataset
'''
swe_mask_align, array_align = xray.align(ds_array, ds_to_slice, join='inner', copy=False)
return(array_align)
def slice_dataset_time(ds, start_time, end_time):
'''
slices dataset with start and end times
'''
ds_timeslice = ds.sel(time=slice(start_time, end_time))
return(ds_timeslice)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment