Commit 5eb0e887 authored by Pierre Cazenave's avatar Pierre Cazenave
Browse files

Merge branch 'dev' of github.com:pwcazenave/fvcom-toolbox into geoff.

parents 03df2384 9894493d
This diff is collapsed.
......@@ -24,10 +24,13 @@ function [Mobj] = add_obc_nodes_list(Mobj,Nlist,ObcName,ObcType,plotFig)
% Author(s):
% Geoff Cowles (University of Massachusetts Dartmouth)
% Pierre Cazenave (Plymouth Marine Laboratory)
%
% Karen Amoudry (National Oceanography Centre, Liverpool)
%
% Revision history:
% 2012-11-26 Add ability to turn off the figures.
% 2013-01-02 KJA bug fix: amended usage of 'unique' in line 53 to
% prevent it from sorting the values it returns. Amended by Pierre to
% support pre-2012 versions of MATLAB whilst giving the same result.
%
%==========================================================================
subname = 'add_obc_nodes';
......@@ -45,7 +48,10 @@ end
%--------------------------------------------------------------------------
% Get a unique list and make sure they are in the range of node numbers
%--------------------------------------------------------------------------
Nlist = unique(Nlist);
% Make this works in versions of MATLAB older than 2012a (newer versions
% can just use unique(A, 'stable'), but checking versions is a pain).
[~, Nidx] = unique(Nlist);
Nlist = Nlist(sort(Nidx));
if(max(Nlist) > Mobj.nVerts);
fprintf('your open boundary node number exceed the total number of nodes in the domain\n');
......
......@@ -20,12 +20,16 @@ function [Mobj] = add_river_nodes_list(Mobj,Nlist,RiverName)
%
% Author(s):
% Geoff Cowles (University of Massachusetts Dartmouth)
% Karen Amoudry (National Oceanography Centre, Liverpool)
%
% Note:
% Uses ginput2 which allows zooming before selecting points and displays
% clicked points realtime
%
% Revision history
% 2013-01-02 KJA bug fix: amended usage of 'unique' to prevent it from
% sorting the values it returns. Amended by Pierre to support pre-2012
% versions of MATLAB whilst giving the same result.
%
%==========================================================================
subname = 'add_river_nodes_list';
......@@ -38,7 +42,10 @@ end
%--------------------------------------------------------------------------
% Get a unique list and make sure they are in the range of node numbers
%--------------------------------------------------------------------------
Nlist = unique(Nlist);
% Make this works in versions of MATLAB older than 2012a (newer versions
% can just use unique(A, 'stable'), but checking versions is a pain).
[~, Nidx] = unique(Nlist);
Nlist = Nlist(sort(Nidx));
if max(Nlist) > Mobj.nVerts
fprintf('your river node number(s) exceed the total number of nodes in the domain\n');
......
......@@ -22,7 +22,13 @@ function [spongeRadius] = calc_sponge_radius(Mobj,Nlist)
% spongeRadius = calc_sponge_radius(Mobj,Nlist)
%
% Author(s)
% Karen Thurston (National Oceanography Centre, Liverpool)
% Karen Amoudry (National Oceanography Centre, Liverpool)
% Pierre Cazenave (Plymouth Marine Laboratory)
%
% Revision history:
% 2013-01-02 KJA bug fix: amended usage of 'unique' to prevent it from
% sorting the values it returns. Amended by Pierre to support pre-2012
% versions of MATLAB whilst giving the same result.
%
%==========================================================================
subname = 'calc_sponge_radius';
......@@ -35,7 +41,10 @@ end
%--------------------------------------------------------------------------
% Get a unique list and make sure they are in the range of node numbers
%--------------------------------------------------------------------------
Nlist = unique(Nlist);
% Make this works in versions of MATLAB older than 2012a (newer versions
% can just use unique(A, 'stable'), but checking versions is a pain).
[~, Nidx] = unique(Nlist);
Nlist = Nlist(sort(Nidx));
spongeRadius = 100000+zeros(size(Nlist));
......@@ -43,7 +52,9 @@ spongeRadius = 100000+zeros(size(Nlist));
for i =1:length(Nlist)
% Find the neighbouring nodes
[r,c]=find(Mobj.tri==Nlist(i));
neighbours = unique(Mobj.tri(r,:));
neighbours = Mobj.tri(r,:);
[~,neighidx] = unique(Mobj.tri(r,:));
neighbours = neighbours(sort(neighidx));
% Remove the node of interest from the neighbours list
n = find(neighbours~=Nlist(i));
......
function [metvar,X_send,Y_send] = extract_mesoscale(fname,ndays)
%load in the mesoscale data from mesoscale operational POLCOMS met input data and convert to cs3 operational surge model met data grid
% Script from JMB
A= load (fullfile('/work/kthurs/Met_data_processing_scripts/MESOSCALE/OUTPUT/',fname));
tint=24/3;%Time interval 3hrs
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
% day 1 = 00:00 of the start day, day 1.5 = 12:00 of the start day
%POLCOMS meso met grid
dx=0.11; dy=0.11;
x1=-13;
y1=48.39;
nx=218;
ny=136;
x2=(nx-1)*dx+x1;
y2=(ny-1)*dy+y1;
[X,Y]=meshgrid(x1:dx:x2,y1:dy:y2);%grid
X_send = x1:dx:x2;
Y_send = y1:dy:y2;
C=zeros(ny*days*tint,nx);%ygrid*number of days * outputs per day, xgrid
jj=1;
for ii=1:(ny*nx):length(A) %total length every 3 hours output
% B = reshape(A(ii,ii+29647),136,218);
C(jj:jj+ny-1,:) = reshape(A(ii:ii+nx*ny-1),nx,ny)';
jj=jj+ny;
end
% Reshape C to have form ny x nx x days*tint
metvar = zeros(ny,nx,days*tint);
jj=1;
for kk = 1:ny:length(C)
metvar(:,:,jj) = C(kk:kk+ny-1,:);
jj = jj+1;
end
%%
% % Load coastline
% load '~/POLCOMS/POLCOMS_matlab/N_Atlantic_coast_m.dat';
% x=N_Atlantic_coast_m(:,1);
% y=N_Atlantic_coast_m(:,2);
%
% %
% for kk=1:ny:length(C)
% figure(3)
% pcolor(X,Y,C(kk:kk+ny-1,:))
% shading interp
% hold on
% colorbar
% % %Plot coastline
% % plot(x,y,'k')
% % drawnow
% end
function [Mobj] = get_AMM(Mobj,StartDate,EndDate,ModelFolder)
% Extract boundary forcing information from NOC Operational Tide Surge
% Model output output
% Model output.
%
% function get_AMM(Mobj,StartDate,EndDate,ModelFolder)
%
......
......@@ -44,6 +44,7 @@ function Mobj = get_FVCOM_rivers(Mobj, dist_thresh)
%
% Author(s):
% Pierre Cazenave (Plymouth Marine Laboratory)
% Karen Amoudry (National Oceanography Centre, Liverpool)
%
% Revision history:
% 2013-03-27 - First version.
......
function data = get_MetUM_forcing(Mobj, modelTime, credentials)
function met_files = get_MetUM_pp(Mobj, modelTime, credentials)
% Get the required parameters from the Met Office Unified Model (TM)
% (hereafter MetUM) to use in FVCOM surface forcing.
%
% data = get_MetUM_forcing(Mobj, modelTime, credentials)
% data = get_MetUM_pp(Mobj, modelTime, credentials)
%
% DESCRIPTION:
% Using FTP access, extract the necessary parameters to create an FVCOM
......@@ -16,10 +16,9 @@ function data = get_MetUM_forcing(Mobj, modelTime, credentials)
% FTP server.
%
% OUTPUT:
% data - struct of the data necessary to force FVCOM. These can be
% interpolated onto an unstructured grid in Mobj using grid2fvcom.m.
% met_files - cell array of file names downloaded from the BADC servers.
%
% The required parameters which can be obtained are:
% The PP files downloaded give:
% - surface_net_downward_shortwave_flux (W m-2)
% - surface_downwelling_shortwave_flux_in_air (W m-2)
% - surface_net_downward_longwave_flux (W m-2)
......@@ -37,60 +36,88 @@ function data = get_MetUM_forcing(Mobj, modelTime, credentials)
% Precipitation is converted from kg/m^2/s to m/s. Evaporation is
% calculated from the mean daily latent heat net flux (lhtfl) at the
% surface.
%
% EXAMPLE USAGE:
% metum_forcing = get_MetUM_pp(Mobj, [51725, 51757], ...
% {'username', 'password'});
%
% REQUIRES:
% The air_sea toolbox:
% http://woodshole.er.usgs.gov/operations/sea-mat/air_sea-html/index.html
% TODO:
% Add support for the AP directories on the FTP server.
%
% Author(s)
% Pierre Cazenave (Plymouth Marine Laboratory)
%
% Revision history:
% 2013-05-07 First version.
% 2013-06-24 Update some of the code to correctly separate the different
% directories (e.g. am vs mn in 2010). Also farm out the FTP and
% conversion from PP format to NetCDF to separate functions
% (get_BADC_data.m and pp2nc.m, respectively). Renamed the function from
% get_MetUM_forcing to get_MetUM_pp to better reflect what it does.
%
%==========================================================================
subname = 'get_MetUM_forcing';
global ftbverbose;
if ftbverbose;
global ftbverbose
if ftbverbose
fprintf('\nbegin : %s \n', subname)
end
% Get the extent of the model domain (in spherical)
if ~Mobj.have_lonlat
error('Need spherical coordinates to extract the forcing data')
else
% Add a 1 degree buffer to make sure the model domain is fully covered
% by the extracted data.
[dx, dy] = deal(1, 1);
extents = [min(Mobj.lon(:))-(2*dx), max(Mobj.lon(:))+(2*dx), min(Mobj.lat(:))-dy, max(Mobj.lat(:))+dy];
end
nt = modelTime(end) - modelTime(1);
nt = ceil(modelTime(end)) - floor(modelTime(1));
if nt > 365
error('Can''t (yet) process more than a year at a time.')
end
[yearStart, monthStart, dayStart] = mjulian2greg(modelTime(1));
[yearEnd, monthEnd, dayEnd] = mjulian2greg(modelTime(end));
t = modelTime(1):1/4:modelTime(end);
yearStart = mjulian2greg(modelTime(1));
yearEnd = mjulian2greg(modelTime(end));
if yearEnd ~= yearStart
error('Can''t (yet) process across a year boundary.')
end
% Four times daily outputs at 0000, 0600, 1200 and 1800
t = modelTime(1):1/4:modelTime(end);
if yearStart < 2006 || yearEnd > 2012
error('The MetUM repository does not contain data earlier than 2006 and later than 2012')
end
assert(yearEnd == yearStart, 'Can''t (yet) process across a year boundary.')
assert(yearStart >= 2006 && yearEnd <= 2012, 'The MetUM repository does not contain data earlier than 2006 and later than 2012')
% For the pre-2006 data, we need to download several files with unique
% names. The names are based on the STASH numbers and the date:
% For the pre-2010 data, we need to download several files with
% unique names. The names are based on the STASH numbers and the date:
% naamYYYYMMDDHH_STASH#_00.pp
% The numbers we're interested in are stored in stash.
stash = [2, 3, 407, 408, 409, 4222, 9229, 16004];
vars = {'uwnd', 'uwnd', 'vwnd', 'vwnd', 'slp_rho', 'slp_theta', ...
'surface_air_pressure', 'air_sw', 'air_lw', ...
'rhum', 'prate', 'temp_model', 'temp_press'};
stash = [2, 3, 407, 408, 409, 4222, 9229, 16004, ...
1201, 1235, 2207, 2201, 3217, 3225, 3226, 3234, 3236, 3237, 3245, ...
5216, 16222, 20004];
% The stash numbers, and their corresponding forcing type:
%
% |---------|-------------------------------------------|
% | stash # | forcing type |
% |-----------------------------------------------------|
% | AM |
% |-----------------------------------------------------|
% | 2 | eastward_wind / x_wind |
% | 3 | northward_wind / y_wind |
% | 407 | air_pressure |
% | 408 | air_pressure |
% | 409 | surface_air_pressure |
% | 4222 | RAILFALL RATE OUT OF MODEL LEVELS |
% | 9229 | RELATIVE HUMIDITY AFTER MAIN CLOUD |
% | 16004 | air_temperature |
% |-----------------------------------------------------|
% | AP |
% |-----------------------------------------------------|
% | 1201 | surface_net_downward_shortwave_flux |
% | 1235 | surface_downwelling_shortwave_flux_in_air |
% | 2207 | surface_downwelling_longwave_flux_in_air |
% | 2201 | surface_net_downward_longwave_flux |
% | 3217 | surface_upward_sensible_heat_flux |
% | 3225 | eastward_wind / x_wind |
% | 3226 | northward_wind / y_wind |
% | 3234 | surface_upward_latenet_heat_flux |
% | 3236 | air_temperature |
% | 3237 | specific_humidity |
% | 3245 | relative_humidity |
% | 5216 | precipitation_flux |
% | 16222 | air_pressure_at_sea_level |
% | 20004 | [RIVER OUTFLOW] |
% |---------|-------------------------------------------|
%
ns = length(stash);
......@@ -98,9 +125,6 @@ ns = length(stash);
site = 'ftp.ceda.ac.uk';
basePath = 'badc/ukmo-um/data/nae/';
% Open a remote connection to the FTP site
remote = ftp(site, credentials(1), credentials(2));
% Depending on the year we're extracting, we need to append different
% directories to get the data.
for i = 1:nt * 4 % four files per day (at 0000, 0600, 1200 and 1800).
......@@ -112,10 +136,13 @@ for i = 1:nt * 4 % four files per day (at 0000, 0600, 1200 and 1800).
% Do 2010 first because it straddles the two directories.
if year == 2010
if month < 11 && day < 4
% Use modified julian dates for the thresholds for each directory.
amthresh = greg2mjulian(2010, 11, 03, 00, 00, 00);
if greg2mjulian(year, month, day, hour, 00, 00) <= amthresh
% Use the am data
prefix = 'am';
URL = sprintf('%sna/%s/%04d/%02d/%02d', basePath, ...
filepath = sprintf('%sna/%s/%04d/%02d/%02d', basePath, ...
prefix, ...
year, ...
month, ...
......@@ -129,10 +156,10 @@ for i = 1:nt * 4 % four files per day (at 0000, 0600, 1200 and 1800).
hour, ...
stash(f));
end
elseif month > 11 && day > 3
else
% Use the mn data
prefix = 'mn';
URL = sprintf('%sna/%s/%04d/%02d/%02d', basePath, ...
filepath = sprintf('%sna/%s/%04d/%02d/%02d', basePath, ...
prefix, ...
year, ...
month, ...
......@@ -144,6 +171,7 @@ for i = 1:nt * 4 % four files per day (at 0000, 0600, 1200 and 1800).
day, ...
hour);
end
sprintf('%s', filepath);
% Check the 2006 data are from the 7th November onwards.
elseif year == 2006
......@@ -152,7 +180,7 @@ for i = 1:nt * 4 % four files per day (at 0000, 0600, 1200 and 1800).
error('The MetUM repository does not contain data earlier than 7th November, 2006')
else
prefix = 'am';
URL = sprintf('%sna/%s/%04d/%02d/%02d', basePath, ...
filepath = sprintf('%sna/%s/%04d/%02d/%02d', basePath, ...
prefix, ...
year, ...
month, ...
......@@ -178,7 +206,7 @@ for i = 1:nt * 4 % four files per day (at 0000, 0600, 1200 and 1800).
error('The MetUM repository does not contain data later than 17th January, 2012')
else
prefix = 'mn';
URL = sprintf('%sna/%s/%04d/%02d/%02d', basePath, ...
filepath = sprintf('%sna/%s/%04d/%02d/%02d', basePath, ...
prefix, ...
year, ...
month, ...
......@@ -196,7 +224,7 @@ for i = 1:nt * 4 % four files per day (at 0000, 0600, 1200 and 1800).
elseif year < 2010
% Use the am data.
prefix = 'am';
URL = sprintf('%sna/%s/%04d/%02d/%02d', basePath, ...
filepath = sprintf('%sna/%s/%04d/%02d/%02d', basePath, ...
prefix, ...
year, ...
month, ...
......@@ -215,7 +243,7 @@ for i = 1:nt * 4 % four files per day (at 0000, 0600, 1200 and 1800).
elseif year > 2010
% Use the mn data.
prefix = 'mn';
URL = sprintf('%sna/%s/%04d/%02d/%02d', basePath, ...
filepath = sprintf('%sna/%s/%04d/%02d/%02d', basePath, ...
prefix, ...
year, ...
month, ...
......@@ -228,56 +256,10 @@ for i = 1:nt * 4 % four files per day (at 0000, 0600, 1200 and 1800).
hour);
end
fprintf('%s: %s\n', URL, files{1})
end
met_files{i} = get_BADC_data(site, filepath, files, credentials);
% Close the connection to the FTP server.
close(remote)
end
if ftbverbose
fprintf('end : %s \n', subname)
end
function ftpdata = get_badc_data(remote, URL, files)
% Child function to do the actual downloading from the BADC site via FTP.
%
% Inputs:
%
% remote - FTP object
% URL - path to the files to download
% files - cell array of a file or files to download
%
% Outputs:
%
% noidea...
if ~iscell(files)
error('Provide a cell array of files to download')
end
cd(remote, URL);
nf = length(files);
for i = 1:nf
tmpdata = mget(remote, files{i});
ftpdata.(vars{i}).data =
end
function pp2nc(file, convsh)
% Child function to call the convsh program to convert the obscure pp
% format to a sensible NetCDF which we can more easily read.
% Assume convsh is in /usr/local unless otherwise told.
if nargin == 1
convsh = '/usr/local/bin/convsh';
end
if exist(file, 'file') ~= 2
error('File %s not found', file)
end
[path, name, ext] = fileparts(file);
out = fullfile(path, [name, '.nc']);
system([convsh, '-i ',
......@@ -49,14 +49,14 @@ if isunix % Unix?
metfname = ['/bank/jane/met/',datestr(inputConf.startDate,'YYYY'),...
'/',lower(datestr(inputConf.startDate,'mmmYY')),'nae10R.dat'];
comprfname = '/login/jane/NAE2/metintco.cs3x.nae2.compress.2';
setupfname = '/work/jane/cs3x/prep/setupcs3xSGIL.uda';
setupfname = '/work/jane/cs3x/prep/setupcs3xSGIl.uda';
% elevfname = ['/bank/jane/cs3x/sarray.uda.',...
% datestr(inputConf.startDate,'YYYY')];
elseif ispc % Or Windows?
metfname = ['\\store\bank\jane\met\',datestr(inputConf.startDate,'YYYY'),...
'\',lower(datestr(inputConf.startDate,'mmmYY')),'nae10R.dat'];
comprfname = '\\store\kthurs\from_Jane\metintco.cs3x.nae2.compress.2';
setupfname = '\\store\work\jane\cs3x\prep\setupcs3xSGIL.uda';
setupfname = '\\store\work\jane\cs3x\prep\setupcs3xSGIl.uda';
% elevfname = ['\\store\bank\jane\cs3x\sarray.uda.',...
% datestr(inputConf.startDate,'YYYY')];
end
......
......@@ -66,11 +66,21 @@ function data = get_NCEP_forcing(Mobj, modelTime)
% the toolbox's need. Also, we're not actually using 'pevpr' for the
% calculation of evaporation since we're estimating that from the latent
% heat net flux ('lhtfl'), so it's superfluous anyway.
% 2013-06-28 Changed the way the Matlab version is determiend. Now using
% release date rather then version number. For example version 7.13 >
% verion 7.7 but 7.13 is not greater than 7.7.
%
%==========================================================================
subname = 'get_NCEP_forcing';
% Define date that matlab version 7.14 was released.
% OPeNDAP was included in version 7.14
% see http://en.wikipedia.org/wiki/MATLAB and
% https://publicwiki.deltares.nl/display/OET/OPeNDAP+access+with+Matlab
version_7_14_date = datenum(2012,3,1);
%version_7_13_date = datenum(2011,9,1);
global ftbverbose;
if ftbverbose
fprintf('\nbegin : %s\n', subname)
......@@ -111,6 +121,10 @@ ncep.lhtfl = ['http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanaly
ncep.shtfl = ['http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis/surface_gauss/shtfl.sfc.gauss.',num2str(year),'.nc'];
% ncep.pevpr = ['http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis/surface_gauss/pevpr.sfc.gauss.',num2str(year),'.nc'];
% Possible future data to use?
% Skin temperature
% ncep.skt = ['http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis/surface_gauss/skt.sfc.gauss.',num2str(year),'.nc'];
% The fields below can be used to create the net shortwave and longwave
% fluxes if the data you're using don't include net fluxes. Subtract the
% downward from upward fluxes to get net fluxes.
......@@ -132,7 +146,7 @@ for aa = 1:length(fields)
% libraries to load the OPeNDAP data, otherwise we need the relevant
% third-party toolbox.
out = ver('MATLAB');
if str2double(out.Version) > 7.13
if datenum(out.Date) > version_7_14_date % Look at the date rather than the version number
%ncid_info = ncinfo(ncep.(fields{aa}));
ncid = netcdf.open(ncep.(fields{aa}));
......@@ -208,7 +222,7 @@ for aa = 1:length(fields)
if iscell(index_lon)
data.(fields{aa}).lon = data_lon.lon(cat(1,index_lon{:}));
if str2double(out.Version) > 7.13
if datenum(out.Date) > version_7_14_date % Look at the date rather than the version number
% varidlon = netcdf.inqVarID(ncid,'lon');
% varidtime = netcdf.inqVarID(ncid,'time');
% varidlat = netcdf.inqVarID(ncid,'lat');
......@@ -282,7 +296,7 @@ for aa = 1:length(fields)
% We have a straightforward data extraction
data.(fields{aa}).lon = data_lon.lon(index_lon);
if str2double(out.Version) > 7.13
if datenum(out.Date) > version_7_14_date % Look at the date rather than the version number
varid = netcdf.inqVarID(ncid,(fields{aa}));
% [varname,xtype,dimids,natts] = netcdf.inqVar(ncid,varid);
% [~,length1] = netcdf.inqDim(ncid,dimids(1))
......@@ -327,6 +341,14 @@ end
% Now we have some data, we need to create some additional parameters
% required by FVCOM.
% FVCOM's sign convention is the opposite of the NCEP data for heat fluxes
% (FVCOM: positive = downward flux = ocean heating, negative = upward flux
% = ocean cooling. NCEP: positive = upward flux = ocean cooling, negative =
% downward flux = ocean heating). So, rather than do the corrections in
% create_files.m or wherever, do them here instead.
% data.nlwrs.data = -data.nlwrs.data;
% data.nswrs.data = -data.nswrs.data;
% Convert precipitation from kg/m^2/s to m/s (required by FVCOM) by
% dividing by freshwater density (kg/m^3).
data.prate.data = data.prate.data/1000;
......
......@@ -90,7 +90,7 @@ for ii = 1:todo
ncdata.(getVar).data = data;
else
if ndims(data) < 3
if strcmpi(varlist{var}, 'time')
if strcmpi(getVar, 'time')
% If the dimension is time, we need to be a bit more
% clever since we'll need a concatenated time series
% (in which values are continuous and from which we
......
......@@ -120,12 +120,6 @@ for t = 1:nt
% Get the current 3D array of PML POLCOMS-ERSEM results.
pctemp3 = pc.ETWD.data(:, :, :, t);
pcsalt3 = pc.x1XD.data(:, :, :, t);
% Flip the vertical layer dimension to make the POLCOMS data go from
% surface to seabed to match its depth data and to match how FVCOM
% works.
pctemp3 = flipdim(pctemp3, 3);
pcsalt3 = flipdim(pcsalt3, 3);
% Preallocate the intermediate results arrays.
itempz = nan(nf, nz);
......@@ -298,12 +292,12 @@ end
%%
% % Plot a vertical profile for a boundary node (for my Irish Sea case, this
% % is one of the ones along the Celtic Sea boundary). Also plot the
% % distribution of interpolated values over the POLCOMS data. Add the
% % location of the vertical profile (both FVCOM and POLCOMS) to the plot.
% Plot a vertical profile for a boundary node (for my Irish Sea case, this
% is one of the ones along the Celtic Sea boundary). Also plot the
% distribution of interpolated values over the POLCOMS data. Add the
% location of the vertical profile (both FVCOM and POLCOMS) to the plot.
% nn = 55; % open boundary index
% tt = 1; % time index
% tt = 1; % time index
%
% % Get the corresponding indices for the POLCOMS data
% [~, xidx] = min(abs(lon(1, :) - fvlon(nn)));
......@@ -322,7 +316,7 @@ end
% subplot(2,2,2)
% % Although POLCOMS stores its temperature values from seabed to surface,
% % the depths are stored surface to seabed. Nice.
% plot(squeeze(pc.ETWD.data(xidx, yidx, :, 1)), flipud(squeeze(pc.depth.data(xidx, yidx, :, 1))), 'rx-')
% plot(squeeze(pc.ETWD.data(xidx, yidx, :, 1)), squeeze(pc.depth.data(xidx, yidx, :, 1)), 'rx-')
% xlabel('Temperature (^{\circ}C)')
% ylabel('Depth (m)')
% title('POLCOMS')
......@@ -349,15 +343,15 @@ end
% dx = mean(diff(pc.lon.data));
% dy = mean(diff(pc.lat.data));
% pcolor(pc.lon.data - (dx / 2), pc.lat.data - (dy / 2), ...
% squeeze(pc.ETWD.data(:, :, end, tt))')
% squeeze(pc.ETWD.data(:, :, 1, tt))')
% shading flat
% axis('equal', 'tight')
% daspect([1.5, 1, 1])
% hold on
% % Add the interpolated surface data (first sigma layer)
% scatter(Mobj.lon(oNodes), Mobj.lat(oNodes), repmat(40, size(Mobj.lon(oNodes))), Mobj.temperature(:, 1, tt), 'filled', 'MarkerEdgeColor', 'k')
% scatter(Mobj.lon(oNodes), Mobj.lat(oNodes), 40, Mobj.temperature(:, 1, tt), 'filled', 'MarkerEdgeColor', 'k')
% axis([min(Mobj.lon(oNodes)), max(Mobj.lon(oNodes)), min(Mobj.lat(oNodes)), max(Mobj.lat(oNodes))])
% caxis([6, 12])
% caxis([6, 20])
% plot(lon(yidx, xidx), lat(yidx, xidx), 'rs') % polcoms is all backwards
% plot(Mobj.lon(oNodes(nn)), Mobj.lat(oNodes(nn)), 'wo')
% colorbar
function Mobj = get_POLCOMS_tsobc_NOCL(Mobj, inputConf)
% Extract temperature and salinity boundary forcing information from NOC
% Operation Tide Surge model output.
%