ibcao package

Submodules

ibcao.ibcao module

class ibcao.ibcao.IBCAO(ibcao_grd_file='/home/docs/checkouts/readthedocs.org/user_builds/ibcao-py/checkouts/latest/ibcao/IBCAO_V3_500m_RR.grd')[source]

A class for setting up a matplotlib / cartopy instance of the IBCAO. The IBCAO grd file can be retrieved from:

Download file: http://www.ngdc.noaa.gov/mgg/bathymetry/arctic/grids/version3_0/IBCAO_V3_500m_RR.grd.gz

Specification can be found in file: IBCAO_V3_README.txt from:

The specifications are hardcoded into this class, that means that the class has to be updated for new versions of the IBCAO.

The plot is set up to use the same projection as the map, Polar Stereographic, as defined in the IBCAO readme with the WGS84 datum. While working in this projection it is not necessary to transform the IBCAO image (which for the full version of the IBCAO is significant).

Colormap()[source]

Returns a discrete colormap and norm based on the official IBCAO colormap.

Returns:
(cmap, norm): A tuple with the colormap and the norm

Example:

>>> (cmap, norm) = self.Colormap ()
>>> cm = ax.pcolormesh (x, y, z, cmap = cmap, norm = norm)
>>> plt.colorbar (cm)
REFERENCE = 'Jakobsson, M., L. A. Mayer, B. Coakley, J. A. Dowdeswell, S. Forbes, B. Fridman, H. Hodnesdal, R. Noormets, R. Pedersen, M. Rebesco, H.-W. Schenke, Y. Zarayskaya A, D. Accettella, A. Armstrong, R. M. Anderson, P. Bienhoff, A. Camerlenghi, I. Church, M. Edwards, J. V. Gardner, J. K. Hall, B. Hell, O. B. Hestvik, Y. Kristoffersen, C. Marcussen, R. Mohammad, D. Mosher, S. V. Nghiem, M. T. Pedrosa, P. G. Travaglini, and P. Weatherall, The International Bathymetric Chart of the Arctic Ocean (IBCAO) Version 3.0, Geophysical Research Letters, doi: 10.1029/2012GL052219.'
VERSION = '3.0'
close()[source]

Closes the map file. The map is memorymapped, so this will cause a warning unless all references to the map have been removed.

geod

Return a pyproj.Geoid set up with the WGS84 ellipsoid.

get_cartopy()[source]

Deprecated: Use ups.

Returns a Cartopy instance set up for the IBCAO UPS variant. A separate instance is used internally.

grid(div=1)[source]

Create position grid for IBCAO

Args:
div: Skip every div point (1 include all, default) corresponds to
div in template().
Returns:
(x, y): A tuple with x and y grid for z.
interp_depth(x, y)[source]

Interpolate depth at x and y using scipy.interpolate.RectBivariateSpline.

This method is more accurate but slower than map_depth.

The interpolation function is cached, so later interpolations should be faster.

Args:
x: (1D array) coordinates (longitude) in meters on UPS y: (1D array) coordinates (latitude) in meters on UPS

points outside the map are set to np.nan.

Returns:
z: depths along x and y.
map_depth(x, y, order=3)[source]

Map coordinates x and y onto z in order to retrieve depth using scipy.ndimage.map_coordinates.

Args:
x: (1D array) coordinates (longitude) in meters on UPS y: (1D array) coordinates (latitude) in meters on UPS

points outside the map are set to np.nan.

Returns:
z: depths along x and y.

Example: Get points along great circle:

>>> start = [10, 78]    # positions in degrees
>>> end   = [-18, 76]
>>>
>>> ## Sample a great circle between the two points using the pyproj.Geod set up by the IBCAO class
>>> i  = IBCAO ()
>>> gc = np.array(i.get_geod ().npts (start[0], start[1], end[0], end[1], 100))
>>>
>>> ## Interpolate the depth along the great circle
>>> gc_xy = i.ups.transform_points (i.g, gc[:,0], gc[:,1]) # convert to UPS coordinates
>>> depth = i.map_depth (gc_xy[:,0], gc_xy[:,1])
proj

Returns a Proj.4 instance set up for the IBCAO UPS variant

proj_str

Returns a Proj.4 string for the IBCAO UPS variant.

template(div=1)[source]

Sets up and returns a figure with the IBCAO map loaded, ready for additional plotting:

Args:
div: use every div point in map (1 is default, use all points)
Returns:
matplotlib Figure
>>> i = IBCAO ()
>>> f = i.template ()
>>> f.show ()
ups

Returns a Cartopy Stereographic instance set up for the Universal Polar Stereographic (UPS) projection used in the IBCAO.

x

x (longitude) arguments for depth data (z) in meters (UPS).

xlim

Extent in longitude coordinates (meters) on UPS projection.

y

y (latitude) arguments for depth data (z) in meters (UPS).

ylim

Extent in latitude coordinates (meters) on UPS projection.

z

Depth data on grid.

Module contents