websave downloaded file different than manually downloaded

1 view (last 30 days)
I'm trying to download some *.nc files direct from some url using websave. It can successfully download the files but the file size is different than the file I manually downloaded from the browser. Here is the file source: http://opendap.co-ops.nos.noaa.gov/index.php?dir=/netcdf/nyofs/201603/ The nc file with size of 1 MB shows only 25 KB with Matlab download.
starting_date = datenum('2016-03-01');
end_date = datenum('2016-03-02');
tic;
for n =1: end_date-starting_date
current_date_download = starting_date + n -1;
for t = 0 : 23
posext = ['.t',sprintf('%02s',num2str(t)),'z.nc'];
filename = ['nos.nyofs_fg.stations.nowcast.',datestr(current_date_download,'yyyymmdd'),posext];
sprintf('processing %s - %02d z download\n',datestr(current_date_download),t)
url = ['http://opendap.co-ops.nos.noaa.gov/netcdf/nyofs/',datestr(current_date_download,'yyyymm'), ...
'/',filename];
sprintf('Downloading %s , please waiting ...\n', url)
options = weboptions('RequestMethod','post');
try
outfilename = websave(filename, url,options);
%urlwrite(url,filename)
catch
warning('file does not exsit, check url');
end
end
end
sprintf('Job successfully finished for downloading nc files!!')
toc;

Answers (0)

Categories

Find more on Downloads in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!