Matlab處理氣象數據(一)讀取NCEP數據

數據獲取

NCEP數據air.2m.mon.mean.nc,下載地址

讀取

使用matlab命令讀取NCEP數據。

常用的讀取NC頭文件的命令是 nc_dumpnc_dump

執行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處理氣象數據——目錄

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章