# Path: pyfor/gisexport.py
# def project_indices(indices, raster):
# def array_to_raster(array, affine, crs, path):


import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pyfor.metrics
        import rasterio
from pyfor import gisexport
        from scipy.interpolate import griddata
        from rasterio.transform import from_origin
        from rasterio.transform import from_origin
        from scipy.signal import medfilt2d
            from warnings import warn
            return ax

        else:
            plt.show(block=block)

    def pit_filter(self, kernel_size):
        """
        Filters pits in the raster. Intended for use with canopy height models (i.e. grid(0.5).interpolate("max", "z").
        This function modifies the raster array **in place**.
        
        :param kernel_size: The size of the kernel window to pass over the array. For example 3 -> 3x3 kernel window.
        """

        self.array = medfilt2d(self.array, kernel_size=kernel_size)

    def write(self, path):
        """
        Writes the raster to a geotiff. Requires the Cloud.crs attribute to be filled by a projection string (ideally \
        wkt or proj4).
        
        :param path: The path to write to.
        """

        if not self.grid.cloud.crs:

            warn(
                "No coordinate reference system defined. Please set the .crs attribute of the Cloud object.",
                UserWarning,
            )


# Path: pyfor/gisexport.py
# def project_indices(indices, raster):
# def array_to_raster(array, affine, crs, path):


# Path: pyfor/rasterizer.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pyfor.metrics
        import rasterio
from pyfor import gisexport
        from scipy.interpolate import griddata
        from rasterio.transform import from_origin
        from rasterio.transform import from_origin
        from scipy.signal import medfilt2d
            from warnings import warn

            return ax

        else:
            plt.show(block=block)

    def pit_filter(self, kernel_size):
        """
        Filters pits in the raster. Intended for use with canopy height models (i.e. grid(0.5).interpolate("max", "z").
        This function modifies the raster array **in place**.
        
        :param kernel_size: The size of the kernel window to pass over the array. For example 3 -> 3x3 kernel window.
        """

        self.array = medfilt2d(self.array, kernel_size=kernel_size)

    def write(self, path):
        """
        Writes the raster to a geotiff. Requires the Cloud.crs attribute to be filled by a projection string (ideally \
        wkt or proj4).
        
        :param path: The path to write to.
        """

        if not self.grid.cloud.crs:

            warn(
                "No coordinate reference system defined. Please set the .crs attribute of the Cloud object.",
                UserWarning,
            )


        gisexport.array_to_raster(self.array, self._affine, self.grid.cloud.crs, path)