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

Patterns & Hatches on Boxfill, Isofill #1577

Closed
chaosphere2112 opened this issue Sep 30, 2015 · 14 comments
Closed

Patterns & Hatches on Boxfill, Isofill #1577

chaosphere2112 opened this issue Sep 30, 2015 · 14 comments
Assignees
Milestone

Comments

@chaosphere2112
Copy link
Contributor

Looks like patterns and hatches work correctly for fillareas and isofill plots, but not for boxfill.

import vcs, cdms2

x = vcs.init()

f = cdms2.open(vcs.sample_data + "/clt.nc")
s = f("clt")

box = x.createboxfill()
box.fillareastyle = "hatch"
box.fillareacolors = [20, 50, 75]
box.fillareaindices = [5, 10, 15]
box.levels = [10, 50, 75, 100]
box.boxfill_type = "custom"

x.plot(s, box)
x.png("hatch_box.png")

isofill = x.createisofill()
isofill.fillareastyle = "hatch"
isofill.fillareacolors = [20, 50, 75]
isofill.fillareaindices = [5, 10, 15]
isofill.levels = [10, 50, 75, 100]

x.clear()

x.plot(s, isofill)
x.png("hatch_isofill")

Produces these two:
hatch_box
hatch_isofill

import vcs, cdms2

x = vcs.init()

f = cdms2.open(vcs.sample_data + "/clt.nc")
s = f("clt")

box = x.createboxfill()
box.fillareastyle = "pattern"
box.fillareacolors = [20, 50, 75]
box.fillareaindices = [5, 10, 15]
box.levels = [10, 50, 75, 100]
box.boxfill_type = "custom"

x.plot(s, box)
x.png("pattern_box.png")

isofill = x.createisofill()
isofill.fillareastyle = "pattern"
isofill.fillareacolors = [20, 50, 75]
isofill.fillareaindices = [5, 10, 15]
isofill.levels = [10, 50, 75, 100]

x.clear()

x.plot(s, isofill)
x.png("pattern_isofill")

Produces these two:
pattern_box
pattern_isofill

In addition, the performance of plotting the patterns/hatches for the isofill is pretty slow:

import datetime, vcs, cdms2

x = vcs.init()
f = cdms2.open(vcs.sample_data + '/clt.nc')
s = f('clt')

def t():
   return datetime.datetime.now()

isofill = x.createisofill()
isofill.fillareaindices = [1, 5, 10]
isofill.fillareacolors = [50, 100, 150]
isofill.levels = [0, 25, 75, 100]

for style in ("hatch", "pattern", "solid"):
   isofill.fillareastyle = style
   before = t()
   x.plot(s, isofill)
   after = t()
   print after - before

gives us these times:
0:00:03.027187 (hatch)
0:00:03.077247 (pattern)
0:00:00.559602 (solid)

So, that's some pretty serious overhead.

@aashish24
Copy link
Contributor

@chaosphere2112 the performance will be slow because we need to add lot more steps for the pattern but its worth investigating more post 2.4

@sankhesh
Copy link
Contributor

@aashish24 is right. The time performance is slow because of the whole set of tasks involved. It can be improved by reducing the size of the texture created per fill area. Currently, the size is 4 times the bounds of the polydata. However, reducing the size would reduce resolution of the patterns/hatches.

@aashish24
Copy link
Contributor

@chaosphere2112 is this really critical? If yes, then @sankhesh let's reduce the size for now and we can think about a better solution for 3.0.

@chaosphere2112
Copy link
Contributor Author

@sankhesh @aashish24 Well, the critical part is the first half of the bug report (where boxfill isn't getting patterns and hatches). Performance isn't super critical; I just tested it in the GUI, and it actually goes quite a bit faster than I was experiencing in the command line, so that's weird.

@aashish24
Copy link
Contributor

thanks @chaosphere2112 that sounds reasonable. Roger that. That is weird.. may be try again?

@chaosphere2112
Copy link
Contributor Author

@aashish24 @sankhesh Looks like specific patterns/hatches are the problem, not all of them.

Pattern Number Pattern Time Hatch Time
1 0:00:00.487568 0:00:00.414466
2 0:00:00.288609 0:00:00.295397
3 0:00:00.268531 0:00:00.402500
4 0:00:00.273018 0:00:00.271401
5 0:00:00.270258 0:00:00.271995
6 0:00:00.268783 0:00:00.271023
7 0:00:00.269698 0:00:00.279364
8 0:00:00.275035 0:00:00.288632
9 0:00:42.809225 0:00:42.989813
10 0:00:03.376930 0:00:03.116200
11 0:00:03.138273 0:00:03.060134
12 0:00:03.127413 0:00:03.048566
13 0:00:03.072687 0:00:03.132620
14 0:00:00.278787 0:00:00.271428
15 0:00:00.272481 0:00:00.278344
16 0:00:00.282526 0:00:00.280305
17 0:00:00.371303 0:00:00.366816
18 0:00:00.299080 0:00:00.298072

@aashish24
Copy link
Contributor

Great.. this is very useful finding! thanks.

@sankhesh
Copy link
Contributor

Ahh.. Thanks for sharing @chaosphere2112
I can look at why pattern number 9 generation takes so much time.

@chaosphere2112
Copy link
Contributor Author

That's certainly the most urgent, yeah. If you could get 10-13 to be faster as well, that'd be cool.

@sankhesh
Copy link
Contributor

For reference, here are all the patterns/hatches:
Patterns/hatches in UV-CDAT.

sankhesh added a commit that referenced this issue Oct 1, 2015
@sankhesh
Copy link
Contributor

sankhesh commented Oct 4, 2015

Update:

Custom boxfill plot:
boxfill_patterns

Should non-custom boxfill plots also support patterns/hatches?

@chaosphere2112
Copy link
Contributor Author

@sankhesh Nope, just the custom ones.

sankhesh added a commit that referenced this issue Oct 5, 2015
Do not pass patterning arguments to legend fillarea when using
non-custom boxfill types.
Fixes #1577
@doutriaux1
Copy link
Contributor

@sankhesh non-custom never did support it because they do not use the filler attributes. I don't think we need to revise this. But now that I think of it we probably should update the attribute setting method to check if the type is custom and raise a warning if we set any of these.

@sankhesh
Copy link
Contributor

sankhesh commented Oct 5, 2015

Thanks @doutriaux1 @chaosphere2112

Created #1582 for boxfill patterns/hatches support.

Timing improvements to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants