Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How to read more than one netcdf file?

1 visualización (últimos 30 días)
Jonas Damsbo
Jonas Damsbo el 21 de Nov. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
I got around 480 netcdf-files that needs to be run in the same matlab-script. The files are named in a logical format, like this:
January79, February79, Marts79, April79, May79, June79, July79, August79, September79, October79, November79, December79, January80 and so on.
To open one file I do this:
filename='December81.nc'
%Shows the contents of the file
ncdisp(filename)
%Open in read mode
ncid=netcdf.open(filename,'NOWRITE')
%Loads dimensions, variables, attributtes, unim
[ndim, nvar, natt, unlim]=netcdf.inq(ncid)
for i=0:nvar-1
[varname, xtype, dimid, natt]=netcdf.inqVar(ncid,i);
if strcmp(varname,'surf_temp')==1
varnumber=i;
end
end
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
%Defines logitudes, latitudes, time og z
lon = ncread(filename,'longitude') ; nx = length(lon) ;
lat = ncread(filename,'latitude') ; ny = length(lat) ;
time = ncread(filename,'time') ; nt = length(time);
z = ncread(filename,'z') ; nz = length(z)
So my question is, how do I open more files, such as December81, January82 and February82 so I can use these data from this months in one script?

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by