xarray_helpers module

HSTB.kluster.xarray_helpers Module

Functions

clear_data_vars_from_dataset(dataset, datavars)

Some code to handle dropping data variables from xarray Datasets in different containers.

combine_arrays_to_dataset(arrs, arrnames)

Build a dataset from a list of Xarray DataArrays, given a list of names for each array.

combine_xr_attributes(datasets)

xarray open_mfdataset only retains the attributes of the first dataset.

compare_and_find_gaps(source_dat, new_dat[, ...])

So far, mostly used with Applanix POSPac SBETs.

divide_arrays_by_time_index(arrs, idx)

Simple method for indexing a list of arrays

fix_xarray_dataset_index(xarr[, index_dim])

Operations with xarray datasets require that the index is monotonic increasing and unique.

get_beamwise_interpolation(pingtime, ...)

Given ping time and beamwise time addition (delay), return a 2d interpolated version of the provided 1d Dataarray.

interp_across_chunks(xarr, new_times[, ...])

Takes in xarr and interpolates to new_times.

my_open_mfdataset(paths[, chnks, ...])

Trying to address the limitations of the existing xr.open_mfdataset function.

reform_nan_array(dataarray_stack, orig_idx, ...)

To handle NaN values in our input arrays, we flatten and index only the valid values.

reload_zarr_records(pth[, skip_dask, sort_by])

After writing new data to the zarr data store, you need to refresh the xarray Dataset object so that it sees the changes.

resize_zarr(zarrpth[, finaltimelength])

Takes in the path to a zarr group and resizes the time dimension according to the provided finaltimelength

return_chunk_slices(xarr)

Xarray objects are chunked for easy parallelism.

slice_xarray_by_dim(arr[, dimname, ...])

Slice the input xarray dataset/dataarray by provided start_time and end_time.

stack_nan_array(dataarray[, stack_dims])

To handle NaN values in our input arrays, we flatten and index only the valid values.

xarr_to_netcdf(xarr, pth, fname[, attrs, idx])

Takes in an xarray Dataset and pushes it to netcdf.

xarr_to_zarr(xarr, outputpth[, attrs])

Takes in an xarray Dataset and pushes it to zarr store.