Skip to main content

Install

Install using pip:

pip install global_ddm

Description

Python has a library called global_land_mask, which contains sea and land masks with a global resolution of 1km, using GLOBE's DEM dataset( https://www.ngdc.noaa.gov/mgg/topo/gltiles.html ). It should be made with an altitude greater than 0 indicating land and less than 0 indicating ocean. Based on his dataset, first sparsify the spatial accuracy of the dataset from 1km to 5km. Then apply this calculation method: calculate the distance to the nearest sea grid point on land, and calculate the distance to the nearest land grid point on the ocean.

Simple example

from global_ddm import globe
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import CenteredNorm

lat = np.linspace(-90,90,181)
lon = np.linspace(-180,180,361)

lat,lon = np.meshgrid(lat,lon)
ddm = globe.get_ddm(lat, lon)

plt.figure(figsize=(16,8))
plt.pcolormesh(lon, lat, ddm, cmap='bwr', norm=CenteredNorm())
plt.colorbar()
plt.tight_layout()
plt.show()

API Reference

from global_ddm import globe
globe.xxxx(args)

1. get_ddm

This function is used to retrieve a boolean array indicating whether the given coordinates are in the ocean.

Parameters

  • lat: ndarray or float, latitude in degrees.
  • lon: ndarray or float, longitude in degrees.

Returns

  • is_ocean_mask: ndarray or float, a boolean array denoting whether the corresponding point is in the ocean.

2. is_land

This function is used to determine whether the given coordinates are on land.

Parameters

  • lat: ndarray or float, latitude in degrees.
  • lon: ndarray or float, longitude in degrees.

Returns

  • Boolean value indicating whether the coordinates are on land.

3. is_ocean

This function is used to determine whether the given coordinates are in the ocean.

Parameters

  • lat: ndarray or float, latitude in degrees.
  • lon: ndarray or float, longitude in degrees.

Returns

  • Boolean value indicating whether the coordinates are in the ocean.

4. off_coastline

This function is used to determine whether the distance from the coastline exceeds the specified distance.

Parameters

  • lat: ndarray or float, latitude in degrees.
  • lon: ndarray or float, longitude in degrees.
  • distance: ndarray or float, distance away from the coastline in kilometers.

Returns

  • Boolean value indicating whether the distance from the coastline exceeds the specified distance.

5. on_coastline

This function is used to determine whether the distance from the coastline does not exceed the specified distance.

Parameters

  • lat: ndarray or float, latitude in degrees.
  • lon: ndarray or float, longitude in degrees.
  • distance: ndarray or float, distance away from the coastline in kilometers.

Returns

  • Boolean value indicating whether the distance from the coastline does not exceed the specified distance.

Release files for global_ddm 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for global_ddm 1.0.3
File Size Uploaded
global_ddm-1.0.3.tar.gz 16.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for global_ddm 1.0.3
File Interpreter ABI Platform
global_ddm-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 33.2 MB

Release files / global_ddm-1.0.3.tar.gz

Download URL global_ddm-1.0.3.tar.gz
Size 16.6 MB
Tags Source
SHA-256 checksum
How to use checksums
3f4f50c9c6037420d79c64c368e9ff8f7cfae117c55a647de91daff87a82f63a
BLAKE2b-256 checksum
How to use checksums
1dc2f81626d5b753b81423692f68cb3d253cfbe79c6e9a38bcd7a4c34e3f802a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release files / global_ddm-1.0.3-py3-none-any.whl

Download URL global_ddm-1.0.3-py3-none-any.whl
Size 16.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
5c480300b3cbb66b88f87a8043321b0aa6ecff6ad3025e2e4c62798e229ea5cd
BLAKE2b-256 checksum
How to use checksums
68b38c83485328d67af76d2134c94261aafa47740b65417e736b38317e7b75f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page