# netCDF error in manipulating GRD files

**URL:** <https://forum.generic-mapping-tools.org/t/netcdf-error-in-manipulating-grd-files/550>\
**Category:** Q&A\
**Tags:** gmt\
**Created:** [June 17, 2020, 8:22am UTC](https://forum.generic-mapping-tools.org/t/netcdf-error-in-manipulating-grd-files/550 "2020-06-17T08:22:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yosuke](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/yosuke/32/344_2.png) [@yosuke](https://forum.generic-mapping-tools.org/u/yosuke)\
**Post date:** [June 17, 2020, 8:22am UTC](https://forum.generic-mapping-tools.org/t/netcdf-error-in-manipulating-grd-files/550/1 "2020-06-17T08:22:31Z")

</div>

Hello, I am struggling on erratic behavior of grdmath, which is likely an issue of netCDF.

I have installed GMT5 via Macports and using  
gmt5 @5.4.5\_3+gdal+nonfree+pcre  
and  
netcdf @4.7.4\_0+cdf5+dap+netcdf4

When I excuse grdmath to manipulate grd files like  
% gmt grdmath a.grd b.grd SUM = c.grd  
then I saw a strange error message as  
_NetCDF: Attempting netcdf-4 operation on netcdf-3 file_  
This is my first time to see this message with GMT in last 20 or so years, and I suspect it does have something to do with recent upgrading of netCDF.

If you could inform me how to get out of this problem. I would be much appreciated.

Thanks in advance ,  
Yosuke

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [June 17, 2020, 8:51am UTC](https://forum.generic-mapping-tools.org/t/netcdf-error-in-manipulating-grd-files/550/2 "2020-06-17T08:51:59Z")

</div>

THis is a new behavior in the netcdf library that we of course cannot do anything about in old GMT version. So combination of ancient GMT 5 and brand new netcdf is a problem. Either get a netcdf version from before April (I think).

---

<div class="post-metadata">

**Author:** ![yosuke](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/yosuke/32/344_2.png) [@yosuke](https://forum.generic-mapping-tools.org/u/yosuke)\
**Post date:** [June 17, 2020, 9:46am UTC](https://forum.generic-mapping-tools.org/t/netcdf-error-in-manipulating-grd-files/550/3 "2020-06-17T09:46:52Z")

</div>

Thank you for your quick response. So do you think that moving onto GMT6 (keeping the same new netCDF) will solve the problem?

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [June 17, 2020, 6:58pm UTC](https://forum.generic-mapping-tools.org/t/netcdf-error-in-manipulating-grd-files/550/4 "2020-06-17T18:58:36Z")

</div>

No. GMT 6.0.0 was released last November while the netcdf update happened in April. We have fixed this on our end in GMT 6.1 repository so those who build from github already have the fix. We are working on a 6.1 release to come out before the end of June.

---

<div class="post-metadata">

**Author:** ![yosuke](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/yosuke/32/344_2.png) [@yosuke](https://forum.generic-mapping-tools.org/u/yosuke)\
**Post date:** [June 17, 2020, 9:59pm UTC](https://forum.generic-mapping-tools.org/t/netcdf-error-in-manipulating-grd-files/550/5 "2020-06-17T21:59:36Z")

</div>

Thank you for useful info!
