Skip to content

Conversation

@maxrjones
Copy link
Member

Description of proposed changes

Took me a couple tries to get this working today, hoping this simple docs PR will help other readers.

Fixes #

Reminders

  • Make sure that your code follows our style. Use the other functions/files as a basis.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Describe changes to function behavior and arguments in a comment below the function declaration.
  • If adding new functionality, add a detailed description to the documentation and/or an example.

@maxrjones maxrjones requested a review from a team February 23, 2023 22:49
@PaulWessel PaulWessel merged commit 3d4dbe3 into master Feb 24, 2023
@PaulWessel PaulWessel deleted the grdimage-Q-description branch February 24, 2023 06:54
weiji14 added a commit to GenericMappingTools/pygmt that referenced this pull request Jul 8, 2023
weiji14 added a commit to GenericMappingTools/pygmt that referenced this pull request Aug 8, 2023
Saving 3-band xarray.DataArray images to a temporary GeoTIFF
so that they can be plotted with grdimage.

* Refactor to use tempfile_from_image

Putting the temporary GeoTIFF creation logic in a dedicated
tempfile_from_image helper function, so that it can be reused
by other GMT modules besides grdimage. Also ensure that an
ImportError is raised when the `.rio` attribute cannot be found
when rioxarray is not installed.

* Let tilemap use tempfile_from_image func in virtualfile_from_data

Refactor Figure.tilemap to use the same tempfile_from_image
function that generates a temporary GeoTIFF file from the 3-band
xarray.DataArray images.

* Update docstring of grdimage with upstream GMT 6.4.0

Various updates from upstream GMT at
GenericMappingTools/gmt#6258,
GenericMappingTools/gmt@9069967,
GenericMappingTools/gmt#7260.

* Raise RuntimeWarning when input image dtype is not uint8

Plotting a non-uint8 dtype xarray.DataArray works in grdimage,
but the results will likely be incorrect. Warning the user about
the incorrect dtype, and suggest recasting to uint8 with 0-255 range,
e.g. using a histogram equalization function like
skimage.exposure.equalize_hist.

---------

Co-authored-by: Dongdong Tian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants