Skip to content

Add gallery example for grdgradient - #1428

Merged
seisman merged 46 commits into
GenericMappingTools:mainfrom
yohaimagen:grdgradient_gallery_example
Sep 17, 2021
Merged

seisman merged 46 commits into
GenericMappingTools:mainfrom
yohaimagen:grdgradient_gallery_example

Conversation

@yohaimagen

@yohaimagen yohaimagen commented Aug 10, 2021 •

Copy link
Copy Markdown
Contributor

adding a gallery example of producing a hillshade map out of a Data Elevation Model with pygmt.grdgradient

Preview at https://pygmt-git-fork-yohaimagen-grdgradientgalleryexample-gmt.vercel.app/gallery/images/grdgradient.html

grdgradient gallery example

Fixes #1425

@yohaimagen yohaimagen self-assigned this Aug 10, 2021
@yohaimagen yohaimagen added the documentation Improvements or additions to documentation label Aug 10, 2021
@yohaimagen

Copy link
Copy Markdown
Contributor Author

At #1425 I suggest also extending the Plotting Earth relief tutorial to include a section that uses shading=True in grdimage which use grdgradient in order of making a hillshade map, and from there reference to this gallery example for more specific usage of grdgradient, do you think it necessary? and if yes should I do it over here or on a different pull request?

@seisman seisman added this to the 0.5.0 milestone Aug 10, 2021
@weiji14
weiji14 requested a review from a team August 30, 2021 04:28
Comment thread examples/gallery/images/grdgradient.py Resolved
Comment thread examples/gallery/images/grdgradient.py Resolved
Comment thread examples/gallery/images/grdgradient.py Resolved
Comment thread examples/gallery/images/grdgradient.py Resolved
Comment thread examples/gallery/images/grdgradient.py Outdated
# Load sample grid (3 arc second global relief) in target area
grid = pygmt.datasets.load_earth_relief(resolution="03s", region=region)

# calculate the reflection of a light source projecting from west to east(azimuth 270)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
# calculate the reflection of a light source projecting from west to east(azimuth 270)
# calculate the reflection of a light source projecting from west to east (azimuth 270 degrees)

Comment thread examples/gallery/images/grdgradient.py Resolved
Comment thread examples/gallery/images/grdgradient.py Resolved
Comment thread examples/gallery/images/grdgradient.py Outdated
# --------------- plotting the hillshade map -----------
pygmt.makecpt(cmap="gray", series=[-1.5, 0.3, 0.01])
fig.grdimage(
grid=dgrid,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can anyone confirm the definition of a hillshaded map? Based on my own understanding, hillshading means plotting the elevation data grid, and also apply the (-1,1) intensity grid dgrid for each point. Thus a hillshaded map should be like this (the CPT range should also be changed to reflect the elevation range):

Suggested change
grid=dgrid,
grid=grid,
shading=dgrid,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is no one answer to this. I think what is plotted in this gallery example could be considered a 'hillshade map' (showing only the hillshade component) but not a 'hillshaded map' implying that the hillshade component alters the appearance of other data (e.g., elevation) that are shown on the map.

My opinion is that it would be better to plot a slope map for the simple grdgradient gallery example and that hillshading should be covered in a different tutorial that can go into different strategies (e.g., multi-directional, mixing slope and hillshade for illumination, transparent overlays versus grdgradient's shading parameter, etc). Sorry for not commenting about this earlier. It will be a great addition to have an example for grdgradient.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is no one answer to this. I think what is plotted in this gallery example could be considered a 'hillshade map' (showing only the hillshade component) but not a 'hillshaded map' implying that the hillshade component alters the appearance of other data (e.g., elevation) that are shown on the map.

Agree with @meghanrjones regarding this point! I think the example itself is good as is in the current form but would also suggest to add another example/tutorial on this topic.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ill agree that a slops map is more intuitive when you think on the gradient of a DEM. On the other hand, at least in my experience, shade maps are more intuitive to use(you are seeing the topography directly).

Comment thread .github/workflows/cache_data.yaml Resolved
Comment thread examples/gallery/images/grdgradient.py Resolved
Comment thread examples/gallery/images/grdgradient.py Resolved
Comment thread examples/gallery/images/grdgradient.py Resolved
Comment thread examples/gallery/images/grdgradient.py Resolved
Comment thread examples/gallery/images/grdgradient.py Resolved
Comment thread examples/gallery/images/grdgradient.py Resolved
@seisman seisman added the final review call This PR requires final review and approval from a second reviewer label Sep 16, 2021

@seisman seisman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@yohaimagen Nice work. The example now looks good to me.

@yohaimagen

Copy link
Copy Markdown
Contributor Author

Thanks!
We still have one problem when looking in the deployment the title of the example is getting outside of the respective white box.
Screen Shot 2021-09-16 at 9 37 09
Can we decrease the font size in that case? or we should change the title?

@seisman

seisman commented Sep 16, 2021

Copy link
Copy Markdown
Member

Maybe we can change the title to "Calculating grid gradient and radiance".

Comment thread examples/gallery/images/grdgradient.py Resolved
Comment thread examples/gallery/images/grdgradient.py Resolved
Comment thread examples/gallery/images/grdgradient.py Resolved

@michaelgrund michaelgrund left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Except the minor changes I suggested this PR looks good to me.

Comment thread examples/gallery/images/grdgradient.py Resolved
Co-authored-by: Michael Grund <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
@seisman
seisman merged commit 0327262 into GenericMappingTools:main Sep 17, 2021
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Sep 17, 2021
@yohaimagen
yohaimagen deleted the grdgradient_gallery_example branch September 17, 2021 05:48
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
Co-authored-by: Michael Grund <[email protected]>
Co-authored-by: Will Schlitzer <[email protected]>
Co-authored-by: Meghan Jones <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>

This branch was previously deployed

1 inactive deployment
Preview — 90a7dff4 Deployed Sep 17, 2021 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an example of the use of pygmt.grdgradient

6 participants