Feature #1083

Add -W (of psscale) to X, Y, Z axis annotations.

Added by Federico 9 months ago. Updated 3 months ago.

Status:ClosedStart date:2017-04-23
Priority:LowDue date:
Assignee:-% Done:


Target version:-


In some cases it would be good to apply a factor to the values of the annotations of the X, Y and Z axis (similar as -W of psscale to the z-values in the CPT).
For example, this would allow to change the annotations from m to km (as in the examples 8 and 33 of the gallery) or vice versa (as in examples 4 and 49), without having to previously multiplied all the values (with gmtmath or grdmath). I hope I was clear.

EJ16.1_Bloque3D_Mask.png - Plot (874 KB) Federico, 2017-04-23 17:32

EJ16.1_Bloque3D_Mask.png - Desired Plot (873 KB) Federico, 2017-04-24 11:37


#1 Updated by Paul 9 months ago

  • Status changed from New to Feedback

Are you aware of http://gmt.soest.hawaii.edu/doc/5.3.3/GMT_Docs.html#modifiers-for-changing-units-of-grid-coordinates? You can also scale grids upon reading them via the scale/offset settings.

#2 Updated by Federico 9 months ago

No, sorry. I wasn't aware.

How precisely could do that? For example, I make this plot from the geographic grid CUT with this commands (in Windows GMT 5.3.3 r17743 64-bit):
And I want the Z-axis values in km. I could use grdmath to divide the grid, but I would have to change the values for CPT. I try +Uk (as in the example 28) but it is applied to XY values (if I did it right).

gmt makecpt -Cdem4 -T0/7000/250 -Z > color
gmt grdgradient CUT -A160 -G%SHADOW% -Ne0.5
gmt grdview CUT -R -J -JZ -O -K -p -Qi300 -C%color% -I%SHADOW% >> OUT -N0+glightgray -Wf0.5 -BnSwEZ+b -Baf -Bzaf+l"Altura (m)"

#3 Updated by Paul 9 months ago

Depends on what the file CUT is (seems to have no file extension). If it is a netCDF grid with 32-bit floats then giving the filename as CUT=nf/0.001 should scale the data by 0.001 upon read.

#4 Updated by Federico 9 months ago

The CUT format is correct.

I add "nf/0.001" to my script but I have to modified to the zmin/zmax from -R and the values of CPT to obtain the plot that I wanted. I think that with the new feature I proposed, will simplify this process. I think that in Linux it is possible to automatized the z values of R and CPT. Are there in Windows?

Previous Commands:
gmt makecpt -Cdem4 -T0/*7000/250* -Z > color
gmt psxy -R%REGION3D% -J%PROJ% -JZ%PROZ% -p%persp% -T -K -P > OUT
gmt grdview CUT -R -J -JZ -O -K -p -Qi300 -C%color% -I%SHADOW% >> OUT -N0+glightgray -Wf0.5 -BnSwEZ+b -Baf -Bzaf+l"Altura (m)"

Modified Commands:
gmt makecpt -Cdem4 -T0/*7.000/0.250* -Z > color
gmt grdview CUT=nf*/0.001* -R -J -JZ -O -K -p -Qi300 -C%color% -I%SHADOW% >> OUT -N0+glightgray -Wf0.5 -BnSwEZ+b -Baf -Bzaf+l"Altura (m)"

(If you prefer I continue in the forum, please let me know.)

#5 Updated by Paul 9 months ago

Just so I understand how you are thinking: You expect to give -R, -J, -B values given in meters but via some option you want these to be changed internally to km. Or, you may give all these in km and then have the options change this internally to meters? How is this really different from specify -R, -J , -B in the units you want and then use the grid scaling to ensure the grid is in the same units? We do not add new options when there are perfectly valid schemes already there. So I don't see much benefit here. As for automation: As long as you are using the WIndows command window you will have no access to basic things offered by a shell, such as ability to capture program output into variables. Under Windows 10 I would recommend installing the bash for Ubuntu under Windows (google it) and then you can assign variables such as the range of data files and use them in subsequent commands.

#6 Updated by Paul 3 months ago

  • Status changed from Feedback to Closed

Closing this issue for lack of interest from the developers.

Also available in: Atom PDF