environment.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:pycoal 作者: capstone-coal 项目源码 文件源码
def create_empty_copy(self, source_filename, destination_filename):
        """
        Create an empty copy of a COAL classified image with the same size.

        Args:
            source_filename (str):      filename of the source image
            destination_filename (str): filename of the destination image
        """
        logging.info("Creating an empty copy of classified image '%s' with the same size. Saving to '%s'" %(source_filename, destination_filename))
        # open the source image
        source = spectral.open_image(source_filename)

        # create an empty array of the same dimensions
        destination = numpy.zeros(shape=source.shape, dtype=numpy.uint16)

        # save it with source metadata
        spectral.io.envi.save_classification(
            destination_filename,
            destination,
            class_names=['No data','Data'],
            metadata={
                'data ignore value': 0,
                'map info': source.metadata.get('map info')
            })
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号