1 Star 0 Fork 13

InitORG/python-gdal-test

forked from fungis/python-gdal-test 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
02_栅格NC查看时间序列.py 751 Bytes
一键复制 编辑 原始数据 按行查看 历史
fungis 提交于 2023-06-30 00:29 . 栅格NC查看时间序列
# -*- coding: utf-8 -*-
"""
@File : 02_栅格NC查看时间序列.py
@Author : fungis@163.com
@notice :
"""
import sys
import warnings
import matplotlib.pylab as plt # 画图模块
import netCDF4
import netCDF4 as nc
'''
安装netCDF4库
conda install netCDF4 -c https://mirrors.aliyun.com/anaconda/pkgs/main/ -y
'''
warnings.filterwarnings('ignore') # 忽略允许警告
data = r'C:\Users\len\Desktop\data\SSP2\26\AIM-SSPRCP-Emission-SSP2-26-CH4-v.1.0.nc' # 文件存放路径
raster = nc.Dataset(data) # 读取raster文件
# 变量名称列表
print(raster.variables.keys())
times = raster.variables['time'] # 波段值
for i in range(len(times)):
real_time = netCDF4.num2date(times[:][i], times.units)
print('time', real_time)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/init-org/python-gdal-test.git
git@gitee.com:init-org/python-gdal-test.git
init-org
python-gdal-test
python-gdal-test
master

搜索帮助