Matlab处理气象数据(一)读取NCEP数据

数据获取

NCEP数据air.2m.mon.mean.nc,下载地址

读取

使用matlab命令读取NCEP数据。

常用的读取NC头文件的命令是 nc_dumpncdisp

执行nc_dump命令:

nc_dump('E:\数据\空间数据\NECP\air.2m.mon.mean.nc ')

得到如下结果:

NetCDF-3 Classic E:\数据\空间数据\NECP\air.2m.mon.mean.nc {
     
dimensions:
	lon = 192 ;
	lat = 94 ;
	level = 1 ;
	nbnds = 2 ;
	time = UNLIMITED ; (420 currently)

variables:
	// Preference 'PRESERVE_FVD':  false,
	// dimensions consistent with ncBrowse, not with native MATLAB netcdf package.
	single level(level), shape = [1]
		level:units = "m" ;
		level:actual_range = 2.000000 2.000000 f;
		level:long_name = "Level" ;
		level:positive = "up" ;
		level:axis = "Z" ;
		level:coordinate_defines = "point" ;
	single lat(lat), shape = [94]
		lat:units = "degrees_north" ;
		lat:actual_range = 88.542000 -88.542000 f;
		lat:long_name = "Latitude" ;
		lat:standard_name = "latitude" ;
		lat:axis = "Y" ;
		lat:coordinate_defines = "point" ;
	single lon(lon), shape = [192]
		lon:units = "degrees_east" ;
		lon:long_name = "Longitude" ;
		lon:actual_range = 0.000000 358.125000 f;
		lon:standard_name = "longitude" ;
		lon:axis = "X" ;
		lon:coordinate_defines = "point" ;
	double time(time), shape = [420]
		time:units = "hours since 1800-1-1 00:00:00" ;
		time:long_name = "Time" ;
		time:actual_range = 1.56907e+06 1.87514e+06 ;
		time:delta_t = "0000-01-00 00:00:00" ;
		time:avg_period = "0000-01-00 00:00:00" ;
		time:prev_avg_period = "0000-00-01 00:00:00" ;
		time:standard_name = "time" ;
		time:axis = "T" ;
		time:coordinate_defines = "start" ;
		time:bounds = "time_bnds" ;
	double time_bnds(time,nbnds), shape = [420 2]
		time_bnds:long_name = "Time Boundaries" ;
	int16 air(time,level,lat,lon), shape = [420 1 94 192]
		air:long_name = "Monthly Mean of Forecast of Air temperature at 2 m" ;
		air:valid_range = -32765 -1765 s;
		air:unpacked_valid_range = 120.000000 430.000000 f;
		air:actual_range = 197.623840 313.472626 f;
		air:units = "degK" ;
		air:add_offset = 447.649994 f;
		air:scale_factor = 0.010000 f;
		air:missing_value = 32766 s;
		air:_FillValue = -32767 s;
		air:precision = 2 s;
		air:least_significant_digit = 1 s;
		air:GRIB_id = 11 s;
		air:GRIB_name = "TMP" ;
		air:var_desc = "Air temperature" ;
		air:dataset = "NCEP/DOE AMIP-II Reanalysis (Reanalysis-2) Monthly Averages" ;
		air:level_desc = "2 m" ;
		air:statistic = "Mean" ;
		air:parent_stat = "Individual Obs" ;
		air:standard_name = "air_temperature" ;
		air:cell_methods = "time: mean (interval: 6 hours to daily) time: mean (interval: 1 day to monthly)" ;

//global attributes:
		:Conventions = "CF-1.0" ;
		:title = "Monthly NCEP/DOE Reanalysis 2" ;
		:history = "created 2002/03 by Hoop (netCDF2.3)" ;
		:comments = "Data is from 
NCEP/DOE AMIP-II Reanalysis (Reanalysis-2)
(4x/day).  Data interpolated from model (sigma) surfaces to gaussian grid." ;
		:platform = "Model" ;
		:source = "NCEP/DOE AMIP-II Reanalysis (Reanalysis-2) Model" ;
		:institution = "National Centers for Environmental Prediction" ;
		:references = "http://wesley.wwb.noaa.gov/reanalysis2/
http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanalysis2.html" ;

执行ncdisp命令:

ncdisp('E:\数据\空间数据\NECP\air.2m.mon.mean.nc ')
Time_bndsData  = ncread('E:\数据\空间数据\NECP\air.2m.mon.mean.nc','time_bnds'); %读入变量time_bnds

得到以下结果:

Source:
           E:\数据\空间数据\NECP\air.2m.mon.mean.nc
Format:
           classic
Global Attributes:
           Conventions = 'CF-1.0'
           title       = 'Monthly NCEP/DOE Reanalysis 2'
           history     = 'created 2002/03 by Hoop (netCDF2.3)'
           comments    = 'Data is from 
                         NCEP/DOE AMIP-II Reanalysis (Reanalysis-2)
                         (4x/day).  Data interpolated from model (sigma) surfaces to gaussian grid.'
           platform    = 'Model'
           source      = 'NCEP/DOE AMIP-II Reanalysis (Reanalysis-2) Model'
           institution = 'National Centers for Environmental Prediction'
           references  = 'http://wesley.wwb.noaa.gov/reanalysis2/
                         http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanalysis2.html'
Dimensions:
           lon   = 192
           lat   = 94
           level = 1
           nbnds = 2
           time  = 420   (UNLIMITED)
Variables:
    level    
           Size:       1x1
           Dimensions: level
           Datatype:   single
           Attributes:
                       units              = 'm'
                       actual_range       = [2.00e+00 2.00e+00]
                       long_name          = 'Level'
                       positive           = 'up'
                       axis               = 'Z'
                       coordinate_defines = 'point'
    lat      
           Size:       94x1
           Dimensions: lat
           Datatype:   single
           Attributes:
                       units              = 'degrees_north'
                       actual_range       = [8.85e+01 -8.85e+01]
                       long_name          = 'Latitude'
                       standard_name      = 'latitude'
                       axis               = 'Y'
                       coordinate_defines = 'point'
    lon      
           Size:       192x1
           Dimensions: lon
           Datatype:   single
           Attributes:
                       units              = 'degrees_east'
                       long_name          = 'Longitude'
                       actual_range       = [0.00e+00 3.58e+02]
                       standard_name      = 'longitude'
                       axis               = 'X'
                       coordinate_defines = 'point'
    time     
           Size:       420x1
           Dimensions: time
           Datatype:   double
           Attributes:
                       units              = 'hours since 1800-1-1 00:00:00'
                       long_name          = 'Time'
                       actual_range       = [1.57e+06 1.88e+06]
                       delta_t            = '0000-01-00 00:00:00'
                       avg_period         = '0000-01-00 00:00:00'
                       prev_avg_period    = '0000-00-01 00:00:00'
                       standard_name      = 'time'
                       axis               = 'T'
                       coordinate_defines = 'start'
                       bounds             = 'time_bnds'
    time_bnds
           Size:       2x420
           Dimensions: nbnds,time
           Datatype:   double
           Attributes:
                       long_name = 'Time Boundaries'
    air      
           Size:       192x94x1x420
           Dimensions: lon,lat,level,time
           Datatype:   int16
           Attributes:
                       long_name               = 'Monthly Mean of Forecast of Air temperature at 2 m'
                       valid_range             = [-3.28e+04 -1.77e+03]
                       unpacked_valid_range    = [1.20e+02 4.30e+02]
                       actual_range            = [1.98e+02 3.13e+02]
                       units                   = 'degK'
                       add_offset              = 448
                       scale_factor            = 0.01
                       missing_value           = 3.28e+04
                       _FillValue              = -3.28e+04
                       precision               = 2
                       least_significant_digit = 1
                       GRIB_id                 = 11
                       GRIB_name               = 'TMP'
                       var_desc                = 'Air temperature'
                       dataset                 = 'NCEP/DOE AMIP-II Reanalysis (Reanalysis-2) Monthly Averages'
                       level_desc              = '2 m'
                       statistic               = 'Mean'
                       parent_stat             = 'Individual Obs'
                       standard_name           = 'air_temperature'
                       cell_methods            = 'time: mean (interval: 6 hours to daily) time: mean (interval: 1 day to monthly)'

另外,还可以用nc_varget来读取数据,如:

lon=nc_varget('E:\数据\空间数据\NECP\air.2m.mon.mean.nc','lon');%查看经度的范围
lat=nc_varget('E:\数据\空间数据\NECP\air.2m.mon.mean.nc','lat'); %查看纬度的范围
data=nc_varget('E:\数据\空间数据\NECP\air.2m.mon.mean.nc','air',[0 0 0 0],[420 1 94 192]);%取值范围从[0 0 0 0][time level lat 1on]

由以上命令可以得知,此NCEP数据为192*94*420的高维数组,经度范围是[0,358.1250],纬度范围是[88.5420,-88.5420],时间范围在数据里没给出,但从网站的数据说明中可以知道是1979年1月到2013年12月。(2016年1月13日查询到,此数据已经更新到了2015年7月)。

相关链接:
Matlab处理气象数据——目录

你可能感兴趣的:(气象,Matlab,matlab)