Commit 961ef70d authored by Pierre Cazenave's avatar Pierre Cazenave

Split long lines.

parent 4241fd52
......@@ -114,16 +114,36 @@ for t = 1:nt
% Set up a struct of the remote locations in which we're
% interested.
url = 'http://nomads.ncdc.noaa.gov/thredds/dodsC/cfsr1hr/';
ncep.dlwsfc = [url, sprintf('%04d%02d/dlwsfc.gdas.%04d%02d.grb2', year, month, year, month)];
ncep.dswsfc = [url, sprintf('%04d%02d/dswsfc.gdas.%04d%02d.grb2', year, month, year, month)];
ncep.lhtfl = [url, sprintf('%04d%02d/lhtfl.gdas.%04d%02d.grb2', year, month, year, month)];
ncep.prate = [url, sprintf('%04d%02d/prate.gdas.%04d%02d.grb2', year, month, year, month)];
ncep.pressfc = [url, sprintf('%04d%02d/pressfc.gdas.%04d%02d.grb2', year, month, year, month)];
ncep.q2m = [url, sprintf('%04d%02d/q2m.gdas.%04d%02d.grb2', year, month, year, month)];
ncep.tmp2m = [url, sprintf('%04d%02d/tmp2m.gdas.%04d%02d.grb2', year, month, year, month)];
ncep.uswsfc = [url, sprintf('%04d%02d/uswsfc.gdas.%04d%02d.grb2', year, month, year, month)];
ncep.uwnd = [url, sprintf('%04d%02d/wnd10m.gdas.%04d%02d.grb2', year, month, year, month)];
ncep.vwnd = [url, sprintf('%04d%02d/wnd10m.gdas.%04d%02d.grb2', year, month, year, month)];
ncep.dlwsfc = [url, ...
sprintf('%04d%02d/dlwsfc.gdas.%04d%02d.grb2', year, month, ...
year, month)];
ncep.dswsfc = [url, ...
sprintf('%04d%02d/dswsfc.gdas.%04d%02d.grb2', year, month, ...
year, month)];
ncep.lhtfl = [url, ...
sprintf('%04d%02d/lhtfl.gdas.%04d%02d.grb2', year, month, ...
year, month)];
ncep.prate = [url, ...
sprintf('%04d%02d/prate.gdas.%04d%02d.grb2', year, month, ...
year, month)];
ncep.pressfc = [url, ...
sprintf('%04d%02d/pressfc.gdas.%04d%02d.grb2', year, month, ...
year, month)];
ncep.q2m = [url, ...
sprintf('%04d%02d/q2m.gdas.%04d%02d.grb2', year, month, ...
year, month)];
ncep.tmp2m = [url, ...
sprintf('%04d%02d/tmp2m.gdas.%04d%02d.grb2', year, month, ...
year, month)];
ncep.uswsfc = [url, ...
sprintf('%04d%02d/uswsfc.gdas.%04d%02d.grb2', year, month, ...
year, month)];
ncep.uwnd = [url, ...
sprintf('%04d%02d/wnd10m.gdas.%04d%02d.grb2', year, month, ...
year, month)];
ncep.vwnd = [url, ...
sprintf('%04d%02d/wnd10m.gdas.%04d%02d.grb2', year, month, ...
year, month)];
% We need variable names too since we can't store them as the keys in
% ncep due to characters which MATLAB won't allow in fields (mainly -).
......@@ -242,7 +262,8 @@ for t = 1:nt
% This is OK, we can just shunt the values by 360.
extents(1) = extents(1) + 360;
extents(2) = extents(2) + 360;
index_lon = find(data_lon.lon > extents(1) & data_lon.lon < extents(2));
index_lon = find(data_lon.lon > extents(1) & ...
data_lon.lon < extents(2));
elseif extents(1) < 0 && extents(2) > 0
% This is the tricky one. We'll do two passes to extract the
% western chunk first (extents(1) + 360 to 360), then the
......@@ -252,7 +273,8 @@ for t = 1:nt
else
% Dead easy, we're in the eastern hemisphere, so nothing too
% strenuous here.
index_lon = find(data_lon.lon > extents(1) & data_lon.lon < extents(2));
index_lon = find(data_lon.lon > extents(1) & ...
data_lon.lon < extents(2));
end
% Latitude is much more straightforward
......@@ -288,7 +310,8 @@ for t = 1:nt
length(data_time_idx)];
end
data_west.(fields{aa}).(fields{aa}) = netcdf.getVar(ncid, varid, start, count, 'double');
data_west.(fields{aa}).(fields{aa}) = ...
netcdf.getVar(ncid, varid, start, count, 'double');
if length(dimids) == 4
start = [...
......@@ -404,7 +427,8 @@ for t = 1:nt
length(index_lat), ...
1, ...
length(data_time_idx)];
scratch.(fields{aa}).(fields{aa}) = netcdf.getVar(ncid, varid, start, count, 'double');
scratch.(fields{aa}).(fields{aa}) = ...
netcdf.getVar(ncid, varid, start, count, 'double');
end
end
......
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