Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r.out.vtk: replace dead WMS server with NASA GIBS WMS in docs (#4844) #4854

Closed
wants to merge 8 commits into from
13 changes: 12 additions & 1 deletion python/grass/jupyter/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,21 @@
def show(self):
"""Displays a PNG image of map"""
# Lazy import to avoid an import-time dependency on IPython.
from IPython.display import Image # pylint: disable=import-outside-toplevel
from IPython.display import Image ,display # pylint: disable=import-outside-toplevel

Check failure on line 191 in python/grass/jupyter/map.py

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-22.04)

Ruff (E203)

python/grass/jupyter/map.py:191:42: E203 Whitespace before ','

Check failure on line 191 in python/grass/jupyter/map.py

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-22.04)

Ruff (E231)

python/grass/jupyter/map.py:191:43: E231 Missing whitespace after ','

Check failure on line 191 in python/grass/jupyter/map.py

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-22.04)

Ruff (F401)

python/grass/jupyter/map.py:191:44: F401 `IPython.display.display` imported but unused

Check failure on line 191 in python/grass/jupyter/map.py

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-22.04)

Ruff (E261)

python/grass/jupyter/map.py:191:51: E261 Insert at least two spaces before an inline comment
pesekon2 marked this conversation as resolved.
Show resolved Hide resolved

return Image(self._filename)

def save(self, filename):
"""Saves a PNG image of map to the specified *filename*"""
shutil.copy(self._filename, filename)

Check failure on line 198 in python/grass/jupyter/map.py

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-22.04)

Ruff (W293)

python/grass/jupyter/map.py:198:1: W293 Blank line contains whitespace
pesekon2 marked this conversation as resolved.
Show resolved Hide resolved
def _repr_pretty_(self, p, cycle):
"""Pretty representation of the object in IPython/Jupyter."""
# Lazy import to avoid an import-time dependency on IPython.
from IPython.display import Image, display # pylint: disable=import-outside-toplevel

if cycle:
# Handles recursive display
p.text("Map(...)")
else:
display(Image(self._filename))
12 changes: 11 additions & 1 deletion python/grass/jupyter/map3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,16 @@
def show(self):
"""Displays a PNG image of map"""
# Lazy import to avoid an import-time dependency on IPython.
from IPython.display import Image # pylint: disable=import-outside-toplevel
from IPython.display import Image, display # pylint: disable=import-outside-toplevel

Check failure on line 232 in python/grass/jupyter/map3d.py

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-22.04)

Ruff (F401)

python/grass/jupyter/map3d.py:232:44: F401 `IPython.display.display` imported but unused
pesekon2 marked this conversation as resolved.
Show resolved Hide resolved

return Image(self._filename)
def _repr_pretty_(self, p, cycle):

Check failure on line 235 in python/grass/jupyter/map3d.py

View workflow job for this annotation

GitHub Actions / Python Code Quality Checks (ubuntu-22.04)

Ruff (E301)

python/grass/jupyter/map3d.py:235:5: E301 Expected 1 blank line, found 0
pesekon2 marked this conversation as resolved.
Show resolved Hide resolved
"""Pretty representation of the object in IPython/Jupyter."""
# Lazy import to avoid an import-time dependency on IPython.
from IPython.display import Image, display # pylint: disable=import-outside-toplevel

if cycle:
p.text("Map(...)")
else:
display(Image(self._filename))

pesekon2 marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 3 additions & 3 deletions raster/r.out.vtk/r.out.vtk.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ <h3>Spearfish example with RGB data</h3>
g.region n=4926990 s=4914840 w=591570 e=607800 res=30 -p
Copy link
Contributor

Choose a reason for hiding this comment

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

The computational region should be changed to follow the region and coordinate system of the WMS used. The same applies to the title -- it is not Spearfish example with RGB data anymore.


# using r.in.wms to create RGB data to get a satellite coverage
r.in.wms layers=global_mosaic mapserver=http://wms.jpl.nasa.gov/wms.cgi \
output=wms_global_mosaic
r.in.wms layers=BlueMarbleNG mapserver=https://gibs.earthdata.nasa.gov/wms/epsg4326/best/wms.cgi?
pesekon2 marked this conversation as resolved.
Show resolved Hide resolved
output=wms_BlueMarbleNG

# export the data to VTK
r.out.vtk rgbmaps=wms_global_mosaic.red,wms_global_mosaic.green,wms_global_mosaic.blue \
r.out.vtk rgbmaps=wms_BlueMarbleNG.red,wms_BlueMarbleNG.green,wms_BlueMarbleNG.blue \
elevation=elevation.10m output=/tmp/out.vtk

# visualize in Paraview or other VTK viewer:
Expand Down
Loading