Skip to content

Conversation

@PaulWessel
Copy link
Member

See #6190 for background. This PR addresses the sub-tasks 1 , 2 and 6 (last task 5 will be handled after this PR is merged):

(Task 1): Offer a way, like +zscale, to accept polar form direction, length input, with length in data units to be scaled to plot units. I chose +vscale for "scale vector data length to plot length". Append a unit from c|i|p to indicate the unit of the product.
(Task 2): Allow the shrinking limit to be given in data units or plot units. Follow the lead of plot -Sb and use unit q to indicate data units (since no unit would mean cm and hence a plot unit for Cartesian vectors and km as map unit for geovectors).
(Task 6): Ensure that any use of vector modifiers that cannot apply in a particular module result in errors.

Along the way, a few other things had to happen:

  1. I selected q (for user quantity) to use as a unit signifying the user's data unit. We used u in plot -Sb, -So, and -Su but these have now been changed to q as well (backwards compatible of course). This prevents the conflict with unit u (survey foot).
  2. Both +v and +z can take unit q as well to indicate that input data are given in user quantities and the scale results in either plot units (Cartesian vector) or map units (geovector).
  3. New vector attribute modifier +c was introduced to let us use the data magnitude instead of a separate input column with -C to look up vector head colors.
  4. Fixed a bug for plotting vectors with fill and pen color taken from a CPT. The bug prevented the head outline pen from being changed. We had no such test example so no failure, but I found this when plotting the top two rows.
  5. Documentation updates and clarifications.

Here is one of two new tests (for psxy, the psxyz is identical since I did not use any perspective view point):

vector2d_mods

This test (psxy/vector2_mods.sh) plots a bunch of 1 inch = 2.54 cm vectors (left) or 100 km geovectors (right) but it does so using a wide range of input, units and vector attributes; these are plotted as text. Top two row use the new +c modifier with a CPT and -W+c modifications. Left column is Cartesian, right column are geovectors. View them from the bottom to the top to see what is going on with the input. We test combination of unit-less and unit input points, vector components in plot or map units, and magnitudes and components in quantity units (q) scaled to suitable plot and map lengths. Note result for left side y = 3: Input length is given as 1i (with unit) so specifying PROJ_LENGHT_UNIT as cm has no effect since the data unit takes precedence. We experiment with the new +v and the improved +z modifier.

@PaulWessel PaulWessel added documentation Improve documentation enhancement Improving an existing feature labels Jan 7, 2022
@PaulWessel PaulWessel added this to the 6.4.0 milestone Jan 7, 2022
@PaulWessel PaulWessel requested a review from joa-quim January 7, 2022 07:44
@PaulWessel PaulWessel self-assigned this Jan 7, 2022
Co-authored-by: Meghan Jones <meghanj@alum.mit.edu>
Co-authored-by: Meghan Jones <meghanj@alum.mit.edu>
@PaulWessel PaulWessel merged commit d3025e3 into master Jan 7, 2022
@PaulWessel PaulWessel deleted the vector_scale_shrink branch January 7, 2022 20:55
@maxrjones maxrjones added the add-changelog Add PR to the changelog label Jan 25, 2022
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.

3 participants