立即注册 登录
气象家园 返回首页

songsongguomiao的个人空间 http://bbs.06climate.com/?93984 [收藏] [复制] [分享] [RSS]

日志

下载的NECP再分析资料,需要将在CMIP5上面下载的NC文件统一分辨率

已有 187 次阅读2018-12-20 22:05

如下是写的代码,但是一直出错
未定义函数或变量 'xgv'。

出错 kc (line 26)
[X,Y] = ndgrid(xgv,ygv);
这是出错的反馈,请大家帮忙修改一下
数据格式如下:Source:
           I:\NCEP\air_sig_995\air.sig995.1960.nc
Format:
           netcdf4_classic
Global Attributes:
           Conventions   = 'COARDS'
           title         = 'mean daily NMC reanalysis (1960)'
           description   = 'Data is from NMC initialized reanalysis
                           (4x/day).  These are the 0.9950 sigma level values.'
           platform      = 'Model'
           history       = 'created 97/10/04 by Hoop (netCDF2.3)
                           Converted to chunked, deflated non-packed NetCDF4 2014/09'
           References    = 'http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanalysis.html'
           dataset_title = 'NCEP-NCAR Reanalysis 1'
Dimensions:
           lon  = 144
           lat  = 73
           time = 366   (UNLIMITED)
Variables:
    lat 
           Size:       73x1
           Dimensions: lat
           Datatype:   single
           Attributes:
                       units         = 'degrees_north'
                       actual_range  = [90 -90]
                       long_name     = 'Latitude'
                       standard_name = 'latitude'
                       axis          = 'Y'
    lon 
           Size:       144x1
           Dimensions: lon
           Datatype:   single
           Attributes:
                       units         = 'degrees_east'
                       long_name     = 'Longitude'
                       actual_range  = [0         357.5]
                       standard_name = 'longitude'
                       axis          = 'X'
    time
           Size:       366x1
           Dimensions: time
           Datatype:   double
           Attributes:
                       long_name     = 'Time'
                       delta_t       = '0000-00-01 00:00:00'
                       avg_period    = '0000-00-01 00:00:00'
                       standard_name = 'time'
                       axis          = 'T'
                       units         = 'hours since 1800-01-01 00:00:0.0'
                       actual_range  = [1402512  1411272]
    air 
           Size:       144x73x366
           Dimensions: lon,lat,time
           Datatype:   single
           Attributes:
                       long_name               = 'mean Daily Air temperature at sigma level 995'
                       units                   = 'degK'
                       precision               = 2
                       least_significant_digit = 1
                       GRIB_id                 = 11
                       GRIB_name               = 'TMP'
                       var_desc                = 'Air temperature'
                       dataset                 = 'NCEP Reanalysis Daily Averages'
                       level_desc              = 'Surface'
                       statistic               = 'Mean'
                       parent_stat             = 'Individual Obs'
                       missing_value           = -9.969209968386869e+36
                       actual_range            = [186.8        315.83]
                       valid_range             = [185.16        331.16]
chakanbinaliangxinxi
Source:
           I:\NCEP\air_sig_995\air.sig995.1960.nc
Format:
           netcdf4_classic
Global Attributes:
           Conventions   = 'COARDS'
           title         = 'mean daily NMC reanalysis (1960)'
           description   = 'Data is from NMC initialized reanalysis
                           (4x/day).  These are the 0.9950 sigma level values.'
           platform      = 'Model'
           history       = 'created 97/10/04 by Hoop (netCDF2.3)
                           Converted to chunked, deflated non-packed NetCDF4 2014/09'
           References    = 'http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanalysis.html'
           dataset_title = 'NCEP-NCAR Reanalysis 1'
Dimensions:
           lon  = 144
           lat  = 73
           time = 366   (UNLIMITED)
Variables:
    lat 
           Size:       73x1
           Dimensions: lat
           Datatype:   single
           Attributes:
                       units         = 'degrees_north'
                       actual_range  = [90 -90]
                       long_name     = 'Latitude'
                       standard_name = 'latitude'
                       axis          = 'Y'
    lon 
           Size:       144x1
           Dimensions: lon
           Datatype:   single
           Attributes:
                       units         = 'degrees_east'
                       long_name     = 'Longitude'
                       actual_range  = [0         357.5]
                       standard_name = 'longitude'
                       axis          = 'X'
    time
           Size:       366x1
           Dimensions: time
           Datatype:   double
           Attributes:
                       long_name     = 'Time'
                       delta_t       = '0000-00-01 00:00:00'
                       avg_period    = '0000-00-01 00:00:00'
                       standard_name = 'time'
                       axis          = 'T'
                       units         = 'hours since 1800-01-01 00:00:0.0'
                       actual_range  = [1402512  1411272]
    air 
           Size:       144x73x366
           Dimensions: lon,lat,time
           Datatype:   single
           Attributes:
                       long_name               = 'mean Daily Air temperature at sigma level 995'
                       units                   = 'degK'
                       precision               = 2
                       least_significant_digit = 1
                       GRIB_id                 = 11
                       GRIB_name               = 'TMP'
                       var_desc                = 'Air temperature'
                       dataset                 = 'NCEP Reanalysis Daily Averages'
                       level_desc              = 'Surface'
                       statistic               = 'Mean'
                       parent_stat             = 'Individual Obs'
                       missing_value           = -9.969209968386869e+36
                       actual_range            = [186.8        315.83]
                       valid_range             = [185.16        331.16]
以下是写的代码:
clc
clear all

inputpath='I:\NCEP\air_sig_995\';
outputpath='I:\NCEP\air_sig_995\';

%-------------------------------------------------------

input_netcdf=sprintf('%s%s',inputpath,'\*.nc');
inputfiles=dir(input_netcdf);
task_num=size(inputfiles,1);

PATH = dir('I:\NCEP\air_sig_995\');
data(366,30) =0;
for i=1:length(PATH)
    i
 currenttask=['I:\NCEP\air_sig_995\',PATH(i).name];
%  air=ncread(currenttask,'air',[64 31 1], [1 1 inf]);
% fid=netcdf.open('I:\NCEP\air_sig_995\')
% gv=netcdf.inqVarID(currenttask,'lon'); 
% lon=netcdf.getVar(currenttask,gv,'single'); 
%  ygv=netcdf.inqVarID(currenttask,'lat'); 
%  lat=netcdf.getVar(currenttask,ygv,'single');
 gv = 30:2.5:35;
 ygv = 112.5:2.5:120;
[X,Y] = ndgrid(xgv,ygv);

        V = air;
        F = griddedInterpolant(X, Y, V, 'nearest');

        xqgv = -49.975:0.05:49.975;
        yqgv = -179.975:0.05:179.975;
        [Xq,Yq] = ndgrid(xqgv,yqgv);
        Vq = F(Xq, Yq);
end

全部作者的其他最新日志

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册

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

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

返回顶部