前两把读取遥感数据、存储遥感数据函数写成了一个类;然后再去调用这个类,出现了这个问题(TypeError: read_img() missing 1 required positional argument: 'filename'):

后来查询了一下,类需要实例化,完整代码如下:

from classIMAGE import IMAGE
import numpy as npimage = IMAGE()   #实例化类的对象
# proj, geotrans, data1, row, column ,band=IMAGE.read_img(r"F:\ProfessionalProfile\DataRelevant\Landsat2017\LC08_L1TP_134036_20170808_20170813_01_T1\LC08_L1TP_134036_20170808_20170813_01_T1_B4.tif")
# proj, geotrans, data2, row, column ,band=IMAGE.read_img(r"F:\ProfessionalProfile\DataRelevant\Landsat2017\LC08_L1TP_134036_20170808_20170813_01_T1\LC08_L1TP_134036_20170808_20170813_01_T1_B3.tif")
# proj, geotrans, data3, row, column ,band=IMAGE.read_img(r"F:\ProfessionalProfile\DataRelevant\Landsat2017\LC08_L1TP_134036_20170808_20170813_01_T1\LC08_L1TP_134036_20170808_20170813_01_T1_B2.tif")
proj, geotrans, data1, row, column ,band=image.read_img(r"F:\ProfessionalProfile\DataRelevant\Landsat2017\LC08_L1TP_134036_20170808_20170813_01_T1\LC08_L1TP_134036_20170808_20170813_01_T1_B4.tif")
proj, geotrans, data2, row, column ,band=image.read_img(r"F:\ProfessionalProfile\DataRelevant\Landsat2017\LC08_L1TP_134036_20170808_20170813_01_T1\LC08_L1TP_134036_20170808_20170813_01_T1_B3.tif")
proj, geotrans, data3, row, column ,band=image.read_img(r"F:\ProfessionalProfile\DataRelevant\Landsat2017\LC08_L1TP_134036_20170808_20170813_01_T1\LC08_L1TP_134036_20170808_20170813_01_T1_B2.tif")data = np.array((data1,data2,data3), dtype=data1.dtype)  # 按序将3个波段像元值放入
# dataWrite=IMAGE.write_img(r'F:\ProfessionalProfile\DataRelevant\Landsat2017\zcs432.tif', proj, geotrans, data)
dataWrite=image.write_img(r'F:\ProfessionalProfile\DataRelevant\Landsat2017\zcs432.tif', proj, geotrans, data)

解决方法:image=IMAGE()实例化对象。

最后对比一下:左侧是Python合成后的,右侧是landsat下载的。

【已经解决】TypeError: read_img() missing 1 required positional argument: ‘filename‘相关推荐

  1. 成功解决TypeError: drop() missing 1 required positional argument: 'labels'

    成功解决TypeError: drop() missing 1 required positional argument: 'labels' 目录 解决问题 解决思路 解决方法 解决问题 TypeEr ...

  2. 解决TypeError: get() missing 1 required positional argument: 'url'

    使用selenium时需要确保电脑上已经下载了浏览器对应版本的webdriver 先附初始代码 #导入库 from selenium import webdriver #声明浏览器对象并调用 brow ...

  3. 解决 TypeError: xxx() missing 1 required positional argument: 'astr'

    错误代码 TypeError: xxx() missing 1 required positional argument: 'astr' 错误原因 没有对类进行实例化如下. Solution.isUn ...

  4. TypeError:__init__() missing 1 required positional argument :‘problem‘

    成功解决TypeError:__init__() missing 1 required positional argument :'problem' 偶然遇见python报错__init__() mi ...

  5. 解决Django: [TypeError: __init__() missing 1 required positional argument: 'on_delete']

    试用python3.7 + Django2.1.3的时候, 在创建模型类关联外键时, 报如下错误: Traceback (most recent call last):xxxxxxxxxxx Type ...

  6. 【bug解决】TypeError: forward() missing 1 required positional argument: ‘x‘

    项目场景: 进行ReLU类的实例运算时,出现了问题 问题描述 import numpy as npclass ReLU():def __init__(self):self.mask = Nonedef ...

  7. TypeError: __init__() missing 1 required positional argument: 'on_delete' 解决办法

    Django 中创建Model时报以下错误: TypeError: init() missing 1 required positional argument: 'on_delete' 代码如下: f ...

  8. 关于错误TypeError: get_biff_record() missing 1 required positional argument: ‘self‘的解决

    在进行python实现Excel自动化的过程中出现了TypeError: get_biff_record() missing 1 required positional argument: 'self ...

  9. Django - TypeError: __init__() missing 1 required positional argument: ‘on_delete‘ 的解决办法

    Django 中创建Model时报以下错误: TypeError: init() missing 1 required positional argument: 'on_delete' 代码如下: f ...

  10. 【Python】django报错:TypeError: __init__() missing 1 required positional argument: 'on_delete'解决办法

    错误代码: from __future__ import unicode_literals from django.db import models from django.utils.encodin ...

最新文章

  1. c语言组队,组队列问题。会做的高手帮帮忙啊
  2. 替换某个字符串_postman教程-10-如何在集合中快速查询和替换数据
  3. 找父节点和子节点个数(Poj1634)
  4. html标签ref,HTML: param 标签
  5. MySQL中如何查询数据(下)
  6. C# Hashtable和Dictionary区别
  7. Percona-tookit学习笔记(一)
  8. ADO.NET Entity Framework中的并发控制 【转载】
  9. python面向对象使用方法_python面向对象之方法
  10. Java后端开发流程
  11. 基于STC89C52单片机的智能灯光毕业设计论文
  12. frm考试可以用计算机,GARP协会:2021年FRM考试只能带这种计算器!
  13. 基于张正友平面标定法的摄像机标定及GUI实现
  14. 计算机组成原理 / 反汇编实验(2)拆弹实验
  15. 【源码共享】我花2小时写了微信官网的响应式布局HTML+CSS 换成旅行主题风格更炫酷了
  16. Unity UGUI实现王者荣耀版多格血条
  17. 渗透过程中日志信息分析示例
  18. 百度地图 路书动态加载规划
  19. 人工蜂群算法怎样添加路径
  20. 实时音视频开发理论必备:如何省流量?视频高度压缩背后的预测技术

热门文章

  1. (秒杀项目) 4.5 项目部署与压测
  2. (day 27 - 递归分治 )剑指 Offer 33. 二叉搜索树的后序遍历序列
  3. springcloud-gateway路由配置和跨域配置
  4. 概要设计 英文_JavaScript 中的位运算和权限设计
  5. 相位编码信号 matlab,matlab 求基于相位编码的雷达回波仿真 更多交易加我QQ
  6. python里面Dataset干嘛的_用 Python 对成绩分类汇总!
  7. 饱和气压与温度的关系_饱和水蒸气压计算公式,看懂的赶紧来
  8. Javascript特效:商品橱窗
  9. Pannellum:实例之简单热点
  10. linux 执行安装脚本,批量执行Linux安装程序和脚本