爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4115|回复: 7

[讨论] 求助,关于Matlab读取nc数据之后对原nc数据分表率进行插值出错的问题

[复制链接]

新浪微博达人勋

发表于 2016-3-24 09:07:39 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
代码如下>> ncdisp('tas_day_ACCESS1-0_historical_r1i1p1_19750101-19991231.nc')

>> tas=ncread('tas_day_ACCESS1-0_historical_r1i1p1_19750101-19991231.nc','tas');
>> lon=ncread('tas_day_ACCESS1-0_historical_r1i1p1_19750101-19991231.nc','lon');
>> lat=ncread('tas_day_ACCESS1-0_historical_r1i1p1_19750101-19991231.nc','lat');
>> [lon1 lat1]=meshgrid(lon,lat);
>> tas1=tas(:,:,1);
>> [idx idx1]=find(lon1==15 & lat1==-85);
>> tas2=tas1(idx,idx1);
>> cellsize = 2;
>> [Z, refvec] = geoloc2grid(lon1, lat1, tas1, cellsize);

属性信息如下:
Format:
           classic
Global Attributes:
           institution           = 'CSIRO (Commonwealth Scientific and Industrial Research Organisation, Australia), and BOM (Bureau of Meteorology, Australia)'
           institute_id          = 'CSIRO-BOM'
           experiment_id         = 'historical'
           source                = 'ACCESS1-0 2011. Atmosphere: AGCM v1.0 (N96 grid-point, 1.875 degrees EW x approx 1.25 degree NS, 38 levels); ocean: NOAA/GFDL MOM4p1 (nominal 1.0 degree EW x 1.0 degrees NS, tripolar north of 65N, equatorial refinement to 1/3 degree from 10S to 10 N, cosine dependent NS south of 25S, 50 levels); sea ice: CICE4.1 (nominal 1.0 degree EW x 1.0 degrees NS, tripolar north of 65N, equatorial refinement to 1/3 degree from 10S to 10 N, cosine dependent NS south of 25S); land: MOSES2 (1.875 degree EW x 1.25 degree NS, 4 levels'
           model_id              = 'ACCESS1-0'
           forcing               = 'GHG, Oz, SA, Sl, Vl, BC, OC, (GHG = CO2, N2O, CH4, CFC11, CFC12, CFC113, HCFC22, HFC125, HFC134a)'
           parent_experiment_id  = 'piControl'
           parent_experiment_rip = 'r1i1p1'
           branch_time           = 109207
           contact               = 'The ACCESS wiki: http://wiki.csiro.au/confluence/display/ACCESS/Home. Contact Tony.Hirst@csiro.au regarding the ACCESS coupled climate model. Contact Peter.Uhe@csiro.au regarding ACCESS coupled climate model CMIP5 datasets.'
           history               = 'CMIP5 compliant file produced from raw ACCESS model output using the ACCESS Post-Processor and CMOR2. 2012-01-17T11:33:31Z CMOR rewrote data to comply with CF standards and CMIP5 requirements.'
           references            = 'See http://wiki.csiro.au/confluence/ ... ACCESS+Publications
           initialization_method = 1
           physics_version       = 1
           tracking_id           = 'c547e457-d35c-4a4f-9dc1-62826511e475'
           version_number        = 'v20120115'
           product               = 'output'
           experiment            = 'historical'
           frequency             = 'day'
           creation_date         = '2012-01-17T11:33:31Z'
           Conventions           = 'CF-1.4'
           project_id            = 'CMIP5'
           table_id              = 'Table day (27 April 2011) 38b0ef063ca8bcf7f2436f94c40ed33c'
           title                 = 'ACCESS1-0 model output prepared for CMIP5 historical'
           parent_experiment     = 'pre-industrial control'
           modeling_realm        = 'atmos'
           realization           = 1
           cmor_version          = '2.8.0'
Dimensions:
           time = 9131  (UNLIMITED)
           lat  = 145
           lon  = 192
           bnds = 2
Variables:
    time     
           Size:       9131x1
           Dimensions: time
           Datatype:   double
           Attributes:
                       bounds        = 'time_bnds'
                       units         = 'days since 0001-01-01'
                       calendar      = 'proleptic_gregorian'
                       axis          = 'T'
                       long_name     = 'time'
                       standard_name = 'time'
    time_bnds
           Size:       2x9131
           Dimensions: bnds,time
           Datatype:   double
    lat      
           Size:       145x1
           Dimensions: lat
           Datatype:   double
           Attributes:
                       bounds        = 'lat_bnds'
                       units         = 'degrees_north'
                       axis          = 'Y'
                       long_name     = 'latitude'
                       standard_name = 'latitude'
    lat_bnds
           Size:       2x145
           Dimensions: bnds,lat
           Datatype:   double
    lon      
           Size:       192x1
           Dimensions: lon
           Datatype:   double
           Attributes:
                       bounds        = 'lon_bnds'
                       units         = 'degrees_east'
                       axis          = 'X'
                       long_name     = 'longitude'
                       standard_name = 'longitude'
    lon_bnds
           Size:       2x192
           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:       192x145x9131
           Dimensions: lon,lat,time
           Datatype:   single
           Attributes:
                       standard_name    = 'air_temperature'
                       long_name        = 'Near-Surface Air Temperature'
                       units            = 'K'
                       cell_methods     = 'time: mean'
                       cell_measures    = 'area: areacella'
                       history          = '2012-01-17T11:33:30Z altered by CMOR: Treated scalar dimension: 'height'. 2012-01-17T11:33:30Z altered by CMOR: replaced missing value flag (-1.07374e+09) with standard missing value (1e+20).'
                       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_ACCESS1-0_historical_r0i0p0.nc areacella: areacella_fx_ACCESS1-0_historical_r0i0p0.nc'
>> tas=ncread('tas_day_ACCESS1-0_historical_r1i1p1_19750101-19991231.nc','tas');


最后的插值是运行出错提示
>> [Z, refvec] = geoloc2grid(lon1, lat1, tas1, cellsize);
错误使用 geoloc2grid (line 55)
LAT and LON must have the same size as A.
然后我就不知道咋办了0.0
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-3-24 09:40:24 | 显示全部楼层
原nc数据是1.875°×1.25°的,我想把它插值成2°×2°的。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-3-24 16:30:29 | 显示全部楼层
lon1, lat1, tas1这三个变量行列数应一致吧
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-3-24 18:57:14 | 显示全部楼层
rs06 发表于 2016-3-24 16:30
lon1, lat1, tas1这三个变量行列数应一致吧

不是的,是这样的

                               
登录/注册后可看大图
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-3-24 18:59:07 | 显示全部楼层
rs06 发表于 2016-3-24 16:30
lon1, lat1, tas1这三个变量行列数应一致吧

没法发图,我打字好了。lon1和lat1都是145×192,而tas1是192×145,是不是我[lon1 lat1]=meshgrid(lon,lat);这一步弄反了呀
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-3-24 18:59:18 | 显示全部楼层
rs06 发表于 2016-3-24 16:30
lon1, lat1, tas1这三个变量行列数应一致吧

没法发图,我打字好了。lon1和lat1都是145×192,而tas1是192×145,是不是我
[lon1 lat1]=meshgrid(lon,lat);这一步弄反了呀
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-3-24 19:13:08 | 显示全部楼层
[Z, refvec] = geoloc2grid(lon, lat, tas1, cellsize); 你试试这个
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-3-24 19:27:56 | 显示全部楼层
rs06 发表于 2016-3-24 19:13
[Z, refvec] = geoloc2grid(lon, lat, tas1, cellsize); 你试试这个

你好,我刚才试着将[lon1 lat1]=meshgrid(lon,lat);改为[lon1 lat1]=meshgrid(lat,lon);,然后得到的lon1和lat1都是192×145的表格,而tas1也是192×145,然后再运行[Z, refvec] = geoloc2grid(lon1, lat1, tas1, cellsize);之后成功的插值了,但是得到的工作表格Z是90×179,而不是我理想中的90×180
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表