Skip to content

Commit

Permalink
Add docs for as_numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 15, 2024
1 parent 83c5899 commit faa4670
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion python/PyQt6/core/__init__.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,17 @@ try:
QgsRasterBlock.as_numpy = raster_block_as_numpy

except ModuleNotFoundError:
def raster_block_as_numpy(self, use_masking=True):
def raster_block_as_numpy(self, use_masking:bool = True):
raise QgsNotSupportedException('QgsRasterBlock.as_numpy is not available, numpy is not installed on the system')

QgsRasterBlock.as_numpy = raster_block_as_numpy

QgsRasterBlock.as_numpy.__doc__ = """
Returns the block data as a numpy array.

If `use_masking` is `True` then the returned array will be a numpy masked array, masking the raster block's nodata values.

:raises QgsNotSupportedException: if numpy is not available on the system

.. versionadded:: 3.40
"""
12 changes: 11 additions & 1 deletion python/core/__init__.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,17 @@ try:
QgsRasterBlock.as_numpy = raster_block_as_numpy

except ModuleNotFoundError:
def raster_block_as_numpy(self, use_masking=True):
def raster_block_as_numpy(self, use_masking:bool = True):
raise QgsNotSupportedException('QgsRasterBlock.as_numpy is not available, numpy is not installed on the system')

QgsRasterBlock.as_numpy = raster_block_as_numpy

QgsRasterBlock.as_numpy.__doc__ = """
Returns the block data as a numpy array.

If `use_masking` is `True` then the returned array will be a numpy masked array, masking the raster block's nodata values.

:raises QgsNotSupportedException: if numpy is not available on the system

.. versionadded:: 3.40
"""

0 comments on commit faa4670

Please sign in to comment.