You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the desired feature
I use grdvector function to plot the wind field, I adjusted -Q and -Si parameters repeatedly, but I couldn't get satisfactory results.
Here is my final code (turn parameters again and again) and output figure,
And I did the same thing with NCL (NCAR Command Language), which is a very commonly used software in atmospheric science research. And here's what NCL output,
By comparing the two plots, it can be found that GMT still has some limitations in drawing wind fields, the main limitations are as follows:
Wind direction is not easily discernible in the weak wind speed zone, so you can't see the circulation pattern very well.
There is no feature for automatically generating the legend of the reference vector.
Are you willing to help implement and maintain this feature? Yes
In my opinion, when the wind speed is very small, the stem may disappear, but there should be a certain lower limit for the reduction of the arrow, and the overall shape of the arrow should not be destroyed, so that the wind direction of each grid point can be clearly identified, which is very important in circulation analysis. In the research of meteorology, we pay attention not only to the value of the wind speed but also to the wind direction. Therefore, would you consider adding the features I mentioned above? Thanks in advance.
Maybe I am not good at using grdvector, so I have uploaded the data, welcome you to test and turning. data_uv.zip
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. We appreciate that you took the time to contribute!
Thanks for this example and the comparison. Having +n be subjected to a minimum shrinking is a good idea that can be implemented. I will play with your data example to see how we can improve the plot. And adding -l for auto-legend is on my mental agenda anyway.
So it looks like the vector head never shrinks in the NCL plot but you could do the same in GMT, no (not using +n)? Aren't you comparing apples and oranges a bit here? Anyway, some possibilities would be to add an optional minimum length to +n so syntax would be +nstart[/stop], so shrinking will begin for vectors shorter than start but only down to stop [0].
If you want open vector heads like the NCL then you use +eA to change what head you want. So although I have not tried yet, seems like you could make a map very similar to the NCL with GMT if you just select no shrinking and pick the plain vector head.
Yes you are right, there are clear differences but where we go to zero they stop shrinking. I agree going to zero makes it impossible to see directions (you just get a point if you are lucky), so we can consider improvements here.
Maybe the syntax could be +nnorm[/frac] where default frac = 0 but if given indicates how much smaller than the given vector head size we shall shrink. E.g., a frac of 0.5 means just shrink down to half the size and no further.
I would even prefer that default frac would be something that still allowed seeing the vector head. This would be a small breaking but we can always call the trick of saying previous behavior was a bug.
After fixing the plain geovector and the minimum shrink value, I get stuff like this which is approximating what the NCL does if you prefer such vectors.
Hopefully, @leeyupeng119 can play with the revised vector head via +eA and the terminal shrink threshold via +n1k/0.7 (I used 0.7 in the above plot) and give more feedback.
I've downloaded the code of master brunch and compiled it. It works very well for values of the new parameter from 0.7 to 0.9 with the +eA option. But when there is no A, some vector in the weak wind area is a bit strange. The stems ran to the front of the arrows instead of the tail.
Here is the code and a screenshot of strange zones.
gmt begin wind2_gmt pdf
gmt coast -JM5i -R75/140/15/55 -Baf -A4000 -W0.25p,black
gmt grdvector u.nc v.nc -Ix5 -Q4p+e+n1k/.9 -Gblack -W0.5p -Si20k
gmt end
And adding -l for auto-legend is on my mental agenda
Do you plan on adding an option to define at which latitude the legend takes reference from? Or simply in the middle of the plot ? (I'm more comfortable with the latter)
Most importantly, will the scaling be applied accordingly from an user-defined value or from a mean ? (I'm more comfortable with the former)
Activity
welcome commentedon Dec 11, 2021
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. We appreciate that you took the time to contribute!
Please make sure you read our Contributing Guide and abide by our Code of Conduct.
PaulWessel commentedon Dec 11, 2021
Thanks for this example and the comparison. Having +n be subjected to a minimum shrinking is a good idea that can be implemented. I will play with your data example to see how we can improve the plot. And adding -l for auto-legend is on my mental agenda anyway.
PaulWessel commentedon Dec 11, 2021
So it looks like the vector head never shrinks in the NCL plot but you could do the same in GMT, no (not using +n)? Aren't you comparing apples and oranges a bit here? Anyway, some possibilities would be to add an optional minimum length to +n so syntax would be +nstart[/stop], so shrinking will begin for vectors shorter than start but only down to stop [0].
If you want open vector heads like the NCL then you use +eA to change what head you want. So although I have not tried yet, seems like you could make a map very similar to the NCL with GMT if you just select no shrinking and pick the plain vector head.
joa-quim commentedon Dec 11, 2021
NCL vector heads also shrink, but apparently not more then 3 to 4 times.
PaulWessel commentedon Dec 12, 2021
Yes you are right, there are clear differences but where we go to zero they stop shrinking. I agree going to zero makes it impossible to see directions (you just get a point if you are lucky), so we can consider improvements here.
PaulWessel commentedon Dec 12, 2021
Maybe the syntax could be +nnorm[/frac] where default frac = 0 but if given indicates how much smaller than the given vector head size we shall shrink. E.g., a frac of 0.5 means just shrink down to half the size and no further.
joa-quim commentedon Dec 12, 2021
I would even prefer that default frac would be something that still allowed seeing the vector head. This would be a small breaking but we can always call the trick of saying previous behavior was a bug.
PaulWessel commentedon Dec 12, 2021
We can discuss that. I am opening a WIP branch PR that implements the /frac and have an example with some issues to comment on.
PaulWessel commentedon Dec 13, 2021
After fixing the plain geovector and the minimum shrink value, I get stuff like this which is approximating what the NCL does if you prefer such vectors.
PaulWessel commentedon Dec 13, 2021
Hopefully, @leeyupeng119 can play with the revised vector head via +eA and the terminal shrink threshold via +n1k/0.7 (I used 0.7 in the above plot) and give more feedback.
leeyupeng119 commentedon Dec 14, 2021
@PaulWessel, It looks awesome and I think this would work well for my needs. Thank you all.
leeyupeng119 commentedon Dec 14, 2021
I've downloaded the code of master brunch and compiled it. It works very well for values of the new parameter from 0.7 to 0.9 with the +eA option. But when there is no A, some vector in the weak wind area is a bit strange. The stems ran to the front of the arrows instead of the tail.
Here is the code and a screenshot of strange zones.
PaulWessel commentedon Dec 14, 2021
Thanks, I noticed that too. Will have a look.
gd-a commentedon Dec 14, 2021
Do you plan on adding an option to define at which latitude the legend takes reference from? Or simply in the middle of the plot ? (I'm more comfortable with the latter)
Most importantly, will the scaling be applied accordingly from an user-defined value or from a mean ? (I'm more comfortable with the former)
Thanks @PaulWessel !
Failed to actually set shrunk pen when +n is in effect for arrows
The vector head pen did not shrink when +n was used (#6139)
Address a series of issues related to vectors
Address a series of issues related to vectors (#6161)
maxrjones commentedon Dec 28, 2021
Final issues were fixed by #6161. @leeyupeng119, please comment if you notice any other issues.