-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move GDAL constraint into constraints file and update to GDAL 3.8 #1546
Changes from 8 commits
1ddaff0
91ececb
316e4dd
e87dcaf
f9051f5
a289f98
fa213e5
7a148dd
8d6164b
1c2476c
b5d8576
4c35b1a
a2e79d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This file contains package constraints needed to run the invest test suite | ||
|
||
# A gdal bug caused our test suite to fail, but this issue is unlikely to | ||
# occur with regular use of invest. https://github.com/OSGeo/gdal/issues/8497 | ||
GDAL!=3.6.*,!=3.7.* |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -633,10 +633,6 @@ def execute(args): | |
# If the input is a vector, reproject to the AOI SRS and simplify. | ||
# Rasterization happens in the alignment step. | ||
elif gis_type == pygeoprocessing.VECTOR_TYPE: | ||
# Habitats and stressors are rasterized with ALL_TOUCHED=TRUE | ||
if name in habitats_info or name in stressors_info: | ||
habitat_stressor_vectors.add(source_filepath) | ||
|
||
# Using Shapefile here because its driver appears to not raise a | ||
# warning if a MultiPolygon geometry is inserted into a Polygon | ||
# layer, which was happening on a real-world sample dataset while | ||
|
@@ -680,6 +676,10 @@ def execute(args): | |
dependent_task_list=[reprojected_vector_task] | ||
)) | ||
|
||
# Habitats and stressors are rasterized with ALL_TOUCHED=TRUE | ||
if name in habitats_info or name in stressors_info: | ||
habitat_stressor_vectors.add(target_simplified_vector) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It appears that the intent was to apply |
||
|
||
# Later operations make use of the habitats rasters or the stressors | ||
# rasters, so it's useful to collect those here now. | ||
if name in habitats_info: | ||
|
@@ -1648,7 +1648,6 @@ def _simplify(source_vector_path, tolerance, target_vector_path, | |
for source_feature in source_layer: | ||
target_feature = ogr.Feature(target_layer_defn) | ||
source_geom = source_feature.GetGeometryRef() | ||
|
||
simplified_geom = source_geom.SimplifyPreserveTopology(tolerance) | ||
if simplified_geom is not None: | ||
target_geom = simplified_geom | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -415,9 +415,9 @@ def ndr_eff_calculation( | |
|
||
# create direction raster in bytes | ||
def _mfd_to_flow_dir_op(mfd_array): | ||
result = numpy.zeros(mfd_array.shape, dtype=numpy.int8) | ||
result = numpy.zeros(mfd_array.shape, dtype=numpy.uint8) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this always should've been I'm not sure exactly why it worked before, but it probably broke because of changes in GDAL's handling of signed 8-bit integers in 3.7.0. |
||
for i in range(8): | ||
result[:] |= (((mfd_array >> (i*4)) & 0xF) > 0) << i | ||
result[:] |= ((((mfd_array >> (i*4)) & 0xF) > 0) << i).astype(numpy.uint8) | ||
return result | ||
|
||
pygeoprocessing.raster_calculator( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2002,6 +2002,7 @@ def test_spatial_overlap_error(self): | |
layer = vector.CreateLayer('layer', vector_srs, ogr.wkbPoint) | ||
new_feature = ogr.Feature(layer.GetLayerDefn()) | ||
new_feature.SetGeometry(ogr.CreateGeometryFromWkt('POINT (1 1)')) | ||
layer.CreateFeature(new_feature) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The feature wasn't being added to the layer, so the layer was actually empty. I'm not sure what determines the extent of an empty layer, but I'm guessing it's undefined behavior. Some change in GDAL (or GEOS or PROJ?) caused the extent to include a By adding a feature to the layer, we get the expected behavior. |
||
|
||
new_feature = None | ||
layer = None | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the concept of a constraints file is pip-specific (I think?) but we're using conda/mamba to manage our environments, would it be worth adding a note here about the syntax that is allowed in this file?
I'm guessing environment markers might be a big one that wouldn't be supported without further work on our requirements conversion script, for example!