GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remote datasets: Add "load_earth_dist" to load "GSHHG Earth distance to shoreline" dataset by yvonnefroehlich · Pull Request #3706 · GenericMappingTools/pygmt

Conversation

@yvonnefroehlich

@yvonnefroehlich yvonnefroehlich commented Dec 22, 2024 •
edited by seisman
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Description of proposed changes

Add load_earth_dist to download the "GSHHG Earth distance to shoreline" dataset and load into a xarray.DataArray:

  • Official documentation: https://www.generic-mapping-tools.org/remote-datasets/earth-dist.html
  • Recipe: https://github.com/GenericMappingTools/gmtserver-admin/blob/master/recipes/earth_dist.recipe

Adresses #2431

Preview: https://pygmt-dev--3706.org.readthedocs.build/en/3706/api/generated/pygmt.datasets.load_earth_dist.html

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.
  • Use underscores (not hyphens) in names of Python files and directories.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash command is:

  • /format: automatically format and lint the code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
yvonnefroehlich added 7 commits December 22, 2024 16:56
@yvonnefroehlich
Add remote dataset 'distance to shoreline'
12d7403
@yvonnefroehlich
Include 'distance to shoreline' dataset
1497919
@yvonnefroehlich
Fix style | Fix typo
1820add
@yvonnefroehlich
Fix line length
bea3e73
@yvonnefroehlich
Add unit
cea9074
@yvonnefroehlich
Fix indent
d4a1762
@yvonnefroehlich
Fix indent
81a59bf
@yvonnefroehlich yvonnefroehlich added the enhancement Improving an existing feature label Dec 22, 2024
@yvonnefroehlich

yvonnefroehlich commented Dec 22, 2024

Copy link
Copy Markdown
Member Author

/format

github-actions[bot] reacted with rocket emoji github-actions[bot] reacted with eyes emoji
All reactions
  • 🚀 1 reaction
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@yvonnefroehlich yvonnefroehlich mentioned this pull request Dec 22, 2024
Add load_* functions to support more remote relief datasets #2431
Closed
10 tasks done
yvonnefroehlich added 4 commits December 22, 2024 19:54
@yvonnefroehlich
Remove tab
98de2f9
@yvonnefroehlich
Remove execusion permission
e6a52f7
@yvonnefroehlich
Adjust minimum values
c7edcc1
@yvonnefroehlich
Adjust maximum values
5e55944
@yvonnefroehlich yvonnefroehlich changed the title Add load_earth_dist to load GSHHG Earth Distance to Shoreline dataset in various resolutions Remote datasets: Add "load_earth_dist" to load "GSHHG Earth distance to shoreline" dataset Dec 22, 2024
@yvonnefroehlich yvonnefroehlich self-assigned this Dec 22, 2024
@seisman

seisman commented Dec 23, 2024

Copy link
Copy Markdown
Member

Thanks for working on this function. I feel we should first update the upstream documentation to clarify the following points:

  1. The distance unit is km
  2. The distances have both negative and positive values. Positive means land to coastline and negative means ocean to coastline.
  3. For the dataset image, maybe we should add the coastline to make the image more readable. Like this one:
    map
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

seisman
seisman reviewed Dec 23, 2024
View reviewed changes
Comment thread pygmt/datasets/earth_dist.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/datasets/earth_dist.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/datasets/earth_dist.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/helpers/caching.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/tests/test_datasets_earth_dist.py
assert data.attrs["units"] == "km"
assert data.attrs["horizontal_datum"] == "WGS84"
assert data.shape == (181, 361)
assert data.gmt.registration == 0

@seisman seisman Dec 23, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update to the new syntax in #3696, depending on which PR is merged first.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

yvonnefroehlich reacted with eyes emoji
All reactions
  • 👀 1 reaction
Comment thread pygmt/tests/test_datasets_earth_dist.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/tests/test_datasets_earth_dist.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@seisman seisman added feature Brand new feature and removed enhancement Improving an existing feature labels Dec 23, 2024
yvonnefroehlich and others added 3 commits December 23, 2024 22:49
@yvonnefroehlich @seisman
Fix typos
c9990bb
Co-authored-by: Dongdong Tian <[email protected]>
@yvonnefroehlich @seisman
Round min max values
9ae76ed
Co-authored-by: Dongdong Tian <[email protected]>
@yvonnefroehlich
Add nc file to caching
2404d9c
@yvonnefroehlich yvonnefroehlich mentioned this pull request Dec 23, 2024
Dataset "GSHHG Earth distance to shoreline": Update docs and add coastlines to images GenericMappingTools/remote-datasets#126
Merged
3 tasks
@seisman seisman added this to the 0.14.0 milestone Dec 24, 2024
seisman
seisman reviewed Dec 24, 2024
View reviewed changes
Comment thread pygmt/datasets/earth_dist.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

yvonnefroehlich added 2 commits December 24, 2024 09:38
@yvonnefroehlich
Explain sign of data
0682a10
@yvonnefroehlich
Replace tab by white spaces
54aa002
@seisman seisman added the final review call This PR requires final review and approval from a second reviewer label Dec 24, 2024
seisman
seisman approved these changes Dec 24, 2024
View reviewed changes

@seisman seisman left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. The dataset image will be updated automatically when the upstream PR is merged.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@seisman seisman mentioned this pull request Dec 24, 2024
Release PyGMT v0.14.0 #3691
Closed
37 of 49 tasks
@yvonnefroehlich

yvonnefroehlich commented Dec 25, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Currently we use both, the abbreviation and the complete word for units in load_remote_datasets.py:

pygmt/pygmt/datasets/load_remote_dataset.py

Lines 113 to 115 in b90fa46

"earth_gebco": GMTRemoteDataset(
description="GEBCO Earth relief",
units="meters",

but

pygmt/pygmt/datasets/load_remote_dataset.py

Lines 135 to 137 in b90fa46

"earth_geoid": GMTRemoteDataset(
description="EGM2008 Earth geoid",
units="m",

I think we should decide on one way and update the dictionary in load_remote_datasets.py and the related tests.

Edit:
For the unit "meters", the complete word may be better to avoid a confusion with the "m" used in the resolution argument, which means arc-minutes.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@seisman

seisman commented Dec 25, 2024

Copy link
Copy Markdown
Member

That's a good point. The CF convention mentions that the unit string must be recognized by the UDUNIT package. I quickly read the UNUNIT documentation, I think valid values are meter, m and metre (without s). But the CF-convention has an example that uses meters (https://cfconventions.org/Data/cf-conventions/cf-conventions-1.12/cf-conventions.html#vertical-coordinate).

yvonnefroehlich reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@seisman

seisman commented Dec 26, 2024

Copy link
Copy Markdown
Member

This section (http://cfconventions.org/Data/cf-conventions/cf-conventions-1.12/cf-conventions.html#_dimensional_vertical_coordinate) says:

Plural forms are also acceptable.

So I think meters/meter/m are fine. Let's use meters then.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Dec 26, 2024
@seisman
seisman merged commit ebe9df1 into main Dec 26, 2024
@seisman
seisman deleted the add-remote-earth-dist branch December 26, 2024 02:51
@yvonnefroehlich yvonnefroehlich mentioned this pull request Dec 26, 2024
Remote Datasets: Use complete word for units in "load_remote_dataset" and related tests #3725
Merged
6 tasks
@yvonnefroehlich

yvonnefroehlich commented Dec 26, 2024

Copy link
Copy Markdown
Member Author

This section (http://cfconventions.org/Data/cf-conventions/cf-conventions-1.12/cf-conventions.html#_dimensional_vertical_coordinate) says:

Plural forms are also acceptable.

So I think meters/meter/m are fine. Let's use meters then.

Submitted PR #3725 for updating this for all datasets.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@seisman seisman seisman approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@yvonnefroehlich yvonnefroehlich

Labels

feature Brand new feature

Projects

None yet

Milestone

0.14.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@yvonnefroehlich @seisman
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.