Shifted tiles ? annotations (-B [t]stride[phase])?

Hi,

I’m trying to create a heatmap -ish plot (so far my result using grdimage):

To plot this, I have a netCDF file containing a 2D matrix [x,y,freq] with :
x = beginning of a bin which spans 10 degrees
y = month number
freq = the frequency within the box (for example 6% between 75-85º in March)

The thing is, the tiles on the plot are shifted by 5 degrees to the west… e.g. the first tile [45-50] which is supposed to be [45-55] but is [40-50] instead, thus is truncated.

Is there a way to correct that (maybe I’m not using the proper module)?

grdimage -R45/95/0/10 file.nc?mat -Chot.cpt -Q -Byclabel.txt -Bxa10f10g10

Section 4.22 here on grid registration might be helpful to you:

One easy solution would be to create your netCDF file with the x data representing the average temperature in the bin.

Yes, your grid is wrongly created. It should be a pixel grid going from 45/95/10.

Thanks @maxrjones and @pwessel
So I have to add a line like :

grdedit file.nc?mat -T

and that’s it ? Or I need to specify an output ?

Give -Gnew.nc so you can see what is created. Hard for me to tell since your file is probably not COARDS compliant if you just wrote it in MATLAB. Better to fix your matlab script to make a proper grid output, but see if -T works for you.

Well,

It indeed shifted … the y-axis instead of the x :laughing:

Ok. I’ve modified the matlab script and together with GRDEDIT -T I got a proper tiling.

How do I use the shift-phase option for the annotation ? (-Bg[phase] …) ?

I think just apped +phase to your annotation or grid specification, e.g., -B10+5

Perfect, Thank you.

(IMO the documentation regarding that is not very clear [t]stride[phase][unit]

Thanks, I now stress that the sign of the phase is required.