- 积分
- 2619
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-1-4
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2016-4-6 11:01:18
|
显示全部楼层
你好,是这样的,我现在按照一个网友的思路做的,能够读出我想要的边界范围的数据了,但是在截取时间段的时候我是通过将工作表中确定了边界范围的数据复制到Excel中,然后删掉不要的年份的数据。这样感觉确实繁琐。
读取边界范围数据代码如下:
tasdata = ncread('tas_Amon_bcc-csm1-1_historical_r1i1p1_185001-201212.nc','tas'); %读取降水资料
timedata = ncread('tas_Amon_bcc-csm1-1_historical_r1i1p1_185001-201212.nc','time'); %读取时间
londata = ncread('tas_Amon_bcc-csm1-1_historical_r1i1p1_185001-201212.nc','lon'); %读取经度
latdata = ncread('tas_Amon_bcc-csm1-1_historical_r1i1p1_185001-201212.nc','lat'); %读取纬度
tasdata=permute(tasdata, [2 1 3]);
[xx,yy,zz]=meshgrid(londata,latdata,timedata);
[xi,yi,zi]=meshgrid(98:2:102,38:2:42,timedata);
vi=interp3(xx,yy,zz,tasdata,xi,yi,zi);
这个nc文件的属性信息
Source:
E:\Work\tas_Amon_bcc-csm1-1_historical_r1i1p1_185001-201212.nc
Format:
classic
Global Attributes:
institution = 'Beijing Climate Center(BCC),China Meteorological Administration,China'
institute_id = 'BCC'
experiment_id = 'historical'
source = 'bcc-csm1-1:atmosphere: BCC_AGCM2.1 (T42L26); land: BCC_AVIM1.0;ocean: MOM4_L40 (tripolar, 1 lon x (1-1/3) lat, L40);sea ice: SIS (tripolar,1 lon x (1-1/3) lat)'
model_id = 'bcc-csm1-1'
forcing = 'Nat Ant GHG SD Oz Sl Vl SS Ds BC OC'
parent_experiment_id = 'piControl'
parent_experiment_rip = 'r1i1p1'
branch_time = 470
contact = 'Dr. Tongwen Wu (twwu@cma.gov.cn)'
history = 'Output from monthly mean data 2011-06-15T08:55:23Z CMOR rewrote data to comply with CF standards and CMIP5 requirements.'
comment = 'The experiment starts from piControl run at year 470. RCP8.5 scenario forcing data are used beyond year 2005.'
initialization_method = 1
physics_version = 1
tracking_id = '2ccf4c16-f21b-42f4-80d1-0dd0f131e922'
product = 'output'
experiment = 'historical'
frequency = 'mon'
creation_date = '2011-06-15T08:55:23Z'
Conventions = 'CF-1.4'
project_id = 'CMIP5'
table_id = 'Table Amon (11 April 2011) 1cfdc7322cf2f4a32614826fab42c1ab'
title = 'bcc-csm1-1 model output prepared for CMIP5 historical'
parent_experiment = 'pre-industrial control'
modeling_realm = 'atmos'
realization = 1
cmor_version = '2.5.6'
Dimensions:
time = 1956 (UNLIMITED)
lat = 64
lon = 128
bnds = 2
Variables:
time
Size: 1956x1
Dimensions: time
Datatype: double
Attributes:
bounds = 'time_bnds'
units = 'days since 1850-01-01'
calendar = 'noleap'
axis = 'T'
long_name = 'time'
standard_name = 'time'
time_bnds
Size: 2x1956
Dimensions: bnds,time
Datatype: double
lat
Size: 64x1
Dimensions: lat
Datatype: double
Attributes:
bounds = 'lat_bnds'
units = 'degrees_north'
axis = 'Y'
long_name = 'latitude'
standard_name = 'latitude'
lat_bnds
Size: 2x64
Dimensions: bnds,lat
Datatype: double
lon
Size: 128x1
Dimensions: lon
Datatype: double
Attributes:
bounds = 'lon_bnds'
units = 'degrees_east'
axis = 'X'
long_name = 'longitude'
standard_name = 'longitude'
lon_bnds
Size: 2x128
Dimensions: bnds,lon
Datatype: double
height
Size: 1x1
Dimensions:
Datatype: double
Attributes:
units = 'm'
axis = 'Z'
positive = 'up'
long_name = 'height'
standard_name = 'height'
tas
Size: 128x64x1956
Dimensions: lon,lat,time
Datatype: single
Attributes:
standard_name = 'air_temperature'
long_name = 'Near-Surface Air Temperature'
units = 'K'
original_name = 'TREFHT'
cell_methods = 'time: mean (interval: 20 mintues)'
cell_measures = 'area: areacella'
history = '2011-06-15T08:55:23Z altered by CMOR: Treated scalar dimension: 'height'.'
coordinates = 'height'
missing_value = 1.000000020040877e+20
_FillValue = 1.000000020040877e+20
associated_files = 'baseURL: http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation gridspecFile: gridspec_atmos_fx_bcc-csm1-1_historical_r0i0p0.nc areacella: areacella_fx_bcc-csm1-1_historical_r0i0p0.nc'
我现在想的是截取1960年1月到2012年12月的数据。
麻烦你给看一下 |
|