Accessing multiple NETCDF files in a loop

1 visualización (últimos 30 días)
Utsav
Utsav el 13 de En. de 2015
I have several NETCDF files (different times of day). Each gives me divergence profiles. I wish to call each files in a loop (and store variables separately.). For example "profile.20140730_015009.MDV.nc" isfirst .nc file .Actually I wish to produce time series plot with it later on.
ncid1=netcdf.open('profile.20140730_015009.MDV.nc','nowrite');
[ndim, nvar, natt, unlim] = netcdf.inq(ncid1)
[dimname, dimlength] = netcdf.inqDim(ncid1, 0)
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid1,0)
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid1,1)
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid1,2)
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid1,3)
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid1,4)
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid1,5)
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid1,6)
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid1,7)
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid1,8)
[varname, xtype, dimid, natt] = netcdf.inqVar(ncid1,9)
DIV = netcdf.getVar(ncid1,9,[0],[30])
DIVV=-(DIV);
z=netcdf.getVar(ncid1,5,0,30)
plot(DIVV,z);
axis([-3 3 0 15]);
xlabel ('Divergence (m/s^2)')
ylabel ('Vertical Height z (Km)')

Respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by