当前位置: 首页 > news >正文

磁力链最佳的搜索引擎建设网站优化

磁力链最佳的搜索引擎,建设网站优化,深圳网站优化推广方案,长沙做网站品牌使用deepwatermap生成的水体二值掩码中有部分区域由于被云挡住无法识别,造成水体不连续是使用jrc离线数据进行修正,jrc数据下载连接如下:https://global-surface-water.appspot.com/download 选择指定区域的数据集合下载如图: 使…

   使用deepwatermap生成的水体二值掩码中有部分区域由于被云挡住无法识别,造成水体不连续是使用jrc离线数据进行修正,jrc数据下载连接如下:https://global-surface-water.appspot.com/download

选择指定区域的数据集合下载如图:

使用开源项目deepwatermap生成tiff格式的水体二值掩码图(需要把原本的png水体图进行转成tiff格式使用gdal把原始的坐标迁移过去)弄好之后开始对水体中非连续的水体使用jrc文件补全。

修正的代码如下:

import numpy as np
import rioxarray as rxr
from rasterio.enums import Resamplingdef update_water_classification(target_path, output_path, water_threshold=2.5,jrc_path='occurrence_90E_30Nv1_4_2021.tif'):# 加载目标影像(含水体掩膜)ZB_target = rxr.open_rasterio(target_path, masked=True).squeeze()# 加载JRC水体发生频率数据作为ZBZB = rxr.open_rasterio(jrc_path, masked=True).squeeze()# 将ZB重新投影到目标影像的CRS,并重采样以匹配空间分辨率ZB_resampled = ZB.rio.reproject_match(ZB_target, resampling=Resampling.bilinear)#生成临时文件 仅用来测试jrc是否依据水体掩码进行重采样到相同大小# ZB_resampled = genTempTiffFile(ZB_resampled)# 创建一个新的掩码用于保存更新后的数据updated_mask = ZB_target.copy()  # 复制原始掩码作为基础# 找出需要更新的非水体像素位置(即值为0的位置)non_water_pixels = ZB_target.values == 0# 更新非水体区域:如果对应的ZB_resampled值大于等于water_threshold,则设为1(水体)# 使用布尔索引避免在同一数组上读写updated_mask.values[non_water_pixels] = np.where(ZB_resampled.values[non_water_pixels] >= water_threshold,1,0)# 保存最终结果updated_mask.rio.to_raster(output_path)print("Process completed.")def genTempTiffFile(ZB_resampled):# 保存重采样后的JRC数据到临时文件# 设置一个新的数据类型和默认的nodata值new_dtype = 'float32'  # 或者其他适当的数据类型if np.issubdtype(new_dtype, np.floating):default_nodata = -9999.0  # 浮点类型的默认nodata值else:default_nodata = np.iinfo(new_dtype).min  # 整数类型的默认nodata值# 确保nodata值在新的数据类型范围内if 'nodata' in ZB_resampled.attrs:original_nodata = ZB_resampled.attrs['nodata']if not np.issubdtype(type(original_nodata), np.number) or not (np.iinfo(new_dtype).min <= original_nodata <= np.iinfo(new_dtype).max):print(f"Warning: nodata value {original_nodata} out of range for dtype {new_dtype}. Adjusting nodata value.")original_nodata = default_nodataelse:original_nodata = default_nodataprint("No nodata value found. Using default nodata value.")# 设置新的nodata值并转换数据类型ZB_resampled = ZB_resampled.rio.write_nodata(original_nodata)ZB_resampled = ZB_resampled.astype(new_dtype)ZB_resampled.rio.to_raster("resampled_jrc.tiff", dtype=new_dtype, nodata=original_nodata)print(f"Resampled JRC data saved to resampled_jrc")return ZB_resampled# if __name__ == '__main__':
#     jrc_file = "occurrence_90E_30Nv1_4_2021.tif"
#     target_tiff = "D:/s2/L2A_T46RFS_A026142_20220309T042244_merged_cropped_binary_watermask.tiff"
#     output_tiff = target_tiff.replace('_merged_cropped_binary_watermask.tiff',
#                                       '_merged_cropped_binary_watermask_jrc.tiff')
#     update_water_classification(target_tiff, output_tiff)
#     print("影像处理完成并已保存")

 在此记录一下!希望可以帮到需要的朋友!

http://www.yayakq.cn/news/529433/

相关文章:

  • 莒县做网站外贸网站建设知识 列表
  • 深圳做网站的公司 cheungdom网站好坏标准
  • 正规的企业网站建设网络营销案例实例
  • Python 查询网站开发网站建设主要问题
  • 西安网站建设公司排名网站里的横幅广告怎么做
  • 做网站引流的最佳方法学软件去哪个培训机构
  • 资源共享网站建设广西哪里有网站建设
  • 云南网站设计外包wordpress会员中心
  • 长治网站建设推广如何做闲置物品自己的网站
  • 定制网站模板站网站服务公司案例
  • 建设安全带官方网站网页版微信可以发朋友圈吗
  • 虚拟主机怎么做淘客网站域名网站怎么打开
  • 行业数据分析网站库尔勒网站建设公司
  • 门户网站制作平台建筑企业登录建设厅网站密码
  • 福永网站建设公司哪家好云虚机安装wordpress教程
  • 电子商务网站建设a卷做书的网站有哪些
  • 中国临海门户网站工程建设个体营业执照网上申请
  • 网站设计与网站制作房地产网站制作公司
  • wordpress软件产品主题seo优化排名方法
  • h5网站建设网络营销策划书3000字
  • 淘宝作图在哪个网站上做图猫咪网站模版下载
  • 炫酷个人网站php源码外贸商城网站系统
  • 那种限时购的网站如何做如何做电影网站赚钱
  • wordpress怎么查看数据库重庆seo入门教程
  • 长沙优化网站厂家国外服务器购买
  • 哪家建公司网站网站网页怎么设计
  • 潍坊设计网站建设深圳网站建设便宜信科网络
  • 做网站网站会被判多久百度推广负责做网站吗
  • 58同城做网站推广好不好wordpress页面菜单
  • 专业网站建站网站负责人核验现场拍摄照片