2.9.2.2. Content¶
Inheritance diagram: | |
---|---|
Utilities to handle shorelines
-
class
Histolitt
(input=None, *args, **kwargs)[source]¶ Bases:
vacumm.bathy.shorelines.ShoreLine
Shoreline of France from SHOM/IGN at 1/25000from shapefile of Polygons covering metropolitan France
-
INPUT_MULTIPOINTS
= 8¶
-
INPUT_POINTS
= 1¶
-
INPUT_POLYGONS
= 5¶
-
INPUT_POLYLINES
= 3¶
-
LINE
= 1¶
-
LINES
= 1¶
-
POINT
= 0¶
-
POINTS
= 0¶
-
POLY
= 2¶
-
POLYGON
= 2¶
-
POLYGONS
= 2¶
-
POLYS
= 2¶
-
classmethod
avail
()¶ Is this shoreline available locally or for download?
-
bathy
(factor=None, ext=True, nl=True, xyz=True, **kwargs)¶ Get bathymetry at coast from mean sea level at stations
Params: - factor: Multiplicative correction factor
- xyz: If True, return a
XYZ
instance instead of anumpy
array - ext: Allow extrapolation
- nl: Nonlinear interpolation
Return: A
XYZ
instance of sea level
-
clip
(zone, copy=True, sort=True, reverse=True, **kwargs)¶ Clip to zone
Params: - zone:
[xmin, ymin, xmax, ymax]
- copy, optional: If
True
, make a copy of current instance, else simply rehandled the list of shapes. - If
copy==True
, Other parameters are passed to the initialization of the new instance.
- zone:
-
classmethod
embed
(lon, lat)¶ Is this shoreline embeddeding this point?
-
factor
¶ Factor to apply to the sea level on the shoreline to convert to bathymetic “depth”
-
get_data
(key=None, proj=None)¶ Get the numeric version of the list of geos objects (polygons, etc)
Param: - key: A slice selector applied to the list.
- proj:
True
, or a callable to project or re-project coordinates.
-
get_factor
()¶ Get factor to apply to the sea level on the shoreline to convert to bathymetic ‘depth’
-
get_map
()¶ Return the associated basemap instance if set
-
get_points
(key=None, split=True, proj=None)¶ Get all the points from all the shapes as a tuple (x,y)
-
get_shapes
(key=None, proj=None)¶ Get the list of geos objects (polygons, etc)
Param: - key: A slice selector applied to the list.
- proj:
True
, or a callable to project or re-project coordinates.
-
get_type
()¶ Return the type of shapes
-
get_xy
(key=None, proj=None)¶ Shortcut to
get_points(split=false)
-
greatest_polygon
()¶ Get the greatest polygon (only works with polygons!)
-
is_type
(type)¶ Check type
Example: >>> self.is_type(self.POLYS)
-
plot
(select=None, ax=None, fill=None, fillcolor=None, points=False, m=True, show=True, **kwargs)¶ Plot shapes
Params: - select, optional: argument for selecting shapes in the list [defaul: None].
- fill, optional: Force filling (True/False), else guessed from shpe type, ie filling for polygons only [default: None]
- ax, optional: Axes instance.
- m, optional:
Map
instance (created withmap2()
) or aBasemap
instance. - points, optional: Plots shapes as points.
- lines, optional: Plot shapes as lines (if a of type
POINTS
). - fill_<params>, optional:
<param>
is passed toPolyCollection
. - lines_<params>, optional:
<param>
is passed toLineCollection
or toPolyCollection
. - points_<params>, optional:
<param>
is passed toscatter
. - m_<params>, optional:
<param>
is passed tomap2
ifm is True
. - autoscale, optional: Autoscale axis limits?
-
resol
(deg=True)¶ Compute the mean “resolution” of the shapes based on the first shape
deg:
- if
False
: return a resolution in meters has a the median distance between points - if
True
: return the median distance between points as a resolution in degrees(xres,yres)
- if
-
set_factor
(factor)¶ Set factor to apply to the sea level on the shoreline to convert to bathymetic ‘depth’
-
sort
(reverse=True)¶ Sort shapes according to their surface or length
- reverse: If True, greater polygons are first [default: True]
-
sorted
()¶
-
xy
¶ XY coordinates as a (2,npts) array
-
-
class
EUROSION
(input=None, *args, **kwargs)[source]¶ Bases:
vacumm.bathy.shorelines.ShoreLine
Shoreline of Europe at 1/100000 from shapefile of LineStrings .. warning:
Must not be used for masking, only for coastal interpolations
-
INPUT_MULTIPOINTS
= 8¶
-
INPUT_POINTS
= 1¶
-
INPUT_POLYGONS
= 5¶
-
INPUT_POLYLINES
= 3¶
-
LINE
= 1¶
-
LINES
= 1¶
-
POINT
= 0¶
-
POINTS
= 0¶
-
POLY
= 2¶
-
POLYGON
= 2¶
-
POLYGONS
= 2¶
-
POLYS
= 2¶
-
classmethod
avail
()¶ Is this shoreline available locally or for download?
-
bathy
(factor=None, ext=True, nl=True, xyz=True, **kwargs)¶ Get bathymetry at coast from mean sea level at stations
Params: - factor: Multiplicative correction factor
- xyz: If True, return a
XYZ
instance instead of anumpy
array - ext: Allow extrapolation
- nl: Nonlinear interpolation
Return: A
XYZ
instance of sea level
-
clip
(zone, copy=True, sort=True, reverse=True, **kwargs)¶ Clip to zone
Params: - zone:
[xmin, ymin, xmax, ymax]
- copy, optional: If
True
, make a copy of current instance, else simply rehandled the list of shapes. - If
copy==True
, Other parameters are passed to the initialization of the new instance.
- zone:
-
classmethod
embed
(lon, lat)¶ Is this shoreline embeddeding this point?
-
factor
¶ Factor to apply to the sea level on the shoreline to convert to bathymetic “depth”
-
get_data
(key=None, proj=None)¶ Get the numeric version of the list of geos objects (polygons, etc)
Param: - key: A slice selector applied to the list.
- proj:
True
, or a callable to project or re-project coordinates.
-
get_factor
()¶ Get factor to apply to the sea level on the shoreline to convert to bathymetic ‘depth’
-
get_map
()¶ Return the associated basemap instance if set
-
get_points
(key=None, split=True, proj=None)¶ Get all the points from all the shapes as a tuple (x,y)
-
get_shapes
(key=None, proj=None)¶ Get the list of geos objects (polygons, etc)
Param: - key: A slice selector applied to the list.
- proj:
True
, or a callable to project or re-project coordinates.
-
get_type
()¶ Return the type of shapes
-
get_xy
(key=None, proj=None)¶ Shortcut to
get_points(split=false)
-
greatest_polygon
()¶ Get the greatest polygon (only works with polygons!)
-
is_type
(type)¶ Check type
Example: >>> self.is_type(self.POLYS)
-
plot
(select=None, ax=None, fill=None, fillcolor=None, points=False, m=True, show=True, **kwargs)¶ Plot shapes
Params: - select, optional: argument for selecting shapes in the list [defaul: None].
- fill, optional: Force filling (True/False), else guessed from shpe type, ie filling for polygons only [default: None]
- ax, optional: Axes instance.
- m, optional:
Map
instance (created withmap2()
) or aBasemap
instance. - points, optional: Plots shapes as points.
- lines, optional: Plot shapes as lines (if a of type
POINTS
). - fill_<params>, optional:
<param>
is passed toPolyCollection
. - lines_<params>, optional:
<param>
is passed toLineCollection
or toPolyCollection
. - points_<params>, optional:
<param>
is passed toscatter
. - m_<params>, optional:
<param>
is passed tomap2
ifm is True
. - autoscale, optional: Autoscale axis limits?
-
resol
(deg=True)¶ Compute the mean “resolution” of the shapes based on the first shape
deg:
- if
False
: return a resolution in meters has a the median distance between points - if
True
: return the median distance between points as a resolution in degrees(xres,yres)
- if
-
set_factor
(factor)¶ Set factor to apply to the sea level on the shoreline to convert to bathymetic ‘depth’
-
sort
(reverse=True)¶ Sort shapes according to their surface or length
- reverse: If True, greater polygons are first [default: True]
-
sorted
()¶
-
xy
¶ XY coordinates as a (2,npts) array
-
-
class
GSHHS_SF
(input=None, *args, **kwargs)[source]¶ Bases:
vacumm.bathy.shorelines.ShoreLine
Fine world shoreline from USGS shapefile .. warning:
HUGE! Please use :class:`GSHHS` instead
-
INPUT_MULTIPOINTS
= 8¶
-
INPUT_POINTS
= 1¶
-
INPUT_POLYGONS
= 5¶
-
INPUT_POLYLINES
= 3¶
-
LINE
= 1¶
-
LINES
= 1¶
-
POINT
= 0¶
-
POINTS
= 0¶
-
POLY
= 2¶
-
POLYGON
= 2¶
-
POLYGONS
= 2¶
-
POLYS
= 2¶
-
classmethod
avail
()¶ Is this shoreline available locally or for download?
-
bathy
(factor=None, ext=True, nl=True, xyz=True, **kwargs)¶ Get bathymetry at coast from mean sea level at stations
Params: - factor: Multiplicative correction factor
- xyz: If True, return a
XYZ
instance instead of anumpy
array - ext: Allow extrapolation
- nl: Nonlinear interpolation
Return: A
XYZ
instance of sea level
-
clip
(zone, copy=True, sort=True, reverse=True, **kwargs)¶ Clip to zone
Params: - zone:
[xmin, ymin, xmax, ymax]
- copy, optional: If
True
, make a copy of current instance, else simply rehandled the list of shapes. - If
copy==True
, Other parameters are passed to the initialization of the new instance.
- zone:
-
classmethod
embed
(lon, lat)¶ Is this shoreline embeddeding this point?
-
factor
¶ Factor to apply to the sea level on the shoreline to convert to bathymetic “depth”
-
get_data
(key=None, proj=None)¶ Get the numeric version of the list of geos objects (polygons, etc)
Param: - key: A slice selector applied to the list.
- proj:
True
, or a callable to project or re-project coordinates.
-
get_factor
()¶ Get factor to apply to the sea level on the shoreline to convert to bathymetic ‘depth’
-
get_map
()¶ Return the associated basemap instance if set
-
get_points
(key=None, split=True, proj=None)¶ Get all the points from all the shapes as a tuple (x,y)
-
get_shapes
(key=None, proj=None)¶ Get the list of geos objects (polygons, etc)
Param: - key: A slice selector applied to the list.
- proj:
True
, or a callable to project or re-project coordinates.
-
get_type
()¶ Return the type of shapes
-
get_xy
(key=None, proj=None)¶ Shortcut to
get_points(split=false)
-
greatest_polygon
()¶ Get the greatest polygon (only works with polygons!)
-
is_type
(type)¶ Check type
Example: >>> self.is_type(self.POLYS)
-
plot
(select=None, ax=None, fill=None, fillcolor=None, points=False, m=True, show=True, **kwargs)¶ Plot shapes
Params: - select, optional: argument for selecting shapes in the list [defaul: None].
- fill, optional: Force filling (True/False), else guessed from shpe type, ie filling for polygons only [default: None]
- ax, optional: Axes instance.
- m, optional:
Map
instance (created withmap2()
) or aBasemap
instance. - points, optional: Plots shapes as points.
- lines, optional: Plot shapes as lines (if a of type
POINTS
). - fill_<params>, optional:
<param>
is passed toPolyCollection
. - lines_<params>, optional:
<param>
is passed toLineCollection
or toPolyCollection
. - points_<params>, optional:
<param>
is passed toscatter
. - m_<params>, optional:
<param>
is passed tomap2
ifm is True
. - autoscale, optional: Autoscale axis limits?
-
resol
(deg=True)¶ Compute the mean “resolution” of the shapes based on the first shape
deg:
- if
False
: return a resolution in meters has a the median distance between points - if
True
: return the median distance between points as a resolution in degrees(xres,yres)
- if
-
set_factor
(factor)¶ Set factor to apply to the sea level on the shoreline to convert to bathymetic ‘depth’
-
sort
(reverse=True)¶ Sort shapes according to their surface or length
- reverse: If True, greater polygons are first [default: True]
-
sorted
()¶
-
xy
¶ XY coordinates as a (2,npts) array
-
-
class
GSHHS
(input=None, clip=None, sort=True, reverse=True, proj=False, **kwargs)[source]¶ Bases:
vacumm.bathy.shorelines._CoastalBathy_
,vacumm.bathy.shorelines._PolyShapes_
,vacumm.misc.grid.basemap.GSHHS_BM
-
INPUT_MULTIPOINTS
= 8¶
-
INPUT_POINTS
= 1¶
-
INPUT_POLYGONS
= 5¶
-
INPUT_POLYLINES
= 3¶
-
LINE
= 1¶
-
LINES
= 1¶
-
POINT
= 0¶
-
POINTS
= 0¶
-
POLY
= 2¶
-
POLYGON
= 2¶
-
POLYGONS
= 2¶
-
POLYS
= 2¶
-
bathy
(factor=None, ext=True, nl=True, xyz=True, **kwargs)¶ Get bathymetry at coast from mean sea level at stations
Params: - factor: Multiplicative correction factor
- xyz: If True, return a
XYZ
instance instead of anumpy
array - ext: Allow extrapolation
- nl: Nonlinear interpolation
Return: A
XYZ
instance of sea level
-
clip
(zone, copy=True, sort=True, reverse=True, **kwargs)¶ Clip to zone
Params: - zone:
[xmin, ymin, xmax, ymax]
- copy, optional: If
True
, make a copy of current instance, else simply rehandled the list of shapes. - If
copy==True
, Other parameters are passed to the initialization of the new instance.
- zone:
-
factor
¶ Factor to apply to the sea level on the shoreline to convert to bathymetic “depth”
-
get_data
(key=None, proj=None)¶ Get the numeric version of the list of geos objects (polygons, etc)
Param: - key: A slice selector applied to the list.
- proj:
True
, or a callable to project or re-project coordinates.
-
get_factor
()¶ Get factor to apply to the sea level on the shoreline to convert to bathymetic ‘depth’
-
get_map
()¶ Return the associated basemap instance if set
-
get_points
(key=None, split=True, proj=None)¶ Get all the points from all the shapes as a tuple (x,y)
-
get_shapes
(key=None, proj=None)¶ Get the list of geos objects (polygons, etc)
Param: - key: A slice selector applied to the list.
- proj:
True
, or a callable to project or re-project coordinates.
-
get_type
()¶ Return the type of shapes
-
get_xy
(key=None, proj=None)¶ Shortcut to
get_points(split=false)
-
greatest_polygon
()¶ Get the greatest polygon (only works with polygons!)
-
is_type
(type)¶ Check type
Example: >>> self.is_type(self.POLYS)
-
plot
(select=None, ax=None, fill=None, fillcolor=None, points=False, m=True, show=True, **kwargs)¶ Plot shapes
Params: - select, optional: argument for selecting shapes in the list [defaul: None].
- fill, optional: Force filling (True/False), else guessed from shpe type, ie filling for polygons only [default: None]
- ax, optional: Axes instance.
- m, optional:
Map
instance (created withmap2()
) or aBasemap
instance. - points, optional: Plots shapes as points.
- lines, optional: Plot shapes as lines (if a of type
POINTS
). - fill_<params>, optional:
<param>
is passed toPolyCollection
. - lines_<params>, optional:
<param>
is passed toLineCollection
or toPolyCollection
. - points_<params>, optional:
<param>
is passed toscatter
. - m_<params>, optional:
<param>
is passed tomap2
ifm is True
. - autoscale, optional: Autoscale axis limits?
-
resol
(deg=True)¶ Compute the mean “resolution” of the shapes based on the first shape
deg:
- if
False
: return a resolution in meters has a the median distance between points - if
True
: return the median distance between points as a resolution in degrees(xres,yres)
- if
-
set_factor
(factor)¶ Set factor to apply to the sea level on the shoreline to convert to bathymetic ‘depth’
-
sort
(reverse=True)¶ Sort shapes according to their surface or length
- reverse: If True, greater polygons are first [default: True]
-
sorted
()¶
-
xy
¶ XY coordinates as a (2,npts) array
-
-
class
GSHHS_BM
(input=None, clip=None, sort=True, reverse=True, proj=False, **kwargs)[source]¶ Bases:
vacumm.misc.io.Shapes
Shoreline from USGS using Basemap
Initialized with a valid Basemap instance with resolution not equal to None, or thanks to arguments passed to
create_mapplot.map()
- input: Basemap or Shapes instance [default: None]
-
INPUT_MULTIPOINTS
= 8¶
-
INPUT_POINTS
= 1¶
-
INPUT_POLYGONS
= 5¶
-
INPUT_POLYLINES
= 3¶
-
LINE
= 1¶
-
LINES
= 1¶
-
POINT
= 0¶
-
POINTS
= 0¶
-
POLY
= 2¶
-
POLYGON
= 2¶
-
POLYGONS
= 2¶
-
POLYS
= 2¶
-
clip
(zone, copy=True, sort=True, reverse=True, **kwargs)¶ Clip to zone
Params: - zone:
[xmin, ymin, xmax, ymax]
- copy, optional: If
True
, make a copy of current instance, else simply rehandled the list of shapes. - If
copy==True
, Other parameters are passed to the initialization of the new instance.
- zone:
-
get_data
(key=None, proj=None)¶ Get the numeric version of the list of geos objects (polygons, etc)
Param: - key: A slice selector applied to the list.
- proj:
True
, or a callable to project or re-project coordinates.
-
get_map
()¶ Return the associated basemap instance if set
-
get_points
(key=None, split=True, proj=None)¶ Get all the points from all the shapes as a tuple (x,y)
-
get_shapes
(key=None, proj=None)¶ Get the list of geos objects (polygons, etc)
Param: - key: A slice selector applied to the list.
- proj:
True
, or a callable to project or re-project coordinates.
-
get_type
()¶ Return the type of shapes
-
get_xy
(key=None, proj=None)¶ Shortcut to
get_points(split=false)
-
is_type
(type)¶ Check type
Example: >>> self.is_type(self.POLYS)
-
plot
(select=None, ax=None, fill=None, points=False, lines=True, fillcolor=None, color='k', s=None, linewidth=None, m=None, show=True, alpha=1, autoscale=True, title=None, **kwargs)¶ Plot shapes
Params: - select, optional: argument for selecting shapes in the list [defaul: None].
- fill, optional: Force filling (True/False), else guessed from shpe type, ie filling for polygons only [default: None]
- ax, optional: Axes instance.
- m, optional:
Map
instance (created withmap2()
) or aBasemap
instance. - points, optional: Plots shapes as points.
- lines, optional: Plot shapes as lines (if a of type
POINTS
). - fill_<params>, optional:
<param>
is passed toPolyCollection
. - lines_<params>, optional:
<param>
is passed toLineCollection
or toPolyCollection
. - points_<params>, optional:
<param>
is passed toscatter
. - m_<params>, optional:
<param>
is passed tomap2
ifm is True
. - autoscale, optional: Autoscale axis limits?
-
resol
(deg=True)¶ Compute the mean “resolution” of the shapes based on the first shape
deg:
- if
False
: return a resolution in meters has a the median distance between points - if
True
: return the median distance between points as a resolution in degrees(xres,yres)
- if
-
sort
(reverse=True)¶ Sort shapes according to their surface or length
- reverse: If True, greater polygons are first [default: True]
-
sorted
()¶
-
xy
¶ XY coordinates as a (2,npts) array
-
class
ShoreLine
(input=None, *args, **kwargs)[source]¶ Bases:
vacumm.bathy.shorelines._CoastalBathy_
,vacumm.bathy.shorelines._PolyShapes_
,vacumm.misc.io.Shapes
Version of
vacumm.misc.io.Shapes
dedicated to shorelines-
INPUT_MULTIPOINTS
= 8¶
-
INPUT_POINTS
= 1¶
-
INPUT_POLYGONS
= 5¶
-
INPUT_POLYLINES
= 3¶
-
LINE
= 1¶
-
LINES
= 1¶
-
POINT
= 0¶
-
POINTS
= 0¶
-
POLY
= 2¶
-
POLYGON
= 2¶
-
POLYGONS
= 2¶
-
POLYS
= 2¶
-
bathy
(factor=None, ext=True, nl=True, xyz=True, **kwargs)¶ Get bathymetry at coast from mean sea level at stations
Params: - factor: Multiplicative correction factor
- xyz: If True, return a
XYZ
instance instead of anumpy
array - ext: Allow extrapolation
- nl: Nonlinear interpolation
Return: A
XYZ
instance of sea level
-
clip
(zone, copy=True, sort=True, reverse=True, **kwargs)¶ Clip to zone
Params: - zone:
[xmin, ymin, xmax, ymax]
- copy, optional: If
True
, make a copy of current instance, else simply rehandled the list of shapes. - If
copy==True
, Other parameters are passed to the initialization of the new instance.
- zone:
-
factor
¶ Factor to apply to the sea level on the shoreline to convert to bathymetic “depth”
-
get_data
(key=None, proj=None)¶ Get the numeric version of the list of geos objects (polygons, etc)
Param: - key: A slice selector applied to the list.
- proj:
True
, or a callable to project or re-project coordinates.
-
get_factor
()¶ Get factor to apply to the sea level on the shoreline to convert to bathymetic ‘depth’
-
get_map
()¶ Return the associated basemap instance if set
-
get_points
(key=None, split=True, proj=None)¶ Get all the points from all the shapes as a tuple (x,y)
-
get_shapes
(key=None, proj=None)¶ Get the list of geos objects (polygons, etc)
Param: - key: A slice selector applied to the list.
- proj:
True
, or a callable to project or re-project coordinates.
-
get_type
()¶ Return the type of shapes
-
get_xy
(key=None, proj=None)¶ Shortcut to
get_points(split=false)
-
greatest_polygon
()¶ Get the greatest polygon (only works with polygons!)
-
is_type
(type)¶ Check type
Example: >>> self.is_type(self.POLYS)
-
plot
(select=None, ax=None, fill=None, fillcolor=None, points=False, m=True, show=True, **kwargs)¶ Plot shapes
Params: - select, optional: argument for selecting shapes in the list [defaul: None].
- fill, optional: Force filling (True/False), else guessed from shpe type, ie filling for polygons only [default: None]
- ax, optional: Axes instance.
- m, optional:
Map
instance (created withmap2()
) or aBasemap
instance. - points, optional: Plots shapes as points.
- lines, optional: Plot shapes as lines (if a of type
POINTS
). - fill_<params>, optional:
<param>
is passed toPolyCollection
. - lines_<params>, optional:
<param>
is passed toLineCollection
or toPolyCollection
. - points_<params>, optional:
<param>
is passed toscatter
. - m_<params>, optional:
<param>
is passed tomap2
ifm is True
. - autoscale, optional: Autoscale axis limits?
-
resol
(deg=True)¶ Compute the mean “resolution” of the shapes based on the first shape
deg:
- if
False
: return a resolution in meters has a the median distance between points - if
True
: return the median distance between points as a resolution in degrees(xres,yres)
- if
-
set_factor
(factor)¶ Set factor to apply to the sea level on the shoreline to convert to bathymetic ‘depth’
-
sort
(reverse=True)¶ Sort shapes according to their surface or length
- reverse: If True, greater polygons are first [default: True]
-
sorted
()¶
-
xy
¶ XY coordinates as a (2,npts) array
-
-
get_best
(gg, **kwargs)[source]¶ Get the best shoreline (
GSHHS
orHistolitt
) for my grid or (lon,lat)
-
get_shoreline
(arg, *args, **kwargs)[source]¶ Get a valid ShoreLine instance according to arg.
Params: arg: it can be either:
A :class`~vacumm.misc.io.Shapes` instance
A string within the folowing lists:
- for GSHHS resolutions: [‘f’, ‘h’, ‘i’, ‘l’, ‘c’]
- for other shorelines: [‘Histolitt’, ‘EUROSION’, ‘GSHHS_SF’, ‘GSHHS’, ‘GSHHS_BM’]