- وب سایت جامع هوا و اقلیم شناسی ایران - https://climatology.ir -

داده های انسی در نرم افزار متلب + ویدیو

باسلام و درود خدمت شما بزرگواران

داده های شبکه ایی NCEP/NCAR در تارنمای سازمان ملی جو و اقیانوس ایالات متحده (www.noaa.gov) به نشانی لینک [1] قابل دستیابی است، در این تارنما اطلاعات رقومی و ترسیمی زیادی در بازه های زمانی مختلفی قرار دارد. عده ایی از دانشجویان در مراحل پژوهش خود نیاز دارند که این داده ها را از فرمت .nc خارج نمایند یا بخواهند در این نرم افزار به بررسی داده ها بپردازند، قصد دارم در ذیل ویدیویی درج نمایم که توسط Bernie دانشجوی دکتری (در گرایش جغرافیا در دانشگاه کالیفرنیا دیویس) تهیه شده است، در این ویدیو به فراخوانی، دستورات اطلاعات توصیفی داده ها، استخراج داده، استخراج طول و عرض جغرافیایی، ترسیم کرانه های سواحل و همچنین ترسیم نقشه و… درمحیط نرم افزار متلب پرداخته شده است، امید است این ویدیو مفید باشد.

منبع:

https://bernardobastien.com/codesandmodels/

ام فایل های [3] درج شده در این ویدیو و همچنین این ویدیو در منبع قابل دستیابی است.

کد:

%For a video tutorial go to http://bit.ly/2li8d2a
%By Bernardo Bastien

filename=’xndcaa.pmh9jul.nc’

%Read the header
ncdisp(filename)
%surf_temp

%Open the file in read only mode
ncid=netcdf.open(filename,’NOWRITE’)

%inspect num of dimensions, variables, attributes, unim
[ndim, nvar, natt, unlim]=netcdf.inq(ncid)

for i=0:nvar-1
[varname, xtype, dimid, natt]=netcdf.inqVar(ncid,i);
%xtype: 2=character, 3=short integer, 4=integer, 5=real, 6=double
%dimid: el uero de elementos, es el umero de columnas en la matriz
%because dimid = [0, 1, 2], an array with three elements. Moreover, the 1st
%dimension corresponds to “dimension number zero” given by Step 3, the 2nd dimension corresponds to
%”dimension number 1″, and the third dimension corresponds to “dimension number 2”. Therefore, the
%variable “precip” has the dimension of (144, 72, 12), with total of 144x72x12 elements of real numbers.
%The coordinates for the 1st, 2nd, and 3rd dimensions are defined by lon(144), lat(72), and time(12).
if strcmp(varname,’surf_temp’)==1
varnumber=i;
end

end

[varname, xtype, dimid, natt]=netcdf.inqVar(ncid,varnumber)

%extract info for each dimension
for i=1:length(dimid)
[dimname, dimlength]=netcdf.inqDim(ncid,dimid(1,i))
end

for i=0:nvar-1
[varname, xtype, dimid, natt]=netcdf.inqVar(ncid,i);

if strcmp(varname,’latitude’)==1
dimnumber=i
end

end

latitude=ncread(filename,’latitude’)
longitude=ncread(filename,’longitude’)

surface_temp=ncread(filename,’surf_temp’)

pcolor(longitude,latitude,surface_temp’)

load coast
hold on
plot(long,lat,’k’,’LineWidth’,1.5)
plot(long+360,lat,’k’,’LineWidth’,1.5)

دریافت فایل تمرین:

read_plot_netcdf_matlab [4]