Skip to content

天机netCDF4数据文件格式介绍

1. NetCDF4 文件格式简介

NetCDF(Network Common Data Form)是一种用于科学数据存储和共享的自描述、可扩展、跨平台的文件格式。NetCDF4 是其第四代格式,支持压缩、高效存储以及复杂的数据结构,非常适合存储气象、海洋、环境等多维科学数据。其特点包括:

• 支持多维数组(如时间、经度、纬度、垂直层等)、

• 自描述:包含变量名、维度、单位、长名称等信息。

• 可跨平台、跨语言访问(Python、C、Fortran 等)。

• 支持压缩和高效随机访问大文件。

2. NetCDF4 文件一般包含的维度信息

NetCDF4 文件主要由维度(dimensions)、变量(variables)和全局属性(global attributes)组成。常见维度包括:

• time(时间):记录时间步数或时间点。

• lat(纬度):空间纬度信息。

• lon(经度):空间经度信息。

• lev / height / depth(高度/深度层):用于大气或海洋垂直层数据。

• 其他可自定义维度,例如 ensemble(集合预报成员)、station(站点编号)等。

维度定义了数据数组的大小和索引顺序,例如 (time, lat, lon) 表示三维数据随时间、纬度和经度变化。

3. NetCDF4 的 dump 信息

Dump 信息是 NetCDF 文件的结构摘要,显示维度、变量、变量属性及全局属性。

以天机开源数据2米气温某时刻预报文件为例得到dump信息:

bash
Bash
ncdump -h 2025081412_t2mz_f001.nc
netcdf \2025081412_t2mz_f001 {
dimensions:
time = 1 ;
lat = 1800 ;
lon = 2400 ;
variables:
float time(time) ;
time:long_name = "time" ;
time:units = "hours since 2025-08-14 12:00:00" ;
float lat(lat) ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
float lon(lon) ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
float t2mz(time, lat, lon) ;
t2mz:long_name = "Adjusted 2m temperature" ;
t2mz:units = "K" ;

// global attributes:
:title = "TJ1-CN" ;
:institution = "TianJi Weather Science and Technology Company" ;
:source = "the Super Dynamics on Cube, Tianji Weather System" ;
:references = "https://www.tjweather.com" ;
:license = "CC BY-NC 4.0" ;

3.1 维度信息

• time = 1:文件中只有 1 个时间点。

• lat = 1800:纬度方向上共有 1800 个网格点。

• lon = 2400:经度方向上共有 2400 个网格点。

3.2 变量信息

• time(time):表示时间维度的变量

• long_name = "time":长名称为“时间”。

• units = "hours since 2025-08-14 12:00:00":以 2025-08-14 12:00:00 为起点,单位为小时。

• lat(lat):表示纬度坐标

• long_name = "latitude":长名称为“纬度”。

• units = "degrees_north":单位为北纬度数值。

• lon(lon):表示经度坐标

• long_name = "longitude":长名称为“经度”。

• units = "degrees_east":单位为东经度数值。

• t2mz(time, lat, lon):三维气象变量,存储调整后的 2 米温度

• long_name = "Adjusted 2m temperature":长名称“调整后的 2 米气温”。

• units = "K":单位为开尔文(Kelvin)。

3.3 全局属性

• title = "TJ1-CN":所属数据集标题。

• institution = "TianJi Weather Science and Technology Company":数据提供单位。

• source = "the Super Dynamics on Cube, Tianji Weather System":数据来源描述。

• references = "https://www.tjweather.com":引用或参考链接。

• license = "CC BY-NC 4.0":文件使用的开源许可协议。