- Fixed bug whereby combining different files using the same band names would cause incorrect result - hat tip to Emilio Luz-Ricca for an excellent bug report that helped track this down.
- Allow band name to be used as alternative to index for
bandargument toread_raster. - Allow band name to be provided on
to_geotiffon label usinglabelparameter.
- Added
parallelismoption touniqueoperator.
- Python 3.10 is now deprecated, so switch minimum to 3.11.
- Added trig operators:
arccos,arcsin,arctan,cos,sin, andtan.
- Added
from_wktandfrom_wkt_liketo create vector layers from WKT descriptions. - Additional unit tests around
as_area.
- Updated docs for
as_area.
- Added
full_likeoperator.
- If you passed
Falseexplicitly as theparallelismparameter toto_geotiffit would trigger the parallel path.
- The
parallelismargument ofto_geotiffnow takes a number of CPU cores or a boolean, but no longer expectsNone, this is now deprecated. Currently it will convertNonetoFalse, but that will be removed in 3.x.
- Added
MapProjection.from_affineto simplify interop with GeoTessera/Rasterio. - Added
Area.affine_transformto get an Affine transform version of a projected map area. - Added
Layer.attributeswhich returns a dataframe with available metadata from files like GeoJSON and GeoPackage. - Added
nodataargument tofrom_array. - Added
defaultargument tofrom_rastersto have non-zero values outside of tiles. - Added
takeoperator, simular to numpy, to allow table based value substitution. - Added
mergeoperator, to join multiple layers to be used as a single group layer.
- Accept an Affine transform as offset to
from_array. - Made
as_projectionNODATA aware, so empty spaces will be filled with NODATA rather than 0s in the layer being reprojected has NODATA specified. - Operators that have inputs with NODATA now will propagate the NODATA values if they are all of the same value, otherwise they will be ignored.
- Group layers not working when constructed from operations on layers rather than raw layers.
- Added a
parallelismflag to theshowcall.
- The operators
yg.anyandyg.allwere excessively greedy when calculating area of operation, ignoring any intermediary operations in an expression that reduced the leaf geospatial areas, leading to excess computation and output size. This is now fixed.
- Moved to using GDAL's wrap to predict reprojected area rather than a hybrid approach.
- Added a
dimensionsproperty to layers to give the raster equivalent width and height. - Added an
as_areaoperator to redefine the area of a layer for use in a calculation. Useful for overriding the default behaviour of operators in terms of the area they take, and for explicit clipping or padding of inputs. - Added an
as_projectionoperator to reproject a raster or calculation to a new map projection. - Added
h3_tileto generate a layer for rasterizing H3 tiles. - Added
logical_and,logical_or,logical_not, andlogical_xoroperators.
- Moved
find_intersectionandfind_unionto top level of module. - Renamed
map_projectiontoprojection. - Vector rasterisation has performance improvements.
- Renamed
astypetoas_typeto match similar Yirgacheffe operators for area and projection.
- Fixed a tessellation issue with H3 tiles overlaying each other when summed.
- Removed mutable layer properties
set_window_for_intersection,set_window_for_union,offset_window_by_pixels, andreset_window. Use the immutableas_areaoperator instead. - Removed
windowproperty from the public API. - Removed
Windowclass from the public API. - Removed
PixelScaleclass, deprecated for a long time, useMapProjectioninstead. - Removed
RasteredVectorLayerclass (useVectorLayerinstead). - Removed old
projectionandpixel_sizeproperties from layers that are now combined in theMapProjectionobject. - Removed
layersfrom the public API, core methods (e.g.,read_raster,read_shape) or operators (e.g.,as_projection) should be used to access layers instead. - Removed properties from internal
LayerObjectAPI that was earlier exposed and had to be maintained for backwards compatibility. - Remove
WGS_84_PROJECTIONconstant - for a while now this has been deprecated since we added more human readable string support (e.g., "epsg:4326"). - Removed
scaled_raster_from_rasterwhich created an in memory rescaled image. Useread_raster_liketo generate a dynamically scaled raster instead. - Removed
RescaledRasterLayeras it is superceeded by theReprojectedRasterLayerwhich does both pixel scaling and map projection conversions. - Removed
numpy_applyandshader_applyoperators, which was a backstop for lack of operators in early Yirgacheffe. - Removed
geo_transformfrom layer, as it duplicated the same function on the layer's area object.
- Fix for an issue with GDAL 3.10.1 on Linux whereby we hit deadlock in GDAL when using parallel save in Yirgacheffe. All workers seemed to deadlock in GDAL, which was stopped by disabling GDAL from using multiple threads when invoked by the workers.
- Don't attempt to use float64 for GPU path.
- Added module level
to_geotiffwhich allows creation of multiband geotiffs. - Support for "sum" resampling method on reprojected layers.
- Support left shift and right shift of layers by either other layers or a constant.
- If you provide a calculation to an output layer that is a different size, don't error, but use the output size. This in theory should not be a change if you've only ever used newer APIs (1.7 and up).
- If you have a global constant layer on an operator that has union composition (addition) keep with the global layer until the top of the expression, then crop to real data.
- Be more nuanced in trying to correct GDAL's abuse of RuntimeError for OSError.
- If an expression throws a runtime error in the calculation during
to_geotiff, it now cleans up the temporary file that was being written. - If creating a file in a directory that doesn't exist, create that directory first. In theory this was already happening but the check was in the wrong place.
- Added unary negative and positive operator.
- If the indicates parallelism should be used, tell GDAL to use multiple threads also, significantly improving LZW compression performance.
- Reduce initial import time.
- Make area per pixel layer work with GeoTiffs with non-geographic projections that lack bounds in the projection description.
- Added a new area-per-pixel layer, which when given a map projection with pixel scale generates a new raster layer where the value in each pixel is the square metre area of that pixel.
- Added a
to_graphvizcall for expressions to help with debugging. - Support sparse GeoTIFF creation.
- Ensure datatype is correctly propegated through
astypeoperator.
- Added
yg.sum,yg.all,yg.anyto build layers from lists of layers. - Cache limits applied to GDAL and MLX which tend to assume that they are the only thing using memory. You can override these by adjusting
yg.constants.GDAL_CACHE_LIMITandyg.constants.MLX_CACHE_LIMIT.
- Added some type checking on read_rasters due to people misunderstand the API.
- Issue found where conv2d interacted badly with group layers.
- Added new file opening
read_raster_likethat will dynamically reproject a raster to the map projection of another layer using the specified resampling method.
- Allow
Area.project_liketo convert between projections. - Provide a version of
uniquesimilar to that found in numpy.
- Fixed issue where due to GDAL behaviour layers read in with EPSG:5845 would save with an altered projection that didn't maintain quality when reloaded.
- Fixed issue with using map projections that don't align origin with EPSG:4326.
- Add
nodatasupport toto_geotiff.
- Fixed a bug whereby the grid to which polygons was rasterized would wobble depending on the context of the reading the array.
- Ensure that nearest neighbour is applied consistently when using layers that are at the same geospatial resolution but not exactly aligned.
- Allow set operations | (union) and & (intersection) on Area types.
- Approximations used in comparing pixel scales and rounding down/up arrays are now projection aware, rather than always done in EPSG:4326.
- Fix issue with creating data layers from numpy arrays where an exception was thrown due to rounding issues on projection math.
- Improved consistency between Numpy and MLX backends when calling sum
- Detect if
to_geotiffis being targetted at a GDAL virtual file, in which case don't use a temporary directory.
- Added
sizeofto the DataType enumeration to get number of bytes a given type requires.
- Support for reverse operators, so that now you can write
1 + layerjust as you could writelayer + 1, rather than having to cast left hand constants toyg.constant(1) + layer - Implemented common subexpression elimination to improve performance.
- Area and Window @dataclass types are marked as frozen (i.e., are immutable).
- Test elements for
isincan now include sets, not just lists and tuples.
- Grow on Window class calculated updated y offset incorrectly, which impacted
conv2dusage.
- Added
from_arraymethod to generate layer from numpy array directly.
- Exposed the callback parameter to
to_geotiff.
- Unit tests now covered by mypy checks
- Exposed operator functions on top level, so you can do
yg.whererather thanyg.operators.where, ready for 2.0.
- Calling
showwith too little data gave a downsample skip of zero. Now don't downsample if data is too few.
- Added a
showmethod to layers/expressions to render them using matplotlib.
- Moved
latlng_for_pixelandpixel_for_latlngtoLayerMathMixinso they can be called on expressions as well as concrete layers.
- Added code of conduct to project.
- Added the ability to call
read_arrayon expressions (before you could only call it on layers).
- The first argument of MapProjection, the string defining the projection used is now validated with the pyproj library, and can be in any from the pyproj
from_stringtakes: Well Known Text (WKT) or "epsg:4326" or "esri:54009" etc. The name function still returns the WKT representation for backwards compatibility. - The functions
pixel_from_latlngandlatlng_from_pixelwill work regardless of the underlying map projection.
- Fixed issue whereby calling
set_window_for_intersectionwould fail if the pixel alignment on a vector layer was rounded unfortunately.
- More documentation updates.
- Mkdocs based documentation.
- Modernised type hints to use latest Python standards.
- Fix type inference for expressions so that
to_geotiffselects correct GeoTIFF file type to store results as.
- Improved typing of methods that take a filename to use both Path and str.
- Added marker for mypy that Yirgacheffe has type annotations
- Automatically set rlimit for NOFILES so that parallel operations of machines with many cores don't run out of file descriptors.
- Removed internal classes
LayerOperation,LayerMathMixin, andLayerConstantfrom public interface.
- Fixed issue whereby vector layers without explicit projection would use the abstract rather than concrete area value when generating a target raster.
- Added a core wrapper
constantto save people usingConstantLayerexplicitly - Added a core wrapper
read_narrow_rasterto save people usingUniformAreaLayerexplicitly
- Minor improvements to GitHub Actions workflows
- Fixed bug whereby reads from within a single tile that has nodata values in a group layer used the wrong numpy call to check for nan.
- Added
isnanoperator.
- Fixed an issue introduced in 1.7.0 where
find_intersectionandfind_unionused the raw, non-pixel aligned area envelope.
- Added the option to set
parallelism=Truerather than just a number when callingto_geotiff, allowing Yirgacheffe to select the number of CPU cores to use for parallel operations.
- Fixed an issue whereby if you used the MLX backend and called
read_arraythe return value was sometimes an mlx array rather than a numpy array.
- Support the ability to create VectorLayers that don't have a pixel scale or projection added. These layers will have the correct pixel scale and projection calculated when calculations on layers are saved or aggregated based on the other raster layers used in the calculation.
- Added MapProjection object to replace PixelScale objects and projection strings being separate parameters.