79 lines
3.5 KiB
Matlab
79 lines
3.5 KiB
Matlab
%% NCOM download
|
|
Count=1;
|
|
for Day = 2:10
|
|
for t=[45 48 51 54 57 60]
|
|
url =['https://ecowatch.ncddc.noaa.gov/thredds/fileServer/us_east/ncom_relo_useast_u_201909' ...
|
|
num2str(Day,'%02d') '00_t0' num2str(t,'%02d') '.nc'];
|
|
websave(['D:\Alexander\NCOM\201909' ...
|
|
num2str(Day,'%02d') '00_t0' num2str(t,'%02d') '.nc'],url)
|
|
disp(['201909' num2str(Day,'%02d') '00_t0' num2str(t,'%02d')])
|
|
end
|
|
end
|
|
|
|
%%
|
|
NCOM.Lat = ncread('https://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom_us_east_agg/US_East_Apr_05_2013_to_Current_best.ncd',...
|
|
'lat',[331],[240]);
|
|
NCOM.Lon = ncread('https://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom_us_east_agg/US_East_Apr_05_2013_to_Current_best.ncd',...
|
|
'lon',91,180);
|
|
NCOM.depth = ncread('https://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom_us_east_agg/US_East_Apr_05_2013_to_Current_best.ncd',...
|
|
'depth');
|
|
NCOM.time = ncread('https://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom_us_east_agg/US_East_Apr_05_2013_to_Current_best.ncd',...
|
|
'time',[9825],[624]);
|
|
NCOM.time_run = ncread('https://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom_us_east_agg/US_East_Apr_05_2013_to_Current_best.ncd',...
|
|
'time_run',[9825],[624]);
|
|
%[17775],[64]
|
|
for missStep = 1:length(MISSING)
|
|
tStep = MISSING(missStep)-1
|
|
noData=1
|
|
while noData==1
|
|
NCOM.water_u(:,:,:,tStep+1) = ncread('https://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom_us_east_agg/US_East_Apr_05_2013_to_Current_best.ncd',...
|
|
'water_u',[91 331 1 9825+tStep],[180 240 inf 1],[1 1 1 1]);
|
|
NCOM.water_v(:,:,:,tStep+1) = ncread('https://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom_us_east_agg/US_East_Apr_05_2013_to_Current_best.ncd',...
|
|
'water_v',[91 331 1 9825+tStep],[180 240 inf 1],[1 1 1 1]);
|
|
NCOM.surf_el(:,:,tStep+1) = ncread('https://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom_us_east_agg/US_East_Apr_05_2013_to_Current_best.ncd',...
|
|
'surf_el',[91 331 9825+tStep],[180 240 1],[1 1 1]);
|
|
NCOM.salinity(:,:,:,tStep+1) = ncread('https://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom_us_east_agg/US_East_Apr_05_2013_to_Current_best.ncd',...
|
|
'salinity',[91 331 1 9825+tStep],[180 240 inf 1],[1 1 1 1]);
|
|
if (squeeze(NCOM.water_v(100,100,1,tStep+1))==0|squeeze(NCOM.water_u(100,100,1,tStep+1))==0|squeeze(NCOM.surf_el(100,100,tStep+1))==0|squeeze(NCOM.salinity(100,100,1,tStep+1))==0)==1
|
|
noData=1
|
|
else
|
|
noData=0
|
|
end
|
|
end
|
|
disp(missStep)
|
|
|
|
end
|
|
save('NCOM_2016_V4.mat','-v7.3','NCOM')
|
|
% https://ecowatch.ncddc.noaa.gov/thredds/dodsC/ncom_us_east_agg/US_East_Apr_05_2013_to_Current_best.ncd?lon[0:1:543],lat[0:1:663],depth[0:1:39],time[17774:1:17838],time_run[17774:1:17838],water_u[17774:1:17838][0:1:39][0:1:663][0:1:543],water_v[17774:1:17838][0:1:39][0:1:663][0:1:543],water_temp[17774:1:17838][0:1:39][0:1:663][0:1:543],salinity[17774:1:17838][0:1:39][0:1:663][0:1:543]
|
|
|
|
|
|
%%
|
|
|
|
|
|
NCOM.mag = vecmag(NCOM.water_u,NCOM.water_v);
|
|
depthWeight = [diff(NCOM.depth)' 0];
|
|
|
|
for Layer = 1:40
|
|
DAVfac(:,:,Layer,:) = ones(180,240,1,64).*depthWeight(Layer);
|
|
end
|
|
DAVtrue = DAVfac;
|
|
DAVtrue(isnan(NCOM.mag)==1) = 0;
|
|
DAVfac(isnan(NCOM.mag)==1) = nan;
|
|
DAVFac2 = sum(DAVtrue,3);
|
|
clear DAVtrue
|
|
NCOM.dav = nansum(DAVfac.*NCOM.mag,3)./DAVFac2;
|
|
NCOM.davX = nansum(DAVfac.*NCOM.water_u,3)./DAVFac2;
|
|
NCOM.davY = nansum(DAVfac.*NCOM.water_v,3)./DAVFac2;
|
|
|
|
save('NCOM2016Final.mat','NCOM')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|