Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
fvcom-toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
FVCOM
fvcom-toolbox
Commits
7210097c
Commit
7210097c
authored
Jan 14, 2015
by
Pierre Cazenave
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the way the u and v data are extracted from the model to use the
relevant element ID instead of the node ID.
parent
815a77eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
fvcom_prepro/add_stations_list.m
fvcom_prepro/add_stations_list.m
+14
-5
fvcom_prepro/write_FVCOM_probes.m
fvcom_prepro/write_FVCOM_probes.m
+9
-1
No files found.
fvcom_prepro/add_stations_list.m
View file @
7210097c
...
...
@@ -21,8 +21,14 @@ function [Mobj] = add_stations_list(Mobj,Positions,Names,Dist)
% ensure Dist is in those units.
%
% OUTPUT:
% Mobj = Matlab mesh object with an additional cell array containing id,
% x, y, nodelist, depth and station name.
% Mobj = Matlab mesh object with an additional cell array (stations)
% containing:
% {id, x, y, nodelist, depth, 'station name', elem}
% where id is the station ID (from 1 number of valid stations, x and y
% are the coordinates of the station, nodelist is the indices of the
% model grid nodes, depth is the depth at the grid node, station name is
% a string of the name from the input file and eleme is the grid element
% ID closest to each station.
%
% EXAMPLE USAGE
% Mobj = add_stations_list(Mobj, [-5.54, 50.103; -3.0865, 58.441], ...
...
...
@@ -31,9 +37,11 @@ function [Mobj] = add_stations_list(Mobj,Positions,Names,Dist)
% Author(s):
% Pierre Cazenave (Plymouth Marine Laboratory)
%
%
% Revision history
% 2012-11-30 First version.
% 2015-01-14 Add support for exporting the element ID closest to the
% station of interest (as well as the node ID which was already there).
% Fix some formatting issues.
%
%==========================================================================
subname
=
'add_stations_list'
;
...
...
@@ -74,10 +82,11 @@ else
end
inc
=
1
;
out
=
cell
(
nPos
,
1
);
out
=
cell
(
1
);
% don't preallocate as we don't know how many we'll have
for
s
=
1
:
nPos
[
node
,
dist
]
=
find_nearest_pt
(
Positions
(
s
,
cols
(
1
)),
Positions
(
s
,
cols
(
2
)),
Mobj
);
[
~
,
elem
]
=
min
(
abs
(
sqrt
((
Mobj
.
xc
-
Positions
(
s
,
cols
(
1
)))
.^
2
+
Mobj
.
yc
-
Positions
(
s
,
cols
(
2
)))
.^
2
));
if
dist
>=
Dist
% Skip out for this station
...
...
@@ -86,7 +95,7 @@ for s=1:nPos
end
continue
end
out
{
inc
}
=
{
inc
,
Positions
(
s
,
cols
(
1
)),
Positions
(
s
,
cols
(
2
)),
node
,
Mobj
.
h
(
node
),
Names
{
s
}};
out
{
inc
}
=
{
inc
,
Positions
(
s
,
cols
(
1
)),
Positions
(
s
,
cols
(
2
)),
node
,
Mobj
.
h
(
node
),
Names
{
s
}
,
elem
};
inc
=
inc
+
1
;
end
...
...
fvcom_prepro/write_FVCOM_probes.m
View file @
7210097c
...
...
@@ -65,6 +65,10 @@ function write_FVCOM_probes(nml_file, interval, probes)
%
% Revision history:
% 2014-02-10 - First version.
% 2015-01-14 - Fix export of the u and v locations to use the closest
% element instead of the node ID. Using the node ID for the u and v data
% will yield velocity time series miles away from the actual location of
% interest.
%
%==========================================================================
...
...
@@ -103,7 +107,11 @@ for p = 1:np
file
=
fullfile
(
pathstr
,
name
);
fprintf
(
f
,
'&NML_PROBE\n'
);
fprintf
(
f
,
' PROBE_INTERVAL = "seconds=%.1f",\n'
,
interval
);
fprintf
(
f
,
' PROBE_LOCATION = %i,\n'
,
probes
.
(
fnames
{
p
})
.
node
);
if
any
(
strcmpi
(
vname
,
{
'u'
,
'v'
}))
fprintf
(
f
,
' PROBE_LOCATION = %i,\n'
,
probes
.
(
fnames
{
p
})
.
elem
);
else
fprintf
(
f
,
' PROBE_LOCATION = %i,\n'
,
probes
.
(
fnames
{
p
})
.
node
);
end
fprintf
(
f
,
' PROBE_TITLE = "%s",\n'
,
file
);
% If we've got something which is vertically resolved, output the
% vertical levels.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment