Skip to content

Commit

Permalink
Cleanup IBCAO dataset/layer
Browse files Browse the repository at this point in the history
  • Loading branch information
trey-stafford committed Jun 26, 2023
1 parent 1a507fb commit 9789bd6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 139 deletions.
56 changes: 0 additions & 56 deletions qgreenland/config/datasets/bathymetric_chart.py
Original file line number Diff line number Diff line change
@@ -1,62 +1,6 @@
from qgreenland.models.config.asset import HttpAsset
from qgreenland.models.config.dataset import Dataset

bathymetric_chart = Dataset(
id="bathymetric_chart",
assets=[
HttpAsset(
id="only",
urls=[
"https://www.bodc.ac.uk/data/open_download/ibcao/ibcao_v4_2_400m_ice/cfnetcdf/",
],
),
],
metadata={
"title": "International Bathymetric Chart of the Arctic Ocean (IBCAO) V4.2",
"abstract": (
"""The goal of the IBCAO initiative is to develop a digital database
that contains all available bathymetric data north of 64° North, for
use by mapmakers, researchers, institutions, and others whose work
requires a detailed and accurate knowledge of the depth and the
shape of the Arctic seabed.
The IBCAO data set is included, as a regional compilation, in the
global GEBCO grid
[https://www.gebco.net/data_and_products/gridded_bathymetry_data/].
Disclaimer information:
The IBCAO V4.2 Grid, should NOT be used for navigation or for any
other purpose involving safety at sea.
The IBCAO V4.2 Grid is made available 'as is'. While every effort
has been made to ensure reliability within the limits of present
knowledge, the accuracy and completeness of The IBCAO V4.2 Grid
cannot be guaranteed.
No responsibility can be accepted by those involved in its creation
or publication for any consequential loss, injury or damage arising
from its use or for determining the fitness of The IBCAO V4.2 Grid
for any particular use.
The IBCAO V4.2 Grid is based on bathymetric data from many different
sources of varying quality and coverage.
As The IBCAO V4.2 Grid is an information product created by
interpolation of measured data, the resolution of the IBCAO V4.2
Grid may be significantly different to that of the resolution of the
underlying measured data."""
),
"citation": {
"text": (
"""GEBCO Compilation Group (2023) GEBCO 2023 Grid
(doi:10.5285/f98b053b-0cbc-6c23-e053-6c86abc0af7b)"""
),
"url": "https://www.gebco.net/data_and_products/gridded_bathymetry_data/arctic_ocean/",
},
},
)

gebco_bathymetric_chart = Dataset(
id="gebco_bathymetric_chart",
assets=[
Expand Down
106 changes: 23 additions & 83 deletions qgreenland/config/layers/Oceanography/Bathymetry/bathymetric_chart.py
Original file line number Diff line number Diff line change
@@ -1,96 +1,28 @@
from qgreenland.config.datasets.bathymetric_chart import bathymetric_chart as dataset
from qgreenland.config.datasets.bathymetric_chart import gebco_bathymetric_chart
from qgreenland.config.helpers.layers.geological_map import make_layer
from qgreenland.config.helpers.steps.compress_and_add_overviews import (
compress_and_add_overviews,
)
from qgreenland.config.helpers.steps.decompress import decompress_step
from qgreenland.config.helpers.steps.warp import warp
from qgreenland.config.helpers.steps.warp_and_cut import warp_and_cut
from qgreenland.config.project import project
from qgreenland.models.config.layer import Layer, LayerInput

bathymetric_raster_params = {
"id": "bathymetric_raster",
"title": "Depth (400m)",
"description": (
"""Bathymetric elevation in meters.
Elevations can be assumed to be relative to mean sea level. However,
note that there may be differences in the vertical datum (the basis for
elevations) for some older data from which this bathymetry dataset was
derived."""
),
"style": "ibcao_bathymetry",
"dataset": dataset,
"fn_mask": "bathymetry.*",
}

bathymetric_contours_params = {
"id": "bathymetric_contours",
"title": "Depth contours",
"description": (
"""This dataset includes linear features that represent
bathymetric contours recorded in metres,
derived from the International Bathymetric Chart of the Arctic Ocean."""
),
"style": "bathymetry",
"input_filepath": "data/shape/base/bathymetry",
"fn_mask": "bathymetry.*",
}


bathymetric_raster = Layer(
id=bathymetric_raster_params["id"],
title=bathymetric_raster_params["title"],
description=bathymetric_raster_params["description"],
tags=[],
style=bathymetric_raster_params["style"],
input=LayerInput(
dataset=bathymetric_raster_params["dataset"],
asset=dataset.assets["only"],
),
steps=[
*warp(
input_file="NETCDF:{input_dir}/IBCAO_v4_2_400m_ice.nc:z",
output_file="{output_dir}/bathymetric_chart.tif",
warp_args=(
"-s_srs",
'"+proj=stere +lat_0=90 +lat_ts=75 +datum=WGS84"',
"-dstnodata",
"-9999",
"-tr",
"400",
"400",
# This dataset does not contain CF-compliant fields or
# geotransform array. Set
# `GDAL_NETCDF_IGNORE_XY_AXIS_NAME_CHECKS` to `true` to use
# the provided `x` and `y` dims as coordinate values so that
# gdal can compute the transform on its own. See
# https://github.com/OSGeo/gdal/issues/4075
"--config",
"GDAL_NETCDF_IGNORE_XY_AXIS_NAME_CHECKS",
"true",
),
cut_file=project.boundaries["background"].filepath,
),
*compress_and_add_overviews(
input_file="{input_dir}/bathymetric_chart.tif",
output_file="{output_dir}/bathymetric_chart.tif",
dtype_is_float=True,
),
],
)


_background_boundary = project.boundaries["background"]
_background_bbox = _background_boundary.bbox
gebco_bathymetric_raster = Layer(
id="gebco_bathymetric_raster",
title="GEBCO depth",
description=bathymetric_raster_params["description"],
title="Dept (400m)",
description=(
"""Bathymetric elevation in meters.
Elevations can be assumed to be relative to mean sea level. However, in
some shallow water areas, the grids include data from sources having a
vertical datum other than mean sea level. We are working to understand
how best to fully assimilate these data."""
),
tags=[],
style=bathymetric_raster_params["style"],
style="gebco_bathymetry",
input=LayerInput(
dataset=gebco_bathymetric_chart,
asset=gebco_bathymetric_chart.assets["only"],
Expand All @@ -103,11 +35,6 @@
reproject_args=(
"-te",
f"{_background_bbox.min_x} {_background_bbox.min_y} {_background_bbox.max_x} {_background_bbox.max_y}",
"-dstnodata",
"-9999",
"-tr",
"400",
"400",
),
cut_file=project.boundaries["background"].filepath,
),
Expand All @@ -120,6 +47,19 @@
)


bathymetric_contours_params = {
"id": "bathymetric_contours",
"title": "Depth contours",
"description": (
"""This dataset includes linear features that represent
bathymetric contours recorded in metres,
derived from the International Bathymetric Chart of the Arctic Ocean."""
),
"style": "bathymetry",
"input_filepath": "data/shape/base/bathymetry",
"fn_mask": "bathymetry.*",
}

bathymetric_contours = make_layer(
layer_id=bathymetric_contours_params["id"],
layer_params=bathymetric_contours_params,
Expand Down

0 comments on commit 9789bd6

Please sign in to comment.