# Grdimage projection bug?

**URL:** <https://forum.generic-mapping-tools.org/t/grdimage-projection-bug/2968>\
**Category:** Q&A\
**Created:** [May 29, 2022, 6:52pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-projection-bug/2968 "2022-05-29T18:52:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![thwbecker](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/thwbecker/32/1215_2.png) [@thwbecker](https://forum.generic-mapping-tools.org/u/thwbecker)\
**Post date:** [May 29, 2022, 6:52pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-projection-bug/2968/1 "2022-05-29T18:52:46Z")

</div>

I have a seemingly well behaved netcdf file

```auto
    grdinfo tmp.grd
    tmp.grd: Title: 
    tmp.grd: Command: 
    tmp.grd: Remark: 
    tmp.grd: Gridline node registration used [Cartesian grid]
    tmp.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
    tmp.grd: x_min: 0 x_max: 360 x_inc: 0.15 name: x n_columns: 2401
    tmp.grd: y_min: -90 y_max: 90 y_inc: 0.15 name: y n_rows: 1201
    tmp.grd: v_min: -3.18232 v_max: 2.56523 name: z
    tmp.grd: scale_factor: 1 add_offset: 0
    tmp.grd: format: netCDF-4 chunk_size: 134,134 shuffle: on deflation_level: 3
    tmp.grd: Default CPT: 

```

which I am trying to plot with grdimage. Using -JH100, no problem:

```auto
     grdimage -fg -Rg -JH100/7 tmp.grd -P -Ctmp.cpt > tmp.ps

```

shifting the reference longitude \> 100, core dump:

```auto
grdimage -fg -Rg -JN101/7 tmp.grd -P -Ctmp.cpt > tmp.ps
ERROR: Caught signal number 11 (Segmentation fault) at
/usr/local/lib/libgmt.so.6(gmt_grd_project+0x16a6)[0x145a59d7aa16]
[0x56191cea6598]
Stack backtrace:
/usr/local/lib/libgmt.so.6(sig_handler_unix+0xf1)[0x145a59d093d1]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x14420)[0x145a59af9420]
/usr/local/lib/libgmt.so.6(gmt_grd_project+0x16a6)[0x145a59d7aa16]
/usr/local/lib/libgmt.so.6(GMT_grdimage+0x5068)[0x145a59efd018]
/usr/local/lib/libgmt.so.6(GMT_Call_Module+0x3cf)[0x145a59ba550f]
grdimage(main+0x343)[0x56111bfed703]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x145a59917083]
grdimage(_start+0x2e)[0x56111bfee8de]

```

Am I missing something? lon \> 120 seems to work

Thanks!

6.4.0\_07159ed-dirty\_2022.05.28 [64-bit]

---

<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:** [May 29, 2022, 10:10pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-projection-bug/2968/2 "2022-05-29T22:10:08Z")

</div>

Does this works for you (it does for me)?

```auto
grdimage -fg -Rg -JN101/7 @earth_relief_20m -png lixo

```

---

<div class="post-metadata">

**Author:** ![thwbecker](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/thwbecker/32/1215_2.png) [@thwbecker](https://forum.generic-mapping-tools.org/u/thwbecker)\
**Post date:** [May 30, 2022, 4:01pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-projection-bug/2968/3 "2022-05-30T16:01:53Z")

</div>

Yup. Bizarre.

Thanks for trying this. Must be the grd file then? I am now getting a warning (didn’t see this earlier), since this grd file was produced by an older GMT/netcdf combination and some homemade tool, but why would it bomb at 100?

is there a way to properly set the flags then? The program in question is in here

> <https://github.com/thwbecker/shansyn/blob/master/mygrdio.c>

and I am using no flags (this allows for GMT3 and 4 style output, but is now meant to be GMT5+)

Offending grd file is here [Dropbox - File Deleted - Simplify your life](https://www.dropbox.com/s/xso9lw4rtgh1mx7/tmp.grd?dl=0)

Thanks again!

> grdinfo tmp.grd  
> grdinfo [WARNING]: GMT\_COMPATIBILITY: Expects values from 6 to 6; reset to 6.  
> tmp.grd: Title:  
> tmp.grd: Command:  
> tmp.grd: Remark:  
> tmp.grd: Gridline node registration used [Cartesian grid]  
> tmp.grd: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7  
> tmp.grd: x\_min: 0 x\_max: 360 x\_inc: 0.15 name: x n\_columns: 2401  
> tmp.grd: y\_min: -90 y\_max: 90 y\_inc: 0.15 name: y n\_rows: 1201  
> tmp.grd: v\_min: -3.18232 v\_max: 2.56523 name: z  
> tmp.grd: scale\_factor: 1 add\_offset: 0  
> tmp.grd: format: netCDF-4 chunk\_size: 134,134 shuffle: on deflation\_level: 3  
> tmp.grd: Default CPT:

---

<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:** [May 30, 2022, 4:09pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-projection-bug/2968/4 "2022-05-30T16:09:27Z")

</div>

I think Paul nailed it down in [https://github.com/GenericMappingTools/gmt/pull/6761](https://github.com/GenericMappingTools/gmt/pull/6761)

---

<div class="post-metadata">

**Author:** ![thwbecker](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/thwbecker/32/1215_2.png) [@thwbecker](https://forum.generic-mapping-tools.org/u/thwbecker)\
**Post date:** [May 30, 2022, 5:16pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-projection-bug/2968/5 "2022-05-30T17:16:26Z")

</div>

Sorry, is this now in the master branch so that a simple git pull could get it for testing?

Also, how about this warning:

> grdinfo tmp.grd  
> grdinfo [WARNING]: GMT\_COMPATIBILITY: Expects values from 6 to 6; reset to 6.

Seems that I made the .grd file in the wrong way, and that grdinfo somehow does not know the right range (6 to 6?)

Thanks!

---

<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:** [May 30, 2022, 5:23pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-projection-bug/2968/6 "2022-05-30T17:23:31Z")

</div>

> [@thwbecker](#):
>
> Sorry, is this now in the master branch so that a simple git pull could get it for testing?

Not yet. It’s still a Pull Request that lives in the `duplicate-col-roundoff` branch. Only when Paul wakes up the Hawaiian chickens (but he’s relaxing these days) and merges it, will you be able to get it in master.

Don’t know about the warning message.

---

<div class="post-metadata">

**Author:** ![thwbecker](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/thwbecker/32/1215_2.png) [@thwbecker](https://forum.generic-mapping-tools.org/u/thwbecker)\
**Post date:** [May 30, 2022, 5:42pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-projection-bug/2968/7 "2022-05-30T17:42:35Z")

</div>

OK, thanks!

---

<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:** [May 30, 2022, 7:43pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-projection-bug/2968/8 "2022-05-30T19:43:06Z")

</div>

Did not hear the chickens and woke up late. Now in master.

---

<div class="post-metadata">

**Author:** ![thwbecker](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/thwbecker/32/1215_2.png) [@thwbecker](https://forum.generic-mapping-tools.org/u/thwbecker)\
**Post date:** [May 30, 2022, 8:06pm UTC](https://forum.generic-mapping-tools.org/t/grdimage-projection-bug/2968/9 "2022-05-30T20:06:42Z")

</div>

Working! Thanks!
