Configuration#

You can configure the default behaviour of GeoUtils at the package level for operations that depend on user preference (such as resampling method, default data structure returned, or behaviour around pixel interpretation).

Changing configuration during a session#

Using a global configuration setting ensures operations will always be performed consistently, even when used under-the-hood by higher-level methods (such as Cosampling used by Statistics within GeoUtils, or Coregistration in other packages like xDEM), without having to rely on multiple keyword arguments to pass to subfunctions.

For example, we can decide to ignore pixel interpretation shifts during raster-point comparisons (see Pixel interpretation):

import geoutils as gu
# Changing default behaviour for pixel interpretation for this session
gu.config["shift_area_or_point"] = False

Or choose the return type for all newly created point clouds (e.g. in to_pointcloud() and interp_at_points()):

gu.config["pointcloud_return_type"] = "geodataframe"

The default is "dataarray". Use "dataset" for an Xarray Dataset, or "geodataframe" for GeoPandas.

Default configuration file#

Below is the default configuration file. Note that changes to gu.config apply only to the current Python session, they do not modify this file!

# Default global parameters for GeoUtils
# See online documentation for more information

[raster]

# Shift by half a pixel for "Point" pixel interpretation during raster-point operations
shift_area_or_point = True

# Raise a warning if two rasters have different pixel interpretation
warn_area_or_point = True

[resampling]

# Default resampling used during reprojection
reprojection_method = bilinear

# Default resampling used during interpolation
interpolation_method = linear

# How missing values are handled during interpolation and gridding
interpolation_nodata_handling = nearest

[pointcloud]

# Return new point clouds as a dataarray, dataset or geodataframe
pointcloud_return_type = dataarray