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

2072 export patterns as vectors #23

Merged
merged 32 commits into from
Feb 24, 2017

Conversation

sankhesh
Copy link
Contributor

@sankhesh
Copy link
Contributor Author

@doutriaux1
Copy link
Contributor

thanks @sankhesh. reviewing now.

@sankhesh
Copy link
Contributor Author

Thanks @doutriaux1. I'm working on fixing the tests too.

@doutriaux1
Copy link
Contributor

@sankhesh

import vcs,cdms2
f=cdms2.open(vcs.sample_data+"/clt.nc")
s=f("clt")
x=vcs.init()
gm = x.createboxfill()
gm.fillareastyle
gm.fillareastyle = "hatch"
gm.fillareaindices = [ 1,2,3,4,5]
gm.boxfill_type="custom"
x.plot(s,gm)

gives:
bad

preceded with thousands of:

ERROR: In /export/doutriaux1/anaconda2/conda-bld/work/Common/DataModel/vtkImplicitDataSet.cxx, line 64
vtkImplicitDataSet (0x3fd2eb0): Can't evaluate function: either data set is missing or data set has no point data

ERROR: In /export/doutriaux1/anaconda2/conda-bld/work/Common/DataModel/vtkImplicitDataSet.cxx, line 64
vtkImplicitDataSet (0x3fd2eb0): Can't evaluate function: either data set is missing or data set has no point data

@doutriaux1
Copy link
Contributor

isofill works, but @bonfils2 needs boxfill

@sankhesh
Copy link
Contributor Author

@doutriaux1 Looking into it now.

@doutriaux1
Copy link
Contributor

doutriaux1 commented Oct 14, 2016

@sankhesh there are still some weirdness, plotting an isoline on top of the isofill heps see what a happens at the intersection, the following is a screenshot of of pdf zoomed into a chrome window.

Notice the green horizontal lines around 40N latitude, why are they all chopped up? Like ants ate part of them.

iso isoline

@sankhesh
Copy link
Contributor Author

@doutriaux1 The clipping algorithm seems not so perfect. @aashish24 and I spoke a little about these issues and I'll look into it in the next iteration. Let me fix boxfill plot issues first.

@sankhesh
Copy link
Contributor Author

After latest set of changes, hatches/patterns work for boxfill plots. See example file.

test_fillarea.pdf

screenshot from 2016-10-14 14-46-44

@sankhesh
Copy link
Contributor Author

@doutriaux1 I fixed the test baselines as well. Can we merge this branch so that @bonfils2 can use this code? It works fine for boxfill patterns and hatches.

Regarding clipping issues with isofill plots, Will is working on a filter that would provide the accuracy we need. Once that is ready I can incorporate it in our workflow.

@doutriaux1
Copy link
Contributor

@sankhesh I will install your branch locally

@doutriaux1
Copy link
Contributor

I'd rather wait for your clipping fixes

@sankhesh
Copy link
Contributor Author

A-ok

@doutriaux1
Copy link
Contributor

@sankhesh it's looking much better, please consider the following scrit:

import cdms2,vcs,MV2,os
f=cdms2.open(os.path.join(vcs.sample_data,"clt.nc")
s=f("clt")
iso = vcs.createboxfill()
box = vcs.createboxfill()
mask = MV2.greater(s,75)
x=vcs.init(geometry=(1200,800))
box.boxfill_type = "custom"
box.fillareastyle = "hatch"
box.fillareaindices = [10,]
box.levels=[0.5,1.5]
box.fillareacolors = ["black"]
x.plot(s,iso)
x.plot(mask.astype("f"),box)
x.svg("celine_pattern")
x.postscript("celine")
raw_input("Press enteR")

clipping is not quite matching the boxfill area
pdf is ok svg as well but postscript files are not respecting the transparency it shows up as white.
celine.ps.zip

@doutriaux1
Copy link
Contributor

Actually pdf from RH6 opened on Mac give us:
with no patterns in it.

AL1Fa_map11a_hfls_F_JFM_4off.pdf

An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem.

@durack1
Copy link
Member

durack1 commented Oct 27, 2016

@doutriaux1 interestingly that file opens in Preview on OS X 10.11.6..

@sankhesh
Copy link
Contributor Author

@doutriaux1 Based on this it seems like postscript does not support transparency. Was it supported earlier?

@doutriaux1
Copy link
Contributor

@sankhesh all output should be the same. I'm not sure what it was doing earlier because nobdy used it really. Anyhow I'm attaching a trimmed down version of @bonfils2 script to help you. Notice that setting the color to "red" or [100,0,0,50] does not appear to affect pdf output at all (are we ignoring opacity in favor of fillareaopacity attribute?) Also different pattern seem to have different thickness and slightly different clipping.
Thanks
patterns.zip

@doutriaux1
Copy link
Contributor

@durack1 yes opens for me too, but I think @bonfils2 has adobe reader installed.

@sankhesh
Copy link
Contributor Author

Thanks for the pared down script @doutriaux1 👍
I'll take a look.

@doutriaux1
Copy link
Contributor

@sankhesh there's definitely clipping issues left, look at the band for pattern 9 they should stop exactly at the limit of the box, but they're not, they look like they have been trimmed to some sort of interpolation line.

@sankhesh
Copy link
Contributor Author

Goes with VTK branch @ https://gitlab.kitware.com/vtk/vtk/merge_requests/2084

@doutriaux1
Copy link
Contributor

@aashish24 @sankhesh I'm buulding against @aashish24 branch, do I need to first merge them both together?

@sankhesh sankhesh force-pushed the 2072_export_patterns_as_vectors branch from 15e9f14 to 77d5fff Compare November 22, 2016 19:25
@aashish24
Copy link
Contributor

@doutriaux1 I have updated my VTK branch with https://gitlab.kitware.com/vtk/vtk/merge_requests/2084

@aashish24
Copy link
Contributor

@sankhesh can you post your update here so that we all know what's the current status is?

@sankhesh
Copy link
Contributor Author

I've attached a pdf output of the latest code.
test_fillarea (1).pdf

Almost all clipping issues have been resolved barring one. The current issue we're looking into is specific to the pattern in the image below:

selection_004 1

You can see that the inner regions of the pattern somehow become distorted.

@williams13
Copy link
Contributor

williams13 commented Dec 14, 2016 via email

@doutriaux1
Copy link
Contributor

@sankhesh this whole spacing/scale thing is quite mysterious to new users, do you think we could have a wiki page (or even better a jupyter notebook) that explains how all of this works? Thanks.

@aashish24
Copy link
Contributor

@sankhesh this whole spacing/scale thing is quite mysterious to new users, do you think we could have a wiki page (or even better a jupyter notebook) that explains how all of this works? Thanks.

+1

Also, @sankhesh and I talked about come up with reasonable default based on the viewport size of each plot. So by default users should be something very close to ideal and then the API can provide an option to tweak them if necessary.

@sankhesh
Copy link
Contributor Author

sankhesh commented Feb 9, 2017

@doutriaux1 Sure, I'll add some documentation on the wiki and figure out the jupyter notebook thing.

@aashish24 Change 77fc710 adds the reasonable defaults calculation based on the render window size. Note that adding a per-viewport calculation would change how the patterns look between individual plots and even the legend.

I need to add one final change for making the legend work with these new parameters and add new baselines.

@sankhesh
Copy link
Contributor Author

@aashish24 @doutriaux1 Take a look at the new baselines @ CDAT/uvcdat-testdata#158

The legend / colorbar pattern scale issues have been fixed.

I have a merge request in VTK that fixes the weird transparency issue.

Once the VTK change is merged, I'd say lets merge this branch. What do you think?

@aashish24
Copy link
Contributor

@doutriaux1 @williams13 can you approve this branch and have us merge it? If there any other minor issues or feature, we can do in a separate PR?

@doutriaux1
Copy link
Contributor

@aashish24 is the VTK branch from @sankhesh in VTK master? If not can we put it into our VTK/master?

I can't really approve until we can access the bug fix.

@aashish24
Copy link
Contributor

@aashish24 is the VTK branch from @sankhesh in VTK master? If not can we put it into our VTK/master?

the plan is to have the branch merged into VTK master today and yes I will recommend not merging it until then but it would be good to have you look at it and run it if needed.

@aashish24
Copy link
Contributor

@sankhesh make sure to ping Will as I do not think it should take him long time to approve the VTK branch.

@doutriaux1 after we get the VTK branch merged and you are happy with this branch, for any minor issue let's create another PR so that we can get majority of improvements.

@sankhesh
Copy link
Contributor Author

@aashish24 @doutriaux1 The VTK MR is merged.

@aashish24
Copy link
Contributor

Great @sankhesh!

@aashish24
Copy link
Contributor

ping @doutriaux1 @williams13 VTK branch is merged into VTK master.

@doutriaux1
Copy link
Contributor

built it, i'm having issues with test suite, but you can use the linux build from my channel doutriaux1

@aashish24
Copy link
Contributor

built it, i'm having issues with test suite, but you can use the linux build from my channel doutriaux1

@doutriaux1 not sure if you are asking @sankhesh to do something or just stating the fact.

@doutriaux1
Copy link
Contributor

stating. Should be able to merge early next week

@aashish24
Copy link
Contributor

stating. Should be able to merge early next week

Ok. thanks.

@sankhesh
Copy link
Contributor Author

@doutriaux1 @williams13 Were you able to test this branch?

@doutriaux1
Copy link
Contributor

@sankhesh I'll test it no and merge in

@doutriaux1 doutriaux1 merged commit 5f393f1 into CDAT:master Feb 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants