Skip to content

Allow plot/plot3d -SE, -SJ, -SW options to parse appended map units#6282

Merged
PaulWessel merged 10 commits intomasterfrom
map-units-symbols
Feb 2, 2022
Merged

Allow plot/plot3d -SE, -SJ, -SW options to parse appended map units#6282
PaulWessel merged 10 commits intomasterfrom
map-units-symbols

Conversation

@PaulWessel
Copy link
Member

See #6271 discussion and comments for background. This PR implements the recommended solution of specifying the map dimension unit as an option to embedding them in the data file.

For the symbols that accept dimensions in map units (geo-ellipse, rotated geo-rectangle, geo-wedge, including the degenerate versions of ellipse and rectangle), users can indicate the unit of the dimensional parameters (if read from file) rather than having to append the unit to the columns in the data file itself. E.g., -SEd means that the major and minor axes read from file will be in spherical degrees and not km. Same for -SE-, -SJ, -SJ-, and -SW (including optional +i for nonzero inner radius). I added two identical examples (for plot and plot3d) to show that it works. This behavior mirrors that of appending plot units c|i|p when users want to indicate what unit the nondimensional values read from the data table should be considered to have.

The implementation required minor changes to gmt_parse_symbol_option function to handle the lone map unit and to set the appropriate scaling needed in the modules to convert the dimensionless value to km. I also updated the documentation for -SE -SJ and -SW to discuss the use of such units.

In implementing this feature I became aware of several cut/paste bugs in psxyz.c that were also fixed:

  1. The parsing of -Sw|W modifiers would give annoying warning about unrecognized +i after having properly parsed it.
  2. psxyz had no checks to change column type from plot units to geo units when E,J,W rather than e,j.w were used (as psxy correctly does).
  3. psxyz's call to gmt_geo_wedge passed a few wrong parameters and when correct sometimes used the wrong data array index (n instead of i).
  4. psxyz needed to call gmt_xy_to_geo to recover the lon,lat from the projected x,y but passed y,y instead of x,y yielding a wildly wrong location.

No PostScript files added as these will go in dvc.

For the units that accept dimensions in map units (geo ellipse and rotated rectangle), users can indicate the unit of the data (if read from file) rather than having to append the unit to the columns in the data.  E.g., -SEd means that the major and minor axes read from file will be in spherical degrees and not km.
@PaulWessel PaulWessel added documentation Improve documentation enhancement Improving an existing feature labels Jan 31, 2022
@PaulWessel PaulWessel added this to the 6.4.0 milestone Jan 31, 2022
@PaulWessel PaulWessel requested a review from maxrjones January 31, 2022 02:02
@PaulWessel PaulWessel self-assigned this Jan 31, 2022
@maxrjones maxrjones added the add-changelog Add PR to the changelog label Jan 31, 2022
@maxrjones
Copy link
Member

-SE1000k does not seem to work anymore in this PR based on test/psxy/cmdargs.sh.

@PaulWessel
Copy link
Member Author

Thanks, will check shortly.

@PaulWessel
Copy link
Member Author

Should be fixed - give it a try.

@maxrjones
Copy link
Member

A bunch of tests now fail:

	375 - test/gmtspatial/nn.sh (Failed)
	380 - test/gmtvector/meanvec.sh (Failed)
	432 - test/grdcut/origin.sh (Failed)
	598 - test/mapproject/oblmerc_down.sh (Failed)
	599 - test/mapproject/oblmerc_up.sh (Failed)
	875 - test/psxy/ErrorEllipseGeo.sh (Failed)
	899 - test/psxy/clip_ellipse.sh (Failed)
	984 - test/psxy/rotrectangle.sh (Failed)
	1033 - test/psxyz/rotrectangle.sh (Failed)

Some are just image diff failures and others report 375: Assertion failed: ((fabs(A) > 5 * DBL_EPSILON) || (fabs(B) > 5 * DBL_EPSILON)), function doubleAlmostEqualUlps, file gmt_common_math.c, line 208.

@PaulWessel
Copy link
Member Author

OK, will check that after a break. I think I know why.

@PaulWessel
Copy link
Member Author

The assertions failures are now gone. I get this:

The following tests FAILED:
	326 - test/gmt_core/testsuite.sh (Failed)
	486 - test/grdimage/png_image.sh (Failed)
	579 - test/greenspline/gspline_5.sh (Failed)
	899 - test/psxy/clip_ellipse.sh (Failed)
	956 - test/psxy/map_units.sh (Failed)
	1029 - test/psxyz/map_units.sh (Failed)

the two map_units.sh are new tests so no PS comparisons yet.

@PaulWessel PaulWessel merged commit c29762d into master Feb 2, 2022
@PaulWessel PaulWessel deleted the map-units-symbols branch February 2, 2022 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog documentation Improve documentation enhancement Improving an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants