


Load mesoscale operational POLCOMS meteorlogical input data and convert
to the cs3 operational surge model grid.
[metvar,X_send,Y_send] = extract_mesoscale(floc,ndays)
DESCRIPTION:
Extracts meteorological data from the met input files for the POLCOMS
operational model, and reformats it to fit the cs3 operational surge
model grid.
INPUT:
floc - location of the met data file to be converted
ndays - the number of days in the month of interest
OUTPUT:
metvar - array of met data ready to be interpolated onto the FVCOM
grid.
X_send, Y_send - x and y coordinates of the met data
Author(s):
Jenny Brown (National Oceanography Centre, Liverpool)
Karen Amoudry (National Oceanography Centre, Liverpool)
KJA revision history:
2013-08-07 Adapted original version from JMB to take the file location
as an input to the script.

0001 function [metvar,X_send,Y_send] = extract_mesoscale(floc,ndays) 0002 % Load mesoscale operational POLCOMS meteorlogical input data and convert 0003 % to the cs3 operational surge model grid. 0004 % 0005 % [metvar,X_send,Y_send] = extract_mesoscale(floc,ndays) 0006 % 0007 % DESCRIPTION: 0008 % Extracts meteorological data from the met input files for the POLCOMS 0009 % operational model, and reformats it to fit the cs3 operational surge 0010 % model grid. 0011 % 0012 % INPUT: 0013 % floc - location of the met data file to be converted 0014 % ndays - the number of days in the month of interest 0015 % 0016 % OUTPUT: 0017 % metvar - array of met data ready to be interpolated onto the FVCOM 0018 % grid. 0019 % X_send, Y_send - x and y coordinates of the met data 0020 % 0021 % Author(s): 0022 % Jenny Brown (National Oceanography Centre, Liverpool) 0023 % Karen Amoudry (National Oceanography Centre, Liverpool) 0024 % 0025 % KJA revision history: 0026 % 2013-08-07 Adapted original version from JMB to take the file location 0027 % as an input to the script. 0028 0029 A= load (fullfile(floc)); 0030 tint=24/3;%Time interval 3hrs 0031 days=ndays+2-1/tint; % number of days in month +2-1 to include extra day of output up to 21:00, the output before midnight of the next day 0032 % day 1 = 00:00 of the start day, day 1.5 = 12:00 of the start day 0033 0034 %POLCOMS meso met grid 0035 dx=0.11; dy=0.11; 0036 x1=-13; 0037 y1=48.39; 0038 nx=218; 0039 ny=136; 0040 x2=(nx-1)*dx+x1; 0041 y2=(ny-1)*dy+y1; 0042 [X,Y]=meshgrid(x1:dx:x2,y1:dy:y2);%grid 0043 X_send = x1:dx:x2; 0044 Y_send = y1:dy:y2; 0045 0046 C=zeros(ny*days*tint,nx);%ygrid*number of days * outputs per day, xgrid 0047 jj=1; 0048 for ii=1:(ny*nx):length(A) %total length every 3 hours output 0049 % B = reshape(A(ii,ii+29647),136,218); 0050 C(jj:jj+ny-1,:) = reshape(A(ii:ii+nx*ny-1),nx,ny)'; 0051 jj=jj+ny; 0052 end 0053 0054 % Reshape C to have form ny x nx x days*tint 0055 metvar = zeros(ny,nx,days*tint); 0056 jj=1; 0057 for kk = 1:ny:length(C) 0058 metvar(:,:,jj) = C(kk:kk+ny-1,:); 0059 jj = jj+1; 0060 end 0061 0062 %% 0063 % for kk=1:ny:length(C) 0064 % figure(3) 0065 % pcolor(X,Y,C(kk:kk+ny-1,:)) 0066 % shading interp 0067 % hold on 0068 % colorbar 0069 % end 0070 0071