xdem.dDEM#

class xdem.dDEM(raster, start_time, end_time, error=None)[source]#

A difference-DEM object.

__init__(raster, start_time, end_time, error=None)[source]#

Create a dDEM object from a Raster.

Parameters:
  • raster (Raster) – A georeferenced Raster object.

  • start_time (datetime64) – The starting time of the dDEM.

  • end_time (datetime64) – The end time of the dDEM.

  • error (Optional[Any]) – An error measure for the dDEM (UNUSED).

Returns:

A new dDEM instance.

Methods

__init__(raster, start_time, end_time[, error])

Create a dDEM object from a Raster.

astype(dtype[, inplace])

Convert data type of the raster.

coords([offset, grid])

Get coordinates (x,y) of all pixels in the raster.

copy([new_array])

Return a copy of the DEM.

crop(crop_geom[, mode, inplace])

Crop the raster to a given extent.

from_array(data, transform, crs, start_time, ...)

Create a new dDEM object from an array.

georeferenced_grid_equal(raster)

Check that raster shape, geotransform and CRS are equal.

get_bounds_projected(out_crs[, densify_pts])

Get raster bounds projected in a specified CRS.

get_footprint_projected(out_crs[, densify_pts])

Get raster footprint projected in a specified CRS.

get_metric_crs([local_crs_type, method])

Get local metric coordinate reference system for the raster (UTM, UPS, or custom Mercator or Polar).

get_nanarray([return_mask])

Get NaN array from the raster.

ij2xy(i, j[, offset])

Get coordinates (x,y) of indexes (row,column).

info([stats])

Summarize information about the raster.

interp_points(pts[, input_latlon, mode, ...])

Interpolate raster values at a set of points.

interpolate([method, reference_elevation, mask])

Interpolate the dDEM using the given method.

intersection(rst[, match_ref])

Returns the bounding box of intersection between this image and another.

load([indexes])

Load the raster array from disk.

outside_image(xi, yj[, index])

Check whether a given point falls outside the raster.

polygonize([target_values])

Polygonize the raster into a vector.

proximity([vector, target_values, ...])

Compute proximity distances to the raster target pixels, or to a vector geometry on the raster grid.

raster_equal(other)

Check if two rasters are equal.

reproject([dst_ref, dst_crs, dst_size, ...])

Reproject raster to a different geotransform (resolution, bounds) and/or coordinate reference system (CRS).

save(filename[, driver, dtype, nodata, ...])

Write the raster to file.

set_mask(mask)

Set a mask on the raster array.

set_nodata(new_nodata[, update_array, ...])

Set a new nodata value for all bands.

shift(xoff, yoff[, distance_unit])

Shift the raster by a (x,y) offset.

show([index, cmap, vmin, vmax, alpha, ...])

Plot the raster, with axes in projection of image.

split_bands([copy, subset])

Split the bands into separate rasters.

subsample(subsample[, return_indices, ...])

Randomly subsample the raster.

to_points([subset, as_array, pixel_offset])

Convert raster to points.

to_rio_dataset()

Export to a Rasterio in-memory dataset.

to_xarray([name])

Convert raster to a xarray.DataArray.

value_at_coords(x, y[, latlon, index, ...])

Extract raster values at the nearest pixels from the specified coordinates, or reduced (e.g., mean of pixels) from a window around the specified coordinates.

xy2ij(x, y[, op, precision, shift_area_or_point])

Get indexes (row,column) of coordinates (x,y).

Attributes

bounds

Bounding coordinates of the raster.

count

Count of bands loaded in memory if they are, otherwise the one on disk.

count_on_disk

Count of bands on disk if it exists.

crs

Coordinate reference system of the raster.

data

Array of the raster.

driver

Driver used to read a file on disk.

dtypes

Data type for each raster band (string representation).

fill_method

Return the fill method used for the filled_data.

filled_data

Get the filled data array if it exists, or else the original data if it has no nans.

height

Height of the raster in pixels.

indexes

Indexes of bands loaded in memory if they are, otherwise on disk.

indexes_on_disk

Indexes of bands on disk if it exists.

is_loaded

Whether the raster array is loaded.

is_modified

Whether the array has been modified since it was loaded from disk.

name

Name of the file on disk, if it exists.

nodata

Nodata value of the raster.

res

Resolution (X, Y) of the raster in georeferenced units.

shape

Shape (i.e., height, width) of the raster in pixels.

time

Get the time duration.

transform

Geotransform of the raster.

width

Width of the raster in pixels.