首页 > 解决方案 > 绘制一个未知的 netcdf 文件(没有 ncview)

问题描述

我从 python 中的 netcdf 开始,我想知道更多选项来以友好的方式查看 netcdf

在光栅情况(2D 或 3D)中,我可以使用 ncview,但有些情况只给我经度、纬度和其他变量(例如高度)或保存多边形轮廓或线条,我想以一种友好的方式可视化(如在 QGis 格式中)以便有更好的数据概览

import netCDF4
src = netCDF4.Dataset(file)
var_names = src.variables.keys()

float32 nav_lat(y, x)
    units: degrees_north
    long_name: Latitude
unlimited dimensions: 
current shape = (10800, 21600)

float32 upst(y, x)
    axis: TYX
    units: m2
    long_name: area
    associate: nav_lat nav_lon
    coordinates: nav_lat nav_lon
unlimited dimensions: 
current shape = (10800, 21600)

标签: pythonplotnetcdf

解决方案


You could try it with ncplot (https://pypi.org/project/ncplot/) which provides ncview style auto-plotting in Python.:

from ncplot import view

view(file)

Though if ncview cannot automatically plot it, there may be some data issues.ncview should be able to handle almost anything.


推荐阅读