2.9.2. vacumm.bathy.shorelines – Shorelines

2.9.2.2. Content

Inheritance diagram:
 
Inheritance diagram of vacumm.bathy.shorelines.Histolitt, vacumm.bathy.shorelines.EUROSION, vacumm.bathy.shorelines.GSHHS_SF, vacumm.bathy.shorelines.GSHHS, vacumm.bathy.shorelines.GSHHS_BM

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 a numpy 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.
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 with map2()) or a Basemap instance.
  • points, optional: Plots shapes as points.
  • lines, optional: Plot shapes as lines (if a of type POINTS).
  • fill_<params>, optional: <param> is passed to PolyCollection.
  • lines_<params>, optional: <param> is passed to LineCollection or to PolyCollection.
  • points_<params>, optional: <param> is passed to scatter.
  • m_<params>, optional: <param> is passed to map2 if m 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)
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

xyz(*args, **kwargs)

Shortcut to bathy()

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 a numpy 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.
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 with map2()) or a Basemap instance.
  • points, optional: Plots shapes as points.
  • lines, optional: Plot shapes as lines (if a of type POINTS).
  • fill_<params>, optional: <param> is passed to PolyCollection.
  • lines_<params>, optional: <param> is passed to LineCollection or to PolyCollection.
  • points_<params>, optional: <param> is passed to scatter.
  • m_<params>, optional: <param> is passed to map2 if m 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)
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

xyz(*args, **kwargs)

Shortcut to bathy()

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 a numpy 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.
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 with map2()) or a Basemap instance.
  • points, optional: Plots shapes as points.
  • lines, optional: Plot shapes as lines (if a of type POINTS).
  • fill_<params>, optional: <param> is passed to PolyCollection.
  • lines_<params>, optional: <param> is passed to LineCollection or to PolyCollection.
  • points_<params>, optional: <param> is passed to scatter.
  • m_<params>, optional: <param> is passed to map2 if m 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)
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

xyz(*args, **kwargs)

Shortcut to bathy()

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 a numpy 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.
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 with map2()) or a Basemap instance.
  • points, optional: Plots shapes as points.
  • lines, optional: Plot shapes as lines (if a of type POINTS).
  • fill_<params>, optional: <param> is passed to PolyCollection.
  • lines_<params>, optional: <param> is passed to LineCollection or to PolyCollection.
  • points_<params>, optional: <param> is passed to scatter.
  • m_<params>, optional: <param> is passed to map2 if m 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)
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

xyz(*args, **kwargs)

Shortcut to bathy()

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.
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 with map2()) or a Basemap instance.
  • points, optional: Plots shapes as points.
  • lines, optional: Plot shapes as lines (if a of type POINTS).
  • fill_<params>, optional: <param> is passed to PolyCollection.
  • lines_<params>, optional: <param> is passed to LineCollection or to PolyCollection.
  • points_<params>, optional: <param> is passed to scatter.
  • m_<params>, optional: <param> is passed to map2 if m 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)
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
classmethod avail()[source]

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 a numpy 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.
classmethod embed(lon, lat)[source]

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 with map2()) or a Basemap instance.
  • points, optional: Plots shapes as points.
  • lines, optional: Plot shapes as lines (if a of type POINTS).
  • fill_<params>, optional: <param> is passed to PolyCollection.
  • lines_<params>, optional: <param> is passed to LineCollection or to PolyCollection.
  • points_<params>, optional: <param> is passed to scatter.
  • m_<params>, optional: <param> is passed to map2 if m 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)
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

xyz(*args, **kwargs)

Shortcut to bathy()

get_best(gg, **kwargs)[source]

Get the best shoreline (GSHHS or Histolitt) 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’]
list_shorelines()[source]

List available shorelines

get_bestres(gg)[source]

Get the best shoreline resolution as letter, for my grid or (lon,lat)