On gmt v. 6.2.0_bb0b2d9_2020.12.14 with macOS Big Sur
Hi,
I’m trying to plot a time-series with two set of annotations for the y-axis using daily data.
The primary axis is supposed to :
not annotate
tick every months
add a gridline every months
The secondary axis is supposed to :
annotate every year
tick every year
add a gridline every year
I hoped to have a thicker line for the secondary grid lines, but if it’s too complicated, I can also not use it as it is redundant with the primary ones (once per year).
The annotations are fine, the ticks seem to be too … but the grid lines are either shifted and inconsistently spaced or plotted daily (or so it seems).
Do you have a suggestion ?
See picture :
On left : -Bpyf1o -Bsya1Y
On right : -Byf1og12y
I didn’t expect that grdimage will do something different, but I didn’t have any file here to try.
Is it possible to share some simple data to test it?
using gmt 6.2.0_68e0098_2021.01.19
Sure …
Sorry for the delay … I had to extract a sample and upload it on a tiers service :
The data are Sea-Surface Temperature averaged in the Pacific equatorial band (so it has the dimension of longitude x time)
lon1 = 110
lonN = 280
time1 = 1980-01-01
timeN = 1984-01-01 (I think , I truncated it bluntly)
$ gmt grdinfo sample_data.nc
grdinfo [WARNING]: TIME_EPOCH format is invalid. Default assumed.
grdinfo [WARNING]: A correct format has the form [-]yyyy-mm-ddThh:mm:ss[.xxx]
grdinfo [WARNING]: or (using ISO weekly calendar) yyyy-Www-dThh:mm:ss[.xxx]
grdinfo [WARNING]: An example of a correct format is: 2000-01-01T12:00:00
grdinfo [WARNING]: Time units [days since 0000-01-00 00:00:00.0 +0000]] in grid not recognized, defaulting to gmt.conf settings.
sample_data.nc: Title:
sample_data.nc: Command:
sample_data.nc: Remark:
sample_data.nc: Gridline node registration used [Cartesian grid]
sample_data.nc: Grid file format: nf = GMT netCDF format (32-bit float), CF-1.7
sample_data.nc: x_min: 110 x_max: -80 x_inc: 0.25 name: longitude n_columns: 681
sample_data.nc: y_min: 0 y_max: 126144000 y_inc: 86400 name: time [days since 0000-01-00 00:00:00.0 +0000] n_rows: 1461
sample_data.nc: v_min: 0 v_max: 0 name: eqb_nc_sst
sample_data.nc: scale_factor: 1 add_offset: 0
sample_data.nc: format: classic
I try to convert to xyz and back to grid to set the TIME_EPOCH, but I get only NaN for the Z value:
Any g addition to either Bpy or Bsy fill the plot with gridlines every day (unit) instead of wanted O or Y.
Could it be related to the issue I reported with mathon Github ?
here I didn’t have ploblems do add g to either Bpy or Bsy, as I showed before.
I think I get your example right here:
$ gmt math -o0 -T1980-01-01T/2019-12-31T/4y T =
1980-01-01T00:00:00.000000000
1984-01-01T00:00:00.000000000
1988-01-01T00:00:00.000000000
1992-01-01T00:00:00.000000000
1996-01-01T00:00:00.000000000
2000-01-01T00:00:00.000000000
2004-01-01T00:00:00.000000000
2008-01-01T00:00:00.000000000
2012-01-01T00:00:00.000000000
2016-01-01T00:00:00.000000000
could you share your defaults?
gmt defaults > defaults.txt
What I have here is: defaults.txt (5.1 KB)
Note that I used “T” in -JX10c/10cT to specify a time axes and appears that you used “t”. Could it be the problem? What exactly is your -JX${w1}cd/-${height}ct ?
I think you’re probably using different OS’s. When I build 6.2.0_68e0098_2021.01.19 on MacOS gmt math -o0 -T1980-01-01T/2019-12-31T/4y T = does not work and gives the same bug as reported recently on GitHub.
With -J[...]ct (and timestamps given relative to TIME_EPOCH) everything works except for -Byg[..] (no problem with x). The gridlines are systematically plotted at “unit”.
With -J[...]cT (and timestamps given in absolute format) everything works.
from https://docs.generic-mapping-tools.org/latest/gmt.html#r-full
For calendar time coordinates you may either give (a) relative time (relative to the selected TIME_EPOCH and in the selected TIME_UNIT; append t to -JX|x)
Then I think that
-R110/280/373420800/381369600 -JX10cd/10ct --TIME_UNIT=s --TIME_EPOCH=1970-01-01T00:00:00
should have worked.
-R is given with absolute time regardless.
Both grdimage and plot are displayed as expected, except for the grid lines on y-Primary and y-Secondary axis. They are too dense and completely fill the picture (TIME_UNIT probably switched in seconds)
Apart from the grid line, everything is correct. (NB x-axis grid lines are fine too)
Case 2 : same
-R is given with relative time.
It makes no difference compared to Case 1, so I’d rather stick to the Case 1 as the input format doesn’t require additional calculation.