Commit 5e7f28ab authored by Pierre Cazenave's avatar Pierre Cazenave

Add new field to the mesh object to indicate whether the model has rivers....

Add new field to the mesh object to indicate whether the model has rivers. Also update the river functions to use that field and also populate the existing field with the number of rivrs in it.
parent 5ad18293
......@@ -19,12 +19,14 @@ function [Mobj] = add_river_nodes(Mobj,RiverName)
%
% Author(s):
% Geoff Cowles (University of Massachusetts Dartmouth)
% Pierre Cazenave (Plymouth Marine Laboratory)
%
% Note:
% Uses ginput2 which allows zooming before selecting points and displays
% clicked points realtime
%
% Revision history
% 2014-05-20 Set boolean flag to true to indicate rivers.
%
%==============================================================================
subname = 'add_river_nodes';
......@@ -86,6 +88,7 @@ Mobj.nRivNodes(Mobj.nRivers) = npts;
Mobj.riv_nodes(Mobj.nRivers,1:npts) = ipt;
Mobj.riv_name{Mobj.nRivers} = RiverName;
Mobj.have_rivers = true;
if(ftbverbose)
fprintf(['end : ' subname '\n'])
......
......@@ -33,6 +33,7 @@ function [Mobj] = add_river_nodes_list(Mobj,Nlist,RiverName,plotFig)
% versions of MATLAB whilst giving the same result.
% 2013-10-22 KJA: added capability to turn off figures (copied from
% Pierre's adaptation to add_obc_nodes_list.m)
% 2014-05-20 Set boolean flag to true to indicate rivers.
%
%==========================================================================
subname = 'add_river_nodes_list';
......@@ -89,6 +90,7 @@ Mobj.nRivNodes(Mobj.nRivers) = npts;
Mobj.riv_nodes(Mobj.nRivers, 1:npts) = Nlist;
Mobj.riv_name{Mobj.nRivers} = RiverName;
Mobj.have_rivers = true;
if ftbverbose
fprintf(['end : ' subname '\n'])
......
......@@ -69,6 +69,8 @@ function Mobj = get_EHYPE_rivers(Mobj, dist_thresh, varargin)
% 2014-05-15 - Add option to exclude rivers by name.
% 2014-05-19 - Add new option to use an alternatively formatted input
% climatology (two columns instead of the number in the EHYPE data).
% 2014-05-20 Set boolean flag to true to indicate rivers and add number
% of rivers to the relevant field.
%
%==========================================================================
......@@ -416,7 +418,8 @@ fv_uniq_names = [fv_uniq_names; fv_dups_names'];
% dealing with either climatology or time series data.
Mobj.river_nodes = fv_uniq_obc;
Mobj.river_names = fv_uniq_names;
Mobj.have_rivers = true;
Mobj.nRivers = length(fv_uniq_obc);
% Create a Modified Julian Day time series of the EHYPE river data. Assume
% all the EHYPE model outputs are for the same period and have the same
......
......@@ -64,6 +64,8 @@ function Mobj = get_FVCOM_rivers(Mobj, dist_thresh)
% 2013-12-10 - Change the unique call to preserve the order by replacing
% 'first' with 'stable'. This requires a relatively modern MATLAB
% (post-2011b).
% 2014-05-20 Set boolean flag to true to indicate rivers and add number
% of fields to the Mobj.
%
%==========================================================================
......@@ -257,6 +259,8 @@ end
Mobj.river_nodes = fv_uniq_obc;
Mobj.river_flux = fv_uniq_flow;
Mobj.river_names = fv_uniq_names;
Mobj.have_rivers = true;
Mobj.nRivers = length(fv_uniq_obc);
% Create a Modified Julian Day time series starting at January 1st for the
% year in Mobj.rivers.year.
......
......@@ -24,6 +24,8 @@ function Mobj = get_POLCOMS_river_discharge(Mobj, polcoms_flow)
%
% Revision history:
% 2013-04-15 - First version from the original get_POLCOMS_rivers.m.
% 2014-05-20 Set boolean flag to true to indicate rivers and add number
% of rivers.
%
%==========================================================================
......@@ -59,6 +61,9 @@ Mobj.rivers.num = pc_nr;
Mobj.rivers.num_time = pc_nt;
Mobj.rivers.discharge = pc_riv;
Mobj.have_rivers = true;
Mobj.nRivers = pc_nr;
if ftbverbose
fprintf(['end : ' subname '\n'])
end
......@@ -17,8 +17,10 @@ function [Mobj] = make_blank_mesh
%
% Author(s):
% Geoff Cowles (University of Massachusetts Dartmouth)
% Pierre Cazenave (Plymouth Marine Laboratory)
%
% Revision history
% 2015-05-20 Add new boolean flag for rivers.
%
%==============================================================================
global ftbverbose
......@@ -50,6 +52,7 @@ Mobj.have_cor = false;
Mobj.have_xy = false;
Mobj.have_bath = false;
Mobj.have_mets = false;
Mobj.have_rivers = false;
if(ftbverbose)
......
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