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

wordpress在哪修改代码安庆seo

wordpress在哪修改代码,安庆seo,网站建设的销售怎么做,有谁认识做微网站的一、前言 使用Python中的h5py库实现同一目录下多个mat文件的批量读取功能,获取数据、lon、lat等信息,其他变量内容可根据自己的mat格式进行更改。 二、代码 def open_matfiles(dir, start_indexNone, end_indexNone,lev_indexNone,lev_valueNone):打开…

一、前言

使用Python中的h5py库实现同一目录下多个mat文件的批量读取功能,获取数据、lon、lat等信息,其他变量内容可根据自己的mat格式进行更改。

二、代码

def open_matfiles(dir, start_index=None, end_index=None,lev_index=None,lev_value=None):'''打开一个文件夹下的所有mat文件,并返回数据、经度、纬度和层次信息。参数:dir (str): 包含.mat文件的文件夹路径。start_index (int, 可选): 要读取的第一个文件的索引(默认是0)。end_index (int, 可选): 要读取的最后一个文件的索引(默认是所有文件)。lev_index (int, 可选): 要读取的特定层次的索引(默认是None,表示读取所有层次)。lev_value (float, 可选): 要读取的特定层次的值(默认是None,表示读取所有层次),针对GPH200、500。返回:tuple: 包含以下元素的元组:- data (numpy.ndarray): 读取的所有数据。- lon (numpy.ndarray): 经度信息。- lat (numpy.ndarray): 纬度信息。- lev (numpy.ndarray): 层次信息(如果存在)。异常:FileNotFoundError: 如果指定的文件夹不存在。'''import h5pyimport numpy as npfrom pathlib import Pathdir_path = Path(dir)if not dir_path.exists():raise FileNotFoundError(f"文件夹{dir}不存在")mat_files = sorted(dir_path.glob("*.mat"))  # 对文件进行排序if start_index is None:start_index = 0if end_index is None:end_index = len(mat_files)lon = Nonelat = Nonelev = Nonedata_list = []for mat_file in mat_files[start_index:end_index]:with h5py.File(mat_file, "r") as mat_data:if lon is None:lon = np.array(mat_data["lon"])if lat is None:lat = np.array(mat_data["lat"])if lev is None:lev = np.array(mat_data.get("lev", None))  # 使用get方法提供默认值if lev is not None and lev_index is not None:data = np.array(mat_data["data"])[...,lev_index,:,:] # lev在倒数第三层data_list.append(data)elif lev is not None and lev_value is not None:index = np.where(lev == lev_value)data = np.array(mat_data["data"])[...,index,:,:]data_list.append(data)else:data = np.array(mat_data["data"])data_list.append(data)data = np.stack(data_list, axis=0)return data, lon, lat, lev
http://www.rdtb.cn/news/13530.html

相关文章:

  • 福州做网站哪家公司好爱站查询
  • dw 做网站图片之间的链接郑州seo博客
  • 网站建设服务怎么样百度网站收录
  • 网站彩票投注员做啥的网络销售推广平台
  • 网站建设教程免费人工在线客服系统
  • 如何做优酷网站点击赚钱如何建立自己的网站
  • 建网站的工具有哪些宁波正规seo推广公司
  • php网站开发作业南京百度网站快速优化
  • 怎样获得做网站的客户网站改版公司哪家好
  • 中国建设银行网站上不去百度一下就知道官网
  • 电子商务类网站模板seo诊断分析在线工具
  • 网站导航如何做半透明百度网站名称和网址
  • 广州网站建设网站建设无锡seo
  • wordpress安装卡死阳泉seo
  • wordpress 摄影 中文常用seo站长工具
  • form e哪个网站做软文写作兼职
  • 广告公司名称怎么起百度快速优化排名软件
  • 做俄语网站建设爱战网关键词查询网站
  • 小说网站开发 项目计划书百度搜索推广官网
  • 教育网站集群建设方案seo发帖论坛
  • 丽水哪里有做网站的公司4000-262-班级优化大师怎么加入班级
  • 苏州建设招聘信息网站google play应用商店
  • 做网站可以参考的网站aso优化贴吧
  • 一个专门做试题的网站怎么做网址
  • 如何制作淘客导购网站客户关系管理
  • 微网站界面设计汕头网站建设公司
  • 免费做图片的网站手机百度经验首页登录官网
  • 找合伙人的网站做淘宝百度top排行榜
  • 网站建设合同 简单新品上市怎么做宣传推广
  • 如何做网站的登录注册电脑培训中心