# grdimage/Earth Relief Model Plot problem

**URL:** <https://forum.generic-mapping-tools.org/t/grdimage-earth-relief-model-plot-problem/377>\
**Category:** PyGMT Q&A\
**Created:** [April 12, 2020, 7:19pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-earth-relief-model-plot-problem/377 "2020-04-12T19:19:05Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![deep](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@deep](https://forum.generic-mapping-tools.org/u/deep)\
**Post date:** [April 12, 2020, 7:19pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-earth-relief-model-plot-problem/377/1 "2020-04-12T19:19:05Z")

</div>

Hello,  
I am running PyGMT through anaconda (in a separate environment as suggested in the installation guide) on Ubuntu 18.04 LTS.  
As I am new to PyGMT and Python, I was going through some tutorials and I got stuck on a particular tutorial (Ocenia 2019 Tutorial on PyGMT). Below is the complete code that I am trying to run on Jupyter Notebook:

```python
# Example 3: Oceania 2019 Tutorial for PyGMT...continued

import pygmt

# Digital Elevation Model Map in Color

# Let's have a go at making a map of Oceania showing the ocean bathymetry and land elevation. 

# Create figure
fig=pygmt.Figure()

# We'll start by setting our basemap to focus on the Oceania region (=OC). 
# Our map frame will have tick marks at major and minor intervals (af), 
# and x and y axis labels on the 'W'est and 'S'outh sides only (WSne).

# Creating basic map elements via basemap
fig.basemap(region="=OC", frame=["af", "WSne"])

# GMT6 comes with a global Earth relief model (SRTM15+V2) that can be accessed 
# using special filenames like '@earth_relief_xxx'. Here, we'll plot the 1 arc minute grid
# using fig.grdimage, and explicitly use the 'geo' colormap to colour the terrain.

fig.grdimage(grid="@earth_relief_01m", cmap="geo")

# We'll also add a colorbar for good measure. 
# The position is set to be outside the map frame (J), at the Middle Right (MR) side. 
# The colorbar will automatically pick up the last colormap we used above, 
# but we can force the units to be in kilometres instead of the default metres using cmap="+Uk". 
# We'll also use frame to add annotated tick marks at suitable intervals to the colorbar (af), 
# and set the label to be in units km (+lkm).

fig.colorbar(position="JMR", cmap="+Uk", frame=["af", "y+lkm"])

# Show
fig.show()

# End of code

```

When I run this code, no image shows up as the tutorial suggests it should, no errors show up. All I see is that the kernel is busy. I have waited upto 20 minutes during a time when internet traffic is low (3 am my time) but nothing happens. I have checked the code with the original tutorial there is no discrepancy.

I ran the code from the jupyter notebook provided in the tutorial, I get the same issue described above.  
It appears the program gets into some sort of issue when executing

```python
fig.grdimage(grid="@earth_relief_01m", cmap="geo")

```

Any help will be much appreciated.  
I wanted to thank the GMT group for GMT 6 and PyGMT and for writing a clear installation guide. I was able to install PyGMT and GMT6 without any problems.

Thanks,  
Deep

---

<div class="post-metadata">

**Author:** ![weiji14](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/weiji14/32/33_2.png) [@weiji14](https://forum.generic-mapping-tools.org/u/weiji14)\
**Post date:** [April 12, 2020, 10:13pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-earth-relief-model-plot-problem/377/2 "2020-04-12T22:13:21Z")

</div>

Hi @deep, could you try running `grdimage` with debugging turned on? Not sure if it’s just a temporary server issue, or something else (the 01 arc minute earth relief grid is quite a big file). Just do:

```python
fig.grdimage(grid="@earth_relief_01m", cmap="geo", V="d")

```

and show us the output. Also, you could try to get a lower resolution grid (e.g. `@earth\_relief\_02m") and see if the same problem persists.

Oh, and by the way, that [FOSS4G 2019 Oceania](https://github.com/GenericMappingTools/foss4g2019oceania) tutorial uses a slightly older/different version of `pygmt`, and there are some python functions in Tutorial 2 & 3 (`blockmedian` and `grdimage` on RGB grids) that will require you to `pip install https://github.com/GenericMappingTools/pygmt/archive/foss4g2019oceania.zip` instead of `master`.

---

<div class="post-metadata">

**Author:** ![deep](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@deep](https://forum.generic-mapping-tools.org/u/deep)\
**Post date:** [April 13, 2020, 12:40pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-earth-relief-model-plot-problem/377/3 "2020-04-13T12:40:49Z")

</div>

Hi @weiji14,  
Thank you for your response. I will install the suggestion for the Oceania tutorial. Perhaps one day there will be a 2 day online PyGMT/GMT tutorial for Beginners 🙂  
The output is rather large so I am sending it in chunks as I could not upload a text file with the information. Almost 1000 lines of stuff came pouring out!

```auto
fig.grdimage(grid="@earth_relief_01m", cmap="geo", V="d")

```

It is rather large and won’t fit in the online editor.

---

<div class="post-metadata">

**Author:** ![deep](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@deep](https://forum.generic-mapping-tools.org/u/deep)\
**Post date:** [April 13, 2020, 12:40pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-earth-relief-model-plot-problem/377/4 "2020-04-13T12:40:59Z")

</div>

Deleted multiline output 1

---

<div class="post-metadata">

**Author:** ![deep](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@deep](https://forum.generic-mapping-tools.org/u/deep)\
**Post date:** [April 13, 2020, 12:41pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-earth-relief-model-plot-problem/377/5 "2020-04-13T12:41:56Z")

</div>

Part 2 of output deleted

---

<div class="post-metadata">

**Author:** ![deep](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@deep](https://forum.generic-mapping-tools.org/u/deep)\
**Post date:** [April 13, 2020, 12:42pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-earth-relief-model-plot-problem/377/6 "2020-04-13T12:42:28Z")

</div>

Output 3 deleted and a zip file is uploaded

---

<div class="post-metadata">

**Author:** ![deep](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@deep](https://forum.generic-mapping-tools.org/u/deep)\
**Post date:** [April 13, 2020, 12:42pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-earth-relief-model-plot-problem/377/7 "2020-04-13T12:42:55Z")

</div>

Part 4 of output deleted zip file of entire output uploaded

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [April 13, 2020, 1:37pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-earth-relief-model-plot-problem/377/8 "2020-04-13T13:37:10Z")

</div>

> [@deep](#):
>
> The output is rather large so I am sending it in chunks as I could not upload a text file with the information. Almost 1000 lines of stuff came pouring out!

You can zip it and attach the zip

---

<div class="post-metadata">

**Author:** ![deep](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@deep](https://forum.generic-mapping-tools.org/u/deep)\
**Post date:** [April 13, 2020, 2:39pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-earth-relief-model-plot-problem/377/9 "2020-04-13T14:39:19Z")

</div>

[grdimage with debugger.zip](https://forum.generic-mapping-tools.org/uploads/short-url/4QxGJDJWbIdrAU5UbWoaop11tyL.zip) (6.3 KB)  
Attached is the zip file with the output. I tried other resolutions and I got a figure for until a resolution of 5m. After that I am having the problem I originally posted.  
Thanks @Joaquim for giving me the zip tip 🙂

Thanks,

Deep

---

<div class="post-metadata">

**Author:** ![weiji14](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/weiji14/32/33_2.png) [@weiji14](https://forum.generic-mapping-tools.org/u/weiji14)\
**Post date:** [April 13, 2020, 10:48pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-earth-relief-model-plot-problem/377/10 "2020-04-13T22:48:27Z")

</div>

Hmm, it’s taking a long time for me as well for the `01m` grid when running `grdimage` on the Oceania `=OC` region (last chunk of error message below):

```auto
grdimage [DEBUG]: Found file /home/jovyan/.gmt/server/earth_relief_01m.grd
grdimage [DEBUG]: Look for file earth_relief_01m.grd in /home/jovyan/.gmt
grdimage [DEBUG]: Look for file earth_relief_01m.grd in /home/jovyan/.gmt/cache
grdimage [DEBUG]: Look for file earth_relief_01m.grd in /home/jovyan/.gmt/server
grdimage [DEBUG]: Found file /home/jovyan/.gmt/server/earth_relief_01m.grd
grdimage [DEBUG]: Object ID 0 : Registered Grid File earth_relief_01m.grd as an Input resource with geometry Surface [n_objects = 1]
grdimage [DEBUG]: api_begin_io: Input resource access is now enabled [container]
grdimage [DEBUG]: api_import_grid: Passed ID = 0 and mode = 1
grdimage [DEBUG]: Look for file earth_relief_01m.grd in /home/jovyan/.gmt
grdimage [DEBUG]: Look for file earth_relief_01m.grd in /home/jovyan/.gmt/cache
grdimage [DEBUG]: Look for file earth_relief_01m.grd in /home/jovyan/.gmt/server
grdimage [DEBUG]: Found file /home/jovyan/.gmt/server/earth_relief_01m.grd
grdimage [DEBUG]: Found file /home/jovyan/.gmt/server/earth_relief_01m.grd
grdimage [DEBUG]: Geographic input grid, longitudes span exactly 360
grdimage [DEBUG]: GMT_End_IO: Input resource access is now disabled
grdimage [WARNING]: Spherical approximation used!
grdimage [WARNING]: Central meridian not given, default to 190.91
grdimage [DEBUG]: Projected values in meters: -1.04622e+07 1.04622e+07 -6.12873e+06 3.15813e+06
grdimage [INFORMATION]: Map scale is 1394.96 km per cm or 1:1.39496e+08.
grdimage [DEBUG]: Running in PS mode modern
grdimage [DEBUG]: Use PS filename /home/jovyan/.gmt/sessions/gmt6.151/gmt_5.ps-
grdimage [DEBUG]: Append to hidden PS file /home/jovyan/.gmt/sessions/gmt6.151/gmt_5.ps-
grdimage [DEBUG]: Got session name as pygmt-session and default graphics formats as pdf
grdimage [INFORMATION]: Allocate and read data from file @earth_relief_01m.grd
grdimage [DEBUG]: api_begin_io: Input resource access is now enabled [container]
grdimage [DEBUG]: api_import_grid: Passed ID = 0 and mode = 2
grdimage [INFORMATION]: Reading grid from file earth_relief_01m.grd
grdimage [DEBUG]: processing at most 0 (0x2) chunks at a time (0.0 MiB)...

```

It works if you change the country code to somewhere else (e.g. AU, BR, CA, etc). Might be something wrong with processing continent-scale images (e.g. =AS, =OC, =EU, etc). This doesn’t seem like a server/internet connection issue since I’ve got a cached image, something to do with how `grdimage` is processing things?
