NetCDF简介

一、概述

NetCDF全称为network Common Data Format,中文译法为“网络通用数据格式”,它是由美国大学大气研究协会的Unidata项目科学家针对科学数据的特点开发的,是一种面向数组型并适于网络共享的数据描述和编码标准。

NetCDF和zip、jpeg、bmp文件格式类似,都是一种文件格式的标准。NetCDF文件开始时目的是用于存储气象科学中的数据,现在已经成为许多数据采集软件生成文件的格式。利用NetCDF可以对网络数据进行高效地存储、管理、获取和分发等操作。由于其灵活性,能够传输海量的面向阵列(array-oriented)数据,目前广泛应用于大气科学、水文、海洋学、环境模拟、地球物理等诸多领域。

从数学上来说,netcdf存储的数据就是一个多自变量的单值函数。用公式来说就是f(x,y,z,…)=value,函数的自变量x,y,z等在netcdf中叫做维(dimension)或座标轴(axis),函数值value在netcdf中叫做变量(Variables)。而自变量和函数值在物理学上的一些性质,比如计量单位(量纲)、物理学名称等等在netcdf中就叫属性(Attributes)。

二、文件格式

NetCDF文件后缀为.nc,文件中的数据结构包含维(dimensions)、变量(variables)和属性(attributes)三种描述类型。

可以使用ncdump 命令读取并输出nc文件里的内容。
例如:


netcdf simple_xy {
dimensions:
	x = 2 ;
	y = 3 ;
variables:
	int simple_data(x, y);
	simple_data: description = "Simple XY"
data:
	simple_data =
		11, 12, 13,
		21, 22, 23;
}

三、ncdump命令

参数 说明
[-c] Coordinate variable data and header information
[-h] Header information only, no data
[-v var1[,…]] Data for variable(s) ,… only
[-b [c|f]] Brief annotations for C or Fortran indices in data
[-f [c|f]] Full annotations for C or Fortran indices in data
[-l len] Line length maximum in data section (default 80)
[-n name] Name for netCDF (default derived from file name)
[-p n[,n]] Display floating-point values with less precision
[-k] Output kind of netCDF file
[-s] Output special (virtual) attributes
[-t] Output time data as date-time strings
[-i] Output time data as date-time strings with ISO-8601 ‘T’ separator
[-g grp1[,…]] Data and metadata for group(s) ,… only
[-w] With client-side caching of variables for DAP URLs
[-x] Output XML (NcML) instead of CDL
[-Xp] Unconditionally suppress output of the properties attribute
[-Ln] Set log level to n (>= 0); ignore if logging not enabled.
file Name of netCDF file (or URL if DAP access enabled)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章