Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
diff_file = stack_trend_file - pgp_trend_file
Parameters:
stack_trend_file (string): The path to the trend raster output of
``make_stack.py`` (usually named ``stack_trend.tif``). This
file must exist on disk.
pgp_trend_file (string): The path to the trend raster output from
``make_regression()``, also in this module. This file must
exist on disk.
diff_file (string): The path to where the difference raster should be
saved.
Returns:
``None``"""
stack_nodata = pygeoprocessing.get_nodata_from_uri(stack_trend_file)
pgp_nodata = pygeoprocessing.get_nodata_from_uri(pgp_trend_file)
def _diff(stack_trend, pgp_trend):
"""Calculate a diff between two matrices, ignoring nodata.
Parameters:
stack_trend (numpy.ndarray): Array of values from the stack trend
raster.
pgp_trend (numpy.ndarray): Array of values from the pygeoprocessing
trend raster.
Returns:
``numpy.ndarray`` of the difference between ``stack_trend`` and
``pgp_trend``"""
valid_mask = ((stack_trend != stack_nodata) & (pgp_trend != pgp_nodata))
out_array = numpy.empty_like(stack_trend)
diff_file = stack_trend_file - pgp_trend_file
Parameters:
stack_trend_file (string): The path to the trend raster output of
``make_stack.py`` (usually named ``stack_trend.tif``). This
file must exist on disk.
pgp_trend_file (string): The path to the trend raster output from
``make_regression()``, also in this module. This file must
exist on disk.
diff_file (string): The path to where the difference raster should be
saved.
Returns:
``None``"""
stack_nodata = pygeoprocessing.get_nodata_from_uri(stack_trend_file)
pgp_nodata = pygeoprocessing.get_nodata_from_uri(pgp_trend_file)
def _diff(stack_trend, pgp_trend):
"""Calculate a diff between two matrices, ignoring nodata.
Parameters:
stack_trend (numpy.ndarray): Array of values from the stack trend
raster.
pgp_trend (numpy.ndarray): Array of values from the pygeoprocessing
trend raster.
Returns:
``numpy.ndarray`` of the difference between ``stack_trend`` and
``pgp_trend``"""
valid_mask = ((stack_trend != stack_nodata) & (pgp_trend != pgp_nodata))
out_array = numpy.empty_like(stack_trend)
out_array[:] = -9999