Skip to content

Releases: natcap/pygeoprocessing

2.3.3

27 Jan 17:13
e0e0a2c
Compare
Choose a tag to compare

2.3.3 (2022-01-26)

  • Fixing a bug in shapely_geometry_to_vector where a feature name mismatch
    between the fields and attribute_list inputs would silently pass
    under most circumstances. Now an informative ValueError is raised.
  • Testing against Python 3.10.
  • Pinned numpy versions in pyproject.toml to the lowest compatible
    version for each supported python version. This prevents issues when
    pygeoprocessing is used in an environment with a lower numpy version
    than it was built with (cython/cython#4452).

2.3.2

08 Sep 18:20
625b8ff
Compare
Choose a tag to compare

2.3.2 (2021-09-08)

  • Restore functionality in reclassify_raster that allows for nodata
    values to be reclassified. This was accidentally removed in 2.3.1.

2.3.1

24 Aug 17:15
89b53ab
Compare
Choose a tag to compare

2.3.1 (2021-08-24)

  • Slightly change the error message displayed for a
    ReclassificationMissingValuesError.
  • Handle float nodata values correctly in reclassify_raster.
  • Fix a bug in distance_to_channel_mfd where pixels that only partially
    drained to a stream were given incorrect distances.
  • Fixed an issue with raster_band_percentile that would raise an
    exception if an input raster had an undefined nodata value and/or
    would cause an invalid result if the raster contained non-finite
    values.
  • After many years with the Natural Capital Project, Rich Sharp has stepped
    down from the Project and as the maintainer of pygeoprocessing. James
    Douglass is taking his place, and this change is now reflected in
    setup.py.

2.3.0

02 Jul 22:58
444515e
Compare
Choose a tag to compare

2.3.0 (2021-06-21)

  • Added a single_outlet_tuple parameter to routing.fill_pits that
    forces a DEM to only have one outlet at any point on the raster. The
    fill effect is that all pixels will drain to the raster coordinate at
    single_outlet_tuple.
  • Added a detect_lowest_sink_and_drain function that finds the lowest
    DEM pixel that drains to nodata/edge and the lowest DEM pixel that could
    be a sink. The values that result from this call can be used to condition
    a DEM that is known to have a single drain using the
    single_outlet_tuple parameter in routing.fill_pits.
  • Fixed a bug in routing.fill_pits that could cause the nodata region of
    a DEM to be incorrectly filled with non-nodata values.
  • Fixed an issue where create_raster_from_vector_extent would use an
    approximation of the layer extent to infer the input vector extent. Now
    uses the individual geometry to infer vector extents.
  • Fixed a bug in routing.distance_to_channel_mfd where pixels that drained
    off the edge of the raster had negative values rather than nodata values.
  • Expanded the error message raised by transform_bounding_box when the
    bounding box cannot be transformed to provide more helpful details.
  • Add support and testing for GDAL 3.3.0.
  • Fixed exception occuring in stitch_rasters when base rasters were
    larger than the target raster on the y axis.

2.2.0

14 May 22:26
73aff1a
Compare
Choose a tag to compare

2.2.0 (2020-05-14)

  • Adding explicit support for Python 3.9 and testing on Python 3.9.
  • Fixed an issue in create_raster_from_vector_extents that would cause a
    confusing exception to be raised if there was no geometry in the vector.
    Now raises a ValueError with a helpful error message.
  • Changed parameters in convolve_2d to allow API to set
    ignore_nodata_and_edges=True while mask_nodata=False and updated
    docstring to indicate this is useful in cases such as filling nodata holes
    in missing datasets. Additionally added a logger debug message to note
    this "unusual" setting of these parameters in case of accidental usage
    which could be noted during development.
  • Fixed issue in zonal statistics that could cause the aggregate vector to be
    locked due to a dereferencing race condition. This was present in some
    cases with a flaky unit test but could have been seen in practice if the
    vector was deleted immediately after the call to zonal_statistics.
  • Fixed issue in routing.fill_pits that used a numerical "is close" test
    when determining if two pixels were at equal height. In the case of
    hydrological pitfilling, pixels must be exactly equal height to be
    considered a plateau otherwise a drain into or out of the pixel is
    resolved. Testing is close allowed a hydrological pit to remain since it
    was "close" to the same height as a draining pixel.
  • Added a D8 Strahler order stream extraction function at
    pygeoprocessing.extract_strahler_streams_d8. Creates segmented
    geometric lines which correspond to streams on the landscape.
  • Added a D8 subwatershed calculation function at
    pygeoprocessing.calculate_subwatershed_boundary. Creates subwatersheds
    that are segmented at the junctions of the streams created by
    pygeoprocessing.extract_strahler_streams_d8.
  • Removing all instances of __swig_destroy__ to prevent multiprocessing
    memory corruption.
  • Exposing a use_shared_memory flag on raster_calculator to allow
    a user to use shared memory objects when calculating statistics. This
    feature is only available for Python >= 3.8. If available, this
    feature creates a significant runtime improvement but can be unstable
    in multiprocessing configurations. For this reason it is set to
    False as the default value.
  • Added a max_timeout parameter to convolve_2d and
    raster_calculator to allow the user to specify the maximum amount of
    time to wait for worker threads to terminate. In normal operation these
    threads should terminate in a short amount of time but are generously
    timed with the pygeoprocessing._MAX_TIMEOUT parameter. This parameter
    allows a user to tune in cases that may involve significant latency such
    as in a heavy multiprocess environment.
  • Added a pygeoprocessing.routing.detect_outlets function that creates a
    vector with points placed on the center of the pixels in a D8 or MFD flow
    direction raster that are outlet pixels. The vector has additional metadata
    about the (i, j) locations of the pixel in raster coordinate space.
  • Replacing merge_rasters with stitch_rasters that can take an
    arbitrary list of raster path bands and stitch them into an existing raster
    of same or different projection. Additional functionality to preserve
    area variant values when stitching from a linear meters projection to
    WGS84. Useful when the units of the base raster are in "units per pixel"
    rather than "units per area".
  • Added a max_pixel_fill_count parameter to routing.fill_pits to
    guard against pitfilling large natural depression. Defaults to 500.
  • Fixed an issue in align_and_resize_raster_stack that would ignore
    the bounds of a feature in a mask vector if the
    "mask_vector_where_filter" clause was invoked and instead only
    considered the entire bounds of the vector.
  • Fixed an issue with convolve_2d that allowed output rasters to be
    created without a defined nodata value.
  • Fixed a LOGGER message bug that occurred in zonal_statistics.
  • Fixed an issue in distance_to_channel_mfd that would generate a raster
    with distances to the edge of the raster even if there was no channel. Now
    generates nodata so it is consistent with distance_to_channel_d8.
  • The convolve_2d function now raises a ValueError if either the signal
    or kernel raster has a row based blocksize since this could result in
    very long runtimes due to gdal cache thrashing.
  • Fixed an issue that would cause a convolve_2d worker to crash if the
    integrating kernel was not a float and also normalize_kernel=True
    thus causing the entire function call to deadlock.
  • Added a check on transform_bounding_box to ensure the target bounding
    box's coordinates were finite. This guards against cases where a transform
    into another coordinate system creates a degenerate bounding box.
    Previously the function would silently return non-finite coordinates.
  • Fixing issue when calculating histogram for floating point rasters the
    logging progress percent would be incorrectly calculated.

2.1.2

04 Dec 17:28
Compare
Choose a tag to compare

2.1.2 (2020-12-03)

  • pygeoprocessing.warp_raster now raises a ValueError when an invalid resampling method is provided.
  • Fixed bug in pygeoprocessing.warp_raster that would not properly handle GDAL Byte type signing when masking warped raster with a vector.
  • Fixed issue in convolve_2d that would cause excessive memory use leading to out of memory errors.
  • Fixed issue in convolve_2d that could lead to a file removal race condition and raise a FileNotFoundException when ignoring nodata regions.

2.1.1

16 Sep 21:05
6d07179
Compare
Choose a tag to compare

2.1.1 (2020-09-16)

  • Fixed a critical bug introduced in 2.1.0 that generated invalid results in
    convolve_2d for any raster larger than 256x256.
  • Added an optional parameter, target_layer_name to
    pygeoprocessing.routing.delineate_watersheds_d8 for cases where a
    caller would like to define the output layer name.

2.1.0

25 Aug 22:39
3087162
Compare
Choose a tag to compare
  • Modified pygeoprocessing.numpy_array_to_raster to take boolean arrays.
  • Modified pygeoprocessing.convolve_2d to guard against nonsensical queries
    to both ignore_nodata_and_edges=True but also mask_nodata=False.
    A query of this combination now raises a ValueError to guard against
    programmer error.
  • Added a custom exception class ReclassificationMissingValuesError to
    pygeoprocessing. pygeoprocessing.reclassify_raster raises this
    exception instead of ValueError when a raster pixel value is not
    represented in value_map. This custom exception provides a list of
    missing raster pixel values in a missing_values attribute that allows
    the caller access to the pixel values that are missing through a Python type
    rather than indirectly through an error message.
  • Correcting the docstring for pygeoprocessing.numpy_array_to_raster to
    specify that the pixel_size parameter must be a tuple or list, not an
    int.
  • pygeoprocessing.routing.delineate_watersheds_d8 now has an optional
    parameter write_diagnostic_vector. When True, this parameter will
    cause a new vector per outflow feature to be created in the working_dir.
    This parameter defaults to False. This is a change from prior behavior,
    when the diagnostic vectors were always created, which could occupy a lot of
    computational time under large outflow geometries.
  • Added a pygeoprocessing.multiprocessing.raster_calculator function which
    matches the API and results of pygeoprocessing.raster_calculator but uses
    multiple processing cores to compute raster calculation blocks.
    when the diagnostic vectors were always created, which could occupy
    significant computational time under large outflow geometries.
  • Minor performance improvement to pygeoprocessing.convolve_2d by
    preventing a pre-processing step that initialized temporary rasters with zero
    values as well as added asynchronous work distribution for kernel/signal
    block processing.
  • Modified logging message for pygeoprocessing.new_raster_from_base when
    filling a raster such that an informative error message is printed with
    context as to the function, file, status, and value being filled.

2.0.0

19 May 18:55
59196ce
Compare
Choose a tag to compare

2.0.0 (05-19-2020)

  • Adding Python 3.8 support and dropping Python 3.6 support.

  • Adding GDAL 3 support and dropping GDAL 2 support. The only non-backwards
    compatible issue in GDAL 2 to GDAL 3 is the need to handle Axis Ordering with
    osr.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER) because of
    https://trac.osgeo.org/gdal/wiki/rfc73_proj6_wkt2_srsbarn#Axisorderissues?.
    Since Axis ordering now matters for Geographic CRS the expected order is
    Lat,Lon but we use osr.OAMS_TRADITIONAL_GIS_ORDER to swap to Lon,Lat.

  • Using osr.CreateCoordinateTransformation() instead of
    osr.CoordinateTransformation() as the GDAL 3 call.

  • Fixed a bug in convolve_2d that would not ignore_nodata if the signal
    raster's nodata value was undefined. Changed the name of this flag to
    ignore_nodata_and_edges to reflect its expected functionality.

  • Warped signed byte rasters are now also signed byte rasters.

  • Adding a GitHub Actions-based build job for building wheels and a source
    distribution for a given commit of pygeoprocessing.

  • Updated setup.py to point the URL project link to the project's new
    home on GitHub.

  • Updated MANIFEST.in to only include files that should be there in the
    pygeoprocessing source distribution. This fixes an issue where files
    matching a variety of extensions anywhere in the pygeoprocessing directory
    might be included with the source distribution.

  • Added set_tol_to_zero to convolve_2d to allow for in-function masking
    of near-zero results to be set to 0.0.

  • Fixed malformed logging outputs which could be seen during long running
    rasterize calls.

  • Renamed all parameters involving Spatial Projections to the form
    [var_id]_projection_wkt, this involves optional arguments in
    reproject_vector, warp_raster, transform_bounding_box,
    and align_and_resize_raster_stack as well as the return value from
    get_raster_info and get_vector_info.

  • Fixed an issue in zonal_statistics that would crash if an aggregate
    vector had a feature with no geometry defined. Now the function ignores
    such features and prints a warning to the log.

  • Fixed a malformed ValueError message when a corrupt raster was
    encountered in raster_calculator.

  • Fixes an unnecessary calculation that pre-fills slope raster GeoTIFFs with
    nodata values.

  • Added a check to convolve_2d to verify that raster path/band tuples were
    passed where expected and raise a useful Exception if not.

  • Removed most of the pygeoprocessing.testing module and added the following
    convenience functions to pygeoprocessing, which should not be used
    for production code but are useful for testing and scripting:

    • raster_to_numpy_array - read a single band of a raster into a numpy
      array, runs the risk of memory error if the raster is too large.
    • numpy_array_to_raster - writes a numpy array to a raster on disk.
    • shapely_geometry_to_vector - creates a vector from a list of
      Shapely geometry.
  • Fixed an issue in flow_dir_mfd that would cause invalid flow directions
    on DEMs that had very small numerical delta heights.

  • Fixes an issue in convolve_2d that would occasionally cause undefined
    numerical noise in regions where the signal was nodata but mask_nodata
    was set to False.

1.9.2 Release

06 Feb 19:50
1453ca3
Compare
Choose a tag to compare

This is a minor release to release a fix for a multiprocessing issue discovered on mac.