Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
PyFVCOM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
FVCOM
PyFVCOM
Commits
462532cb
Commit
462532cb
authored
Jan 25, 2018
by
Pierre Cazenave
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of gitlab.ecosystem-modelling.pml.ac.uk:fvcom/pyfvcom into dev
parents
f51796dc
5cbe3d1c
Pipeline
#786
canceled with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
PyFVCOM/plot.py
PyFVCOM/plot.py
+10
-7
PyFVCOM/preproc.py
PyFVCOM/preproc.py
+11
-0
No files found.
PyFVCOM/plot.py
View file @
462532cb
...
...
@@ -922,7 +922,7 @@ class CrossPlotter(Plotter):
if
self
.
title
:
self
.
axes
.
set_title
(
self
.
title
)
def
cross_section_init
(
self
,
cross_section_points
,
dist_res
=
50
,
variable_at_cells
=
False
):
def
cross_section_init
(
self
,
cross_section_points
,
dist_res
=
50
,
variable_at_cells
=
False
,
wetting_and_drying
=
True
):
# sample the cross section
[
sub_samp
,
sample_cells
,
sample_nodes
]
=
getcrossectiontriangles
(
cross_section_points
[
0
],
self
.
triangles
,
self
.
x
,
self
.
y
,
dist_res
)
...
...
@@ -985,13 +985,16 @@ class CrossPlotter(Plotter):
chan_y_raw
[
np
.
isnan
(
chan_y_raw
)]
=
max_zeta
self
.
chan_x
,
self
.
chan_y
=
self
.
_chan_corners
(
chan_x_raw
,
chan_y_raw
)
# sort out wetting and drying nodes
if
variable_at_cells
:
self
.
ds
.
load_data
([
'wet_cells'
])
self
.
wet_points_data
=
np
.
asarray
(
self
.
ds
.
data
.
wet_cells
[:,
self
.
sel_points
],
dtype
=
bool
)
# sort out wetting and drying nodes if requested
if
wetting_and_drying
:
if
variable_at_cells
:
self
.
ds
.
load_data
([
'wet_cells'
])
self
.
wet_points_data
=
np
.
asarray
(
self
.
ds
.
data
.
wet_cells
[:,
self
.
sel_points
],
dtype
=
bool
)
else
:
self
.
ds
.
load_data
([
'wet_nodes'
])
self
.
wet_points_data
=
np
.
asarray
(
self
.
ds
.
data
.
wet_nodes
[:,
self
.
sel_points
],
dtype
=
bool
)
else
:
self
.
ds
.
load_data
([
'wet_nodes'
])
self
.
wet_points_data
=
np
.
asarray
(
self
.
ds
.
data
.
wet_nodes
[:,
self
.
sel_points
],
dtype
=
bool
)
self
.
wet_points_data
=
np
.
asarray
(
np
.
ones
((
self
.
ds
.
dims
.
time
,
len
(
self
.
sel_points
))),
dtype
=
bool
)
self
.
ylim_vals
=
[
np
.
floor
(
np
.
nanmin
(
self
.
cross_plot_y_pcolor
)),
np
.
ceil
(
np
.
nanmax
(
self
.
cross_plot_y_pcolor
))
+
1
]
self
.
xlim_vals
=
[
np
.
nanmin
(
self
.
cross_plot_x_pcolor
),
np
.
nanmax
(
self
.
cross_plot_x_pcolor
)]
...
...
PyFVCOM/preproc.py
View file @
462532cb
...
...
@@ -1996,6 +1996,17 @@ class RegularReader(FileReader):
""" Compatibility function. """
return
self
.
closest_node
(
*
args
,
**
kwargs
)
def
closest_node
(
self
,
where
,
cartesian
=
False
,
threshold
=
np
.
inf
,
vincenty
=
False
,
haversine
=
False
):
if
cartesian
:
raise
ValueError
(
'No cartesian coordinates defined'
)
else
:
lat_rav
,
lon_rav
=
np
.
meshgrid
(
self
.
grid
.
lat
,
self
.
grid
.
lon
)
x
,
y
=
lon_rav
.
ravel
(),
lat_rav
.
ravel
()
index
=
self
.
_closest_point
(
x
,
y
,
x
,
y
,
where
,
threshold
=
threshold
,
vincenty
=
vincenty
,
haversine
=
haversine
)
if
len
(
index
)
==
1
:
index
=
index
[
0
]
return
np
.
unravel_index
(
index
,
(
len
(
self
.
grid
.
lon
),
len
(
self
.
grid
.
lat
)))
class
HYCOMReader
(
RegularReader
):
"""
...
...
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