Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix vector doc to reflect scaletype #335

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dist/
dist/
vcs.egg-info/
*.swp
uvcdat-testdata/
16 changes: 16 additions & 0 deletions tests/test_vcs_lists.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import unittest
import vcs

class TestVCSList(unittest.TestCase):
def test_list_function(self):
types = vcs.listelements()

for typ in types:
if typ in ["display", "font", "fontNumber", "list"]:
continue
print("testing: ",typ)
ldict = locals()
exec("obj = vcs.create{}()".format(typ), globals(), ldict)
obj = ldict['obj']
obj.list()

40 changes: 29 additions & 11 deletions vcs/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,16 @@ class Gv(vcs.bestMatch):

.. code-block:: python

# Same as vc.line='solid'
vc.line=0
# Same as vc.line='dash'
vc.line=1
# Same as vc.line='dot'
vc.line=2
# Same as vc.line='dash-dot'
vc.line=3
# Same as vc.line='long-dot'
vc.line=4
# Same as vc.linetype='solid'
vc.linetype=0
# Same as vc.linetype='dash'
vc.linetype=1
# Same as vc.linetype='dot'
vc.linetype=2
# Same as vc.linetype='dash-dot'
vc.linetype=3
# Same as vc.linetype='long-dot'
vc.linetype=4

* Specify the line color of the vectors:

Expand All @@ -275,6 +275,24 @@ class Gv(vcs.bestMatch):
# Width range: 1 to 100, default size is 1
vc.linewidth=1

* Specify the vector scaling type

.. code-block:: python

# One of the following strings:
# off - No scaling is performed on the vector values
vc.scaletype = "off"
# constant - vector value * self.scale
vc.scaletype = "constant"
# normalize - vector value / max_norm
vc.scaletype = "normalize"
# constantNNormalize - vector value * self.scale / max_norm (default)
vc.scaletype = "constantNNormalize"
# linear - map [min_norm, max_norm] to self.scalerange
vc.scaletype = "linear"
# constantNLinear - map [min_norm, max_norm] to self.scalerange and then multiply by self.scale
vc.scaletype = "constantNLinear"

* Specify the vector scale factor:

.. code-block:: python
Expand Down Expand Up @@ -776,7 +794,7 @@ def list(self):
print("datawc_calendar = ", self.datawc_calendar)
print("xaxisconvert = ", self.xaxisconvert)
print("yaxisconvert = ", self.yaxisconvert)
print("line = ", self.line)
print("linetype = ", self.linetype)
print("linecolor = ", self.linecolor)
print("linewidth = ", self.linewidth)
print("scale = ", self.scale)
Expand Down