-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add function to fetch Southern Africa topography (#27)
Add new function to Ensaio for fetching and caching a netCDF grid of Southern Africa topography cropped from full-resolution ETOPO1.
- Loading branch information
1 parent
d2d0fa6
commit 432b396
Showing
4 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright (c) 2021 The Ensaio Developers. | ||
# Distributed under the terms of the BSD 3-Clause License. | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# | ||
# This code is part of the Fatiando a Terra project (https://www.fatiando.org) | ||
# | ||
""" | ||
Topography and bathymetry of Southern Africa | ||
-------------------------------------------- | ||
This dataset consists in a regular grid with topography and bathymetry over | ||
Southern Africa. It was generated by cropping the ETOPO1 global topography | ||
grid to the desired area. | ||
The topography and bathymetry heights are referenced to sea level (what can be | ||
considered as the geoid). | ||
**Original source:** `ETOPO1 | ||
<https://doi.org/10.7289/V5C8276M>`__ | ||
""" | ||
import pygmt | ||
import xarray as xr | ||
|
||
import ensaio | ||
|
||
############################################################################### | ||
# Download and cache the data and return the path to it on disk | ||
fname = ensaio.fetch_southern_africa_topography(version=1) | ||
print(fname) | ||
|
||
############################################################################### | ||
# Load the netCDF file with xarray (netcdf4 is required) | ||
data = xr.load_dataarray(fname) | ||
data | ||
|
||
############################################################################### | ||
# Make a PyGMT map of the topography and bathymetry data | ||
fig = pygmt.Figure() | ||
fig.grdimage(data, cmap="etopo1", projection="M15c") | ||
fig.colorbar(frame='af+l"topography [m]"', position="JCR") | ||
fig.basemap(frame=True) | ||
fig.coast(shorelines="0.1p", area_thresh=1e4) | ||
fig.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters