- 积分
- 55950
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-21
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 MeteoInfo 于 2012-7-6 21:23 编辑
改进了NetCDF数据读取,可以处理不同的变量有不同的level维的情况,需要MeteoInfo最新文件(见置顶帖子)。来看下面的一个NetCDF数据:
File Name: F:\Temp\nc\fnl_20070716_00_00.nc
Dimensions: 12
initial_time0_hours = 1;
lat_3 = 181;
lon_3 = 360;
lv_PVL3 = 2;
lv_ISBL4 = 26;
lv_GPML5 = 3;
lv_DBLY6 = 4;
lv_ISBL7 = 2;
lv_ISBL8 = 21;
lv_SIGY9 = 4;
lv_ISBL10 = 6;
ncl_strlen_0 = 18;
Global Attributes: 6
: creation_date = "Wed May 9 03:44:28 MDT 2012";
: NCL_Version = "6.0.0";
: system = "Linux mirage0 2.6.18-194.17.4.el5 #1 SMP Wed Oct 20 13:03:08 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux";
: Conventions = "None";
: grib_source = "fnl_20070716_00_00.grb";
: title = "NCL: convert-GRIB-to-netCDF";
Variations: 89
NC_CHAR initial_time0(initial_time0_hours,ncl_strlen_0);
initial_time0: NCL_converted_from_type = "string";
initial_time0: units = "mm/dd/yyyy (hh:mm)";
initial_time0: long_name = "Initial time of first record";
NC_FLOAT lon_3(lon_3);
lon_3: units = "degrees_east";
lon_3: grid_description = "65160-point (181x360) global longitude-latitude grid. (0,0) at 0E, 90N, matrix layout. N.B.: prime meridian not duplicated.";
lon_3: long_name = "longitude";
NC_FLOAT lat_3(lat_3);
lat_3: units = "degrees_north";
lat_3: grid_description = "65160-point (181x360) global longitude-latitude grid. (0,0) at 0E, 90N, matrix layout. N.B.: prime meridian not duplicated.";
lat_3: long_name = "latitude";
NC_INT lv_PVL3(lv_PVL3);
lv_PVL3: units = "10^-6Km^2/kgs";
lv_PVL3: long_name = "potential vorticity (pv) level";
NC_INT lv_ISBL4(lv_ISBL4);
lv_ISBL4: units = "hPa";
lv_ISBL4: long_name = "isobaric level";
NC_INT lv_GPML5(lv_GPML5);
lv_GPML5: units = "m";
lv_GPML5: long_name = "fixed height level";
NC_INT lv_DBLY6_l0(lv_DBLY6);
lv_DBLY6_l0: units = "cm";
lv_DBLY6_l0: long_name = "layer between two depths below land surface";
NC_INT lv_DBLY6_l1(lv_DBLY6);
lv_DBLY6_l1: units = "cm";
lv_DBLY6_l1: long_name = "layer between two depths below land surface";
NC_INT lv_ISBL7(lv_ISBL7);
lv_ISBL7: units = "hPa";
lv_ISBL7: long_name = "isobaric level";
NC_INT lv_ISBL8(lv_ISBL8);
lv_ISBL8: units = "hPa";
lv_ISBL8: long_name = "isobaric level";
NC_INT lv_SIGY9_l0(lv_SIGY9);
lv_SIGY9_l0: units = "sigma";
lv_SIGY9_l0: long_name = "layer between two sigma levels";
NC_INT lv_SIGY9_l1(lv_SIGY9);
lv_SIGY9_l1: units = "sigma";
lv_SIGY9_l1: long_name = "layer between two sigma levels";
NC_INT lv_ISBL10(lv_ISBL10);
lv_ISBL10: units = "hPa";
lv_ISBL10: long_name = "isobaric level";
NC_DOUBLE initial_time0_encoded(initial_time0_hours);
initial_time0_encoded: units = "yyyymmddhh.hh_frac";
initial_time0_encoded: long_name = "initial time encoded as double";
NC_DOUBLE initial_time0_hours(initial_time0_hours);
initial_time0_hours: units = "hours since 1800-01-01 00:00";
initial_time0_hours: long_name = "initial time";
...
数据中有好几个Level维:lv_PVL3, lv_ISBL4 = 26, lv_GPML5 = 3, lv_DBLY6 = 4, lv_ISBL7 = 2, lv_ISBL8 = 21, lv_SIGY9 = 4, lv_ISBL10 = 6。后面还有很多变量,不同变量的Level维可能不一样。这个数据还存在一个问题,数据解码中需要确定每个维的具体数值(通常是个一维数组),维的数值要从“坐标变量”中读取,所谓坐标变量就是一维变量的名称和变量的维的名称是一样的,比如这个x维变量:
NC_FLOAT lon_3(lon_3);
lon_3: units = "degrees_east";
lon_3: grid_description = "65160-point (181x360) global longitude-latitude grid. (0,0) at 0E, 90N, matrix layout. N.B.: prime meridian not duplicated.";
但是此数据中有几个维没有确切的坐标变量,比如维:lv_SIGY9,和它相关的两个变量的名称都不是lv_SIGY9:
NC_INT lv_SIGY9_l0(lv_SIGY9);
lv_SIGY9_l0: units = "sigma";
lv_SIGY9_l0: long_name = "layer between two sigma levels";
NC_INT lv_SIGY9_l1(lv_SIGY9);
lv_SIGY9_l1: units = "sigma";
lv_SIGY9_l1: long_name = "layer between two sigma levels";
这种情况只能随机用其中一个变量来当做坐标变量读取维的数值了。不知道还有什么更好的处理方法?
|
评分
-
查看全部评分
|