Hi,all
I have a cartesian grid and want to plot it using the grdimage. I set the -fc
to indicate it is a cartesian file. But some error still appears. I am not sure the reason. Is it a wrong use of GMT syntax?
#!/usr/bin/env bash
ps3=test.ps
J=JX6c
gmt grd2cpt jizailow.nc > mss.cpt
gmt psbasemap -Rjizailow.nc -$J -BWNSE -Bxya100 -K -fc > $ps3
gmt grdimage jizailow.nc -$J -Cmss.cpt -K -O -fc >> $ps3
Message:
psbasemap [ERROR]: Internal Error = GMT_MAP_EXCEEDS_360
psbasemap [ERROR]: Internal Error = i
psbasemap (GMT_psbasemap): Map region exceeds 360 degrees
grdimage [ERROR]: Internal Error = GMT_MAP_EXCEEDS_360
grdimage [ERROR]: Internal Error = i
grdimage (GMT_grdimage): Map region exceeds 360 degrees
Here is the file .
I use the GMT6.1.0 at MINGW64.
Joaquim
February 19, 2020, 3:56pm
2
OK, the problem probably related to this
$ gmt grdinfo jizailow.nc
jizailow.nc: Title: z
jizailow.nc: Command: grdsample jizai.nc -I30 -Gjizailow.nc
jizailow.nc: Remark:
jizailow.nc: Gridline node registration used [Cartesian grid]
jizailow.nc: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
jizailow.nc: x_min: 0 x_max: 348 x_inc: 29 name: x n_columns: 13
jizailow.nc: y_min: 0 y_max: 148.8 y_inc: 29.9707317073 name: longitude n_rows: 42
the Y units say it’s longitude and X is not latitude. So it likely something inside GMT gets confused.
A work around is to convert it into another grid format. For example this worked for me
gmt grdconvert jizailow.nc jizailow.grd=sf
Joaquim
February 19, 2020, 4:21pm
3
Ah, but your x_max , y_max or increment are all wrong. It says
y_min: 0 y_max: 148.8 y_inc: 29.9707317073 name: longitude n_rows: 42
but 29.9707317073 * 42 = 1258.77
which is off course > 360
Thanks.
That is the point. The nc file has it problem.
I will check the nc creating code.
After I change the name of Y not to be Longitude. It works with GMT. So, it is better not use these geographic names in cartesian grid file.