I have a seemingly well behaved netcdf file
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:
grdimage -fg -Rg -JH100/7 tmp.grd -P -Ctmp.cpt > tmp.ps
shifting the reference longitude > 100, core dump:
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]
Does this works for you (it does for me)?
grdimage -fg -Rg -JN101/7 @earth_relief_20m -png lixo
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
#include "shsyn.h"
//
// grd output part used by shsyn
//
// $Id: mygrdio.c,v 1.4 2009/04/16 00:55:29 becker Exp becker $
//
void grid_output(int out_mode,char *grdfilename,
GMT_PRECISION *gmtval,
int nlon,int nlat,
COMP_PRECISION xmin,
COMP_PRECISION xmax,
COMP_PRECISION ymin,
COMP_PRECISION ymax,
COMP_PRECISION dx,COMP_PRECISION dy,
int argc,char **argv,
int lmax,BOOLEAN verbose, void **API)
{
switch(out_mode){
case ONE_GRD:{
This file has been truncated. show original
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
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:
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!
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.
Did not hear the chickens and woke up late. Now in master.