# Help plotting netcdf files with gmt5

**URL:** <https://forum.generic-mapping-tools.org/t/help-plotting-netcdf-files-with-gmt5/1261>\
**Category:** Q&A\
**Created:** [January 25, 2021, 11:21am UTC](https://forum.generic-mapping-tools.org/t/help-plotting-netcdf-files-with-gmt5/1261 "2021-01-25T11:21:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gg1slb](https://avatars.discourse-cdn.com/v4/letter/g/b5ac83/32.png) [@gg1slb](https://forum.generic-mapping-tools.org/u/gg1slb)\
**Post date:** [January 25, 2021, 11:21am UTC](https://forum.generic-mapping-tools.org/t/help-plotting-netcdf-files-with-gmt5/1261/1 "2021-01-25T11:21:59Z")

</div>

Hello  
I hope you can help. I have moved from GMT4.5 to GMT 5 and I am trying to plot netcdf file - see the ncdump - the variable ‘thk’.  
I have never tried to plot a netcdf before.

I am using this grdimage command:  
grdimage -V ./GRD/thk\_422.nc -R0/2000/0/2000 -JX10/10 -Ba10 -C./CPT/ice\_ais.cpt -O -K \>\> PLOT/ICE.ps

However when I plot, I get an error message that the grid been outside  
grdimage: Allocates memory and read data file ./GRD/thk\_422.nc  
grdimage: Your grid y’s or latitudes appear to be outside the map region and will be skipped.  
grdimage: No grid or image inside plot domain

any help would be great  
ncdump information: netcdf thk\_422 {  
dimensions:  
y1 = 1929 ;  
x1 = 1571 ;  
variables:  
double thk(y1, x1) ;  
thk:units = “meter” ;  
thk:long\_name = “ice thickness” ;  
thk:standard\_name = “land\_ice\_thickness” ;  
thk:\_FillValue = 1.e+20 ;  
thk:missing\_value = 1.e+20 ;  
thk:cell\_methods = “time: mean” ;  
double x1(x1) ;  
x1:units = “meter” ;  
x1:long\_name = “Cartesian x-coordinate” ;  
x1:axis = “X” ;  
double y1(y1) ;  
y1:units = “meter” ;  
y1:long\_name = “Cartesian y-coordinate” ;  
y1:axis = “Y” ;

// global attributes:  
:Conventions = “CF-1.3” ;  
:title = “” ;  
:institution = “” ;  
:source = “” ;  
:history = “Mon Jan 25 12:07:18 2021: ncwa -a time thk\_422\_B.nc thk\_422\_C.nc\n”,  
“Mon Jan 25 12:05:08 2021: ncks -C -O -x -vtime thk\_422.nc thk\_422\_B.nc\n”,  
“Tue Jan 19 18:07:05 2021: ncks -vthk TG-NAIS-cb1-96201207.cism.h.0422-01-01-00000.nc thk\_422.nc\n”,  
“” ;  
:references = “” ;  
:comment = “” ;  
:configuration = “” ;  
:cesmYMD = 4220101 ;  
:cesmTOD = 0 ;  
:glcYMD = 4220101 ;  
:glcTOD = 0 ;  
:elapsed\_days = 150015 ;  
:time\_period\_freq = “year\_1” ;  
:model\_doi\_url = “[https://doi.org/10.5065/D67H1H0V](https://doi.org/10.5065/D67H1H0V)” ;  
:NCO = "“4.6.0"” ;  
:nco\_openmp\_thread\_number = 1 ;

---

<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:** [January 25, 2021, 3:00pm UTC](https://forum.generic-mapping-tools.org/t/help-plotting-netcdf-files-with-gmt5/1261/2 "2021-01-25T15:00:51Z")

</div>

> [@gg1slb](#):
>
> I have moved from GMT4.5 to GMT 5

Why?  
In GMT6 you could just do (and maybe in GMT5 maybe too but we don’t use it anymore)

```auto
grdimage -V ./GRD/thk_422.nc -Ba -C./CPT/ice_ais.cpt ...

```

---

<div class="post-metadata">

**Author:** ![gg1slb](https://avatars.discourse-cdn.com/v4/letter/g/b5ac83/32.png) [@gg1slb](https://forum.generic-mapping-tools.org/u/gg1slb)\
**Post date:** [January 25, 2021, 3:47pm UTC](https://forum.generic-mapping-tools.org/t/help-plotting-netcdf-files-with-gmt5/1261/3 "2021-01-25T15:47:50Z")

</div>

Hi Joaquim

The computer I work on only has gmt5.4.3 - the version I use is really out of my control

This is the command that I thought would work - just as you type.

Sarah

---

<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:** [January 25, 2021, 4:12pm UTC](https://forum.generic-mapping-tools.org/t/help-plotting-netcdf-files-with-gmt5/1261/4 "2021-01-25T16:12:47Z")

</div>

OK, the error message is saying that the -R limits do not fit with the grid coordinates. In these cases you should use `grdinfo` instead of looking at the output of `ncdump`

---

<div class="post-metadata">

**Author:** ![gg1slb](https://avatars.discourse-cdn.com/v4/letter/g/b5ac83/32.png) [@gg1slb](https://forum.generic-mapping-tools.org/u/gg1slb)\
**Post date:** [January 25, 2021, 4:24pm UTC](https://forum.generic-mapping-tools.org/t/help-plotting-netcdf-files-with-gmt5/1261/5 "2021-01-25T16:24:38Z")

</div>

Thanks for the tip. I had totally forgotten about grdinfo

This gives me a totally different set of limits. : larger than what I was adding for -R.  
I think this will do the trick!

Sarah
