Bathymetry Database
The Bathymetry Database module is used to import bathymetric data from the Delft Dashboard OPeNDAP server at Deltares.
Getting started
It is required that you have or create a database folder in which bathymetric tiles can be cached. For Delft Dashboard users, the path is typically something like:
d:\\delftdashboard\\data\\bathymetry
The Bathymetry Database can be initialized like this:
from cht.bathymetry_database import BathymetryDatabase
bdb = BathymetryDatabase("d:\\delftdashboard\\data\\bathymetry")
Importing bathymetry
Bathymetry data can now be downloaded using the get_data method. You’ll need to prescribe the dataset name, the limits (bounding box),
and the minimum resolution for of the requested data. For example, if you wish to obtain gridded bathymetry data
from GEBCO19
for an area in the Gulf of Mexico with a maximum cell size of 500 metres, you can do:
x, y, z = bdb.get_data('gebco19',
xlim=[-85.0, -80.0],
ylim=[ 28.0, 34.0],
max_cell_size=500.0)
This will return the 1D Numpy arrays x and y containing the horizontal coordinates of the data, and a 2D NumPy array z which contains the vertical elevation data.
THE NEXT BIT HAS NOT YET BEEN IMPLEMENTED !!!
You can also import gridded data in a coordinate reference system (CRS) other than the native CRS of the requested data. In this case, you’ll need to define the grid spacing dx an dy, as well as the name of the requested CRS. The raw bathymetric data will be interpolated onto the grid specified by you.
x, y, z = bdb.get_data('gebco19',
xlim=[ 420000.0, 460000.0],
ylim=[3320000.0, 3420000.0],
dx=200.0,
dy=200.0,
crs='WGS 84 / UTM zone 17N')
Note
If you do NOT prescribe a CRS, please ensure that xlim and ylim are specified in the native CRS of the requested dataset !
Obtaining a list of available datasets
You can show a list of available datasets with:
for dataset in bdb.dataset:
print(dataset.name)
Obtaining meta-data for a dataset
Meta data of a dataset are stored as attributes of the class Dataset.
print(bdb.get_metadata('gebco19', variable='crs'))
You can also do this:
ds = bdb.get_dataset('gebco19')
print(ds.crs)
Module
Classes
- class cht.bathymetry_database.BathymetryDatabase(pth)
The main Bathymetry Database class
- Parameters
pth (string) – Path name where bathymetry tiles will be cached.
- get_crs(dataset_name)
Returns coordinate reference system (CRS) of dataset
- Parameters
dataset_name (str) – Name of requested bathymetry dataset.
- Returns
CRS
- Return type
str
- get_data(dataset_name, xlim, ylim, max_cell_size)
Returns imported data from database
- Parameters
dataset_name (str) – Name of requested bathymetry dataset.
xlim (list) – x-limits.
y_lim (list) – y-limits.
max_cell_size (float, optional) – Maximum cell size (in metres)
dx (float, optional) – dx
dx – dy
crs (str, optional) – name of coordinate reference system
- read()
Reads meta-data of all datasets in the database.
- class cht.bathymetry_database.BathymetryDataset
Bathymetry dataset class
- Variables
name – initial value: ‘’
nr_zoom_levels – initial value: 0
- get_data(xlim, ylim, max_cell_size)
Reads data from database Returns x, y, z
- read_data_from_netcdf_tiles(xl, yl, izoom, max_cell_size)
Reads data from database Returns x, y, z