Commit a73f0b5e authored by Pierre Cazenave's avatar Pierre Cazenave

Fix opening and closing netCDF handles for changes in the source URL to work...

Fix opening and closing netCDF handles for changes in the source URL to work (i.e. when getting data from different URLs on the HYCOM server).
parent b79bdf63
......@@ -224,7 +224,7 @@ end
% structure onto the FVCOM sigma levels.
data.Depth.data = netcdf.getVar(ncid, varid, 'double');
% netcdf.close(ncid)
netcdf.close(ncid)
% Get the number of vertical levels.
nz = length(data.Depth.data);
......@@ -240,9 +240,6 @@ for vv = 1:length(varlist)
end
end
% Open the initial connection.
ncid = netcdf.open(hycom.MT, 'NOWRITE');
c = 1; % counter for the tmjd cell array.
for tt = 1:nt
......@@ -282,8 +279,6 @@ for tt = 1:nt
elseif times(tt) >= greg2mjulian(2008, 09, 19, 0, 0, 0)
hycom.MT = [url, suffix.MT{2}];
end
% Close the existing connection and start a new one.
netcdf.close(ncid)
ncid = netcdf.open(hycom.MT, 'NOWRITE');
try
varid = netcdf.inqVarID(ncid, 'MT');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment