How to use the rioxarray.rioxarray._get_nonspatial_coords function in rioxarray

To help you get started, we’ve selected a few rioxarray examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github corteva / rioxarray / rioxarray / merge.py View on Github external
input_kwargs = dict(
        bounds=bounds, res=res, nodata=nodata, precision=precision, method=method
    )
    merged_data, merged_transform = _rio_merge(
        [RasterioDatasetDuck(dataarray) for dataarray in dataarrays],
        **{key: val for key, val in input_kwargs.items() if val is not None},
    )
    merged_shape = merged_data.shape
    representative_array = dataarrays[0]
    if parse_coordinates:
        coords = _make_coords(
            representative_array, merged_transform, merged_shape[-1], merged_shape[-2],
        )
    else:
        coords = _get_nonspatial_coords(representative_array)

    out_attrs = representative_array.attrs
    xda = DataArray(
        name=dataarrays[0].name,
        data=merged_data,
        coords=coords,
        dims=tuple(representative_array.dims),
        attrs=out_attrs,
    )
    out_nodata = nodata if nodata is not None else representative_array.rio.nodata
    xda.rio.write_nodata(out_nodata, inplace=True)
    xda.rio.write_crs(representative_array.rio.crs, inplace=True)
    xda.rio.write_transform(merged_transform, inplace=True)
    return xda