xarray_misc

File Purpose: misc. tools related to xarray

Functions

xarray_as_array(array)

return array if DataArray, else array[var] if array is Dataset with one var.

xarray_astypes(ds, var_to_dtype)

return copy of ds with var.astype(dtype) for each var, dtype in var_to_dtype.items()

xarray_convert_types(array, oldtype_to_newtype)

return copy of array or dataset, using var.astype(newtype) for any var with oldtype,

xarray_copy_kw(array[, dims, name, ...])

return dict of info suitable for creating a similar array or dataset.

xarray_dtype_object_to_str(array)

convert array with dtype=object to dtype=str, by doing str(x) for every x in array.

xarray_merge(arrays, *[, ngroup, verbose, ...])

xr.merge() these xarray objects (probably DataArrays or Datasets),

xarray_merge_from(array, other_arrays, *[, ...])

xr.merge() this xarray object (DataArray or Dataset) with other xarray objects.

xarray_object_coords_to_str(array, *[, ...])

return copy of array with coords (of dtype=object) converted to string.

xarray_update_call_history(ds, local_vars, func)

Add a history entry to a dataset.

xarray_vars_lookup(ds[, lookup])

return dict of {key from lookup: ds[lookup[key]]}

xarray_vars_lookup_with_defaults(ds, provided)

return dict of {key from lookup: value for that key}.

xarray_where_finite(array)

returns array, masked with NaNs anywhere that the values are not finite.

xarray_with_data(xarray, data[, dims, name])

return data as an xr.DataArray with dims, coords, name, and attrs copied from xarray.