如何解决Ptyhon:如何在避免零的数组列表上计算均值和百分位数
我正在处理 geotiff
文件格式的卫星图像。假设我有多个带有空格的图像(因为云或其他元素)。但是我正在将这些数组收集在列表中。
from Rasterio.plot import show
LST = [array1,array2]
f,ax=plt.subplots(1,2,figsize=[20,20])
show(lst_paris2,cmap='hot_r',vmin=vmin,ax=ax[0])
show(lst_paris3,vmin=vmin1,ax=ax[1])
我想计算,对于每个像素(即数组的单元格 i,j
),mean
为 numpy.mean(LST)
,percentiles
为 numpy.percentile(LIST,[5,50,95])
避免零值。
解决方法
您可以使用带有布尔索引的 .nonzero() 方法
const Discord = require('discord.js');
const config = require('../config/config.json')
module.exports = {
name: 'musichelp',aliases: ['mhelp'],description: "Shows you all the music commands!",async execute(client,message,args,Discord,cmd) {
const musicEmbed = new Discord.MessageEmbed()
.setColor('#8c88fc')
.setTitle("Music Help")
.addField(
{name: "Play Command!",value: `${config.prefix}`+ "play \n **Aliases** = 'p' \n\n ***Description*** \n The play command plays music in a voice channel (You need to be in a vc to be able to use this command!)",inline: true},{name: "Leave Command!",value: `${config.prefix}`+ "leave \n **Aliases** = 'dc','disconnect' \n The leave command leaves the current voice channel it's in (You need to be in a vc to be able to use this command)",)
.setFooter("It's recommended to set the volume of the bot to between 35 - 50!");
await message.reply(musicEmbed);
}
}
,
您的 container: {
display: "flex",justifyContent: 'center',height: "100%",width: "100%",alignItems: "center",}
变量似乎是两个列表/数组的列表。如果您使用 LST
从这两个列表中创建一个 np.hstack
会有所帮助。然后你可以像@midtownguru 在评论中所说的那样进行计算。
np.array
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。