1 %% Copyright (C) 2005 Alexander Barth
3 %% This program is free software; you can redistribute it and/or modify
4 %% it under the terms of the GNU General Public License as published by
5 %% the Free Software Foundation; either version 2 of the License, or
6 %% (at your option) any later version.
8 %% This program is distributed in the hope that it will be useful,
9 %% but WITHOUT ANY WARRANTY; without even the implied warranty of
10 %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 %% GNU General Public License for more details.
13 %% You should have received a copy of the GNU General Public License
14 %% along with this program; If not, see <http://www.gnu.org/licenses/>.
16 % Example for loading a dataset from an OPeNDAP server
18 nc = netcdf('http://hycom.coaps.fsu.edu/thredds/dodsC/atl_ops','r');
20 lat = nc{'Latitude'}(:);
21 lon = nc{'Longitude'}(:);
24 disp(['SSH forecast for part of the North Atlantic for ' datestr(datenum(1900,12,31) + time)]);
27 % Select the SSH for part of the North Atlantic
30 i = find(-92 < lon & lon < -51);
31 j = find(23 < lat & lat < 45);
38 ssh = nc{'ssh'}(end,j,i);
40 fillval = nc{'ssh'}._FillValue;
41 ssh(ssh == fillval) = NaN;
43 % With autonan, i.e. every _FillValue is replaced by a NaN
44 % nv = ncautonan(nc{'ssh'},1);