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

Printing variables works using cdms2 and all plots work. #1

Merged
merged 2 commits into from
Oct 13, 2016

Conversation

danlipsa
Copy link
Contributor

@danlipsa danlipsa commented Oct 7, 2016

@aashish24 @doutriaux1 @chaosphere2112 @mattben @jbeezley Please review.

vcs-js is back to the old master capabilities with the new vtkweb frontend and ES6 - thanks to Jon for starting this.
vcs-js
Outstanding issues:

  1. client plots (top left) don't transfer data from the server, but use a canned data pulled from girder.
  2. Windows are not closed on the server - this seems to be a vcs issue: Closing a canvas does not work properly if more than one canvas is open. vcs#21
  3. the isofill, robinson projection seems to be clipped: If masking reduces the bounds of a dataset, plots look incomplete. vcs#26
  4. Sometimes you get a blank area for one of the plots when you refresh.
  5. On Mac, you need to resize the browser window to get the plots to show up.
  6. On Mac, Firefox shows a scrollbar, Chrome and Safari do not - I think this is a problem with the demo rather than the API.

@chaosphere2112
Copy link
Contributor

@danlipsa I'm trying to test it, but apparently the build of VTK on our conda channel doesn't have VTKWeb installed.

Traceback (most recent call last):
  File "server.py", line 35, in <module>
    from vtk.web import protocols, server
  File "/Users/fries2/anaconda/envs/vtkwebjs/lib/python2.7/site-packages/vtk/web/protocols.py", line 9, in <module>
    from vtkWebCorePython import vtkWebApplication, vtkWebInteractionEvent
ImportError: No module named vtkWebCorePython
# packages in environment at /Users/fries2/anaconda/envs/vtkwebjs:
#
cloog                     0.18.0                        0  
nodejs                    4.5.0                         0    conda-forge
curl                      7.49.0                        1  
freetype                  2.5.5                         1  
gmp                       5.1.2                         6  
isl                       0.12.2                        1  
jbig                      2.1                           0  
jpeg                      8d                            2  
libpng                    1.6.17                        0  
libtiff                   4.0.6                         2  
mpc                       1.0.1                         0  
mpfr                      3.1.2                         0  
numpy                     1.9.2                    py27_2  
openssl                   1.0.2j                        0  
pip                       8.1.2                    py27_0  
python                    2.7.12                        1  
readline                  6.2                           2  
setuptools                27.2.0                   py27_0  
sqlite                    3.13.0                        0  
tk                        8.5.18                        0  
cdat_info                 2.6.1                    UVCDAT    uvcdat
cdms2                     2.6.1                    UVCDAT    uvcdat
cdtime                    2.6.1                    UVCDAT    uvcdat
cdutil                    2.6                      UVCDAT    uvcdat
clapack                   3.2.1                    UVCDAT    uvcdat
distarray                 2.6                      UVCDAT    uvcdat
dv3d                      2.6                      UVCDAT    uvcdat
esmf                      ESMF_6_3_0rp1_ESMP_01          UVCDAT    uvcdat
ffmpeg                    2.7.0                    UVCDAT    uvcdat
g2clib                    1.4.0b                   UVCDAT    uvcdat
genutil                   2.6                      UVCDAT    uvcdat
gfortran                  4.9.3                         1    uvcdat
hdf5                      1.8.16                   UVCDAT    uvcdat
jasper                    1.900.1                  UVCDAT    uvcdat
lapack                    3.4.2                    UVCDAT    uvcdat
libcdms                   2.6.1                    UVCDAT    uvcdat
libcf                     1.0.beta11               UVCDAT    uvcdat
libdrs_c                  1.0.1                    UVCDAT    uvcdat
libdrs_f                  1.0.1                    UVCDAT    uvcdat
libnetcdf                 4.3.3.1                  UVCDAT    uvcdat
ossuuid                   1.6.2                    UVCDAT    uvcdat
proj4                     4.9.2                    UVCDAT    uvcdat
regrid2                   2.6.1                    UVCDAT    uvcdat
udunits2                  2.2.17                   UVCDAT    uvcdat
unidata                   2.6                      UVCDAT    uvcdat
vcs                       2.6                      UVCDAT    uvcdat
vcsaddons                 2.6                      UVCDAT    uvcdat
vtk                       7.1.0.2.6         uvcdat_master    uvcdat
x264                      20151006.2245            UVCDAT    uvcdat
yasm                      1.2.0                    UVCDAT    uvcdat
wheel                     0.29.0                   py27_0  
xz                        5.2.2                         0  
zlib                      1.2.8                         3  

@doutriaux1
Copy link
Contributor

@chaosphere2112 for now get the recipe from UV-CDAT/conda-recipes and turn webvtk on.

@danlipsa
Copy link
Contributor Author

@chaosphere2112 @doutriaux1 Sorry for the delay, I was off yesterday. vtkweb is aleady there.
I am using the latest uvcdat repo with the latest vcs repo installed on top.
Try launching the server like that:

PYTHONPATH=/home/danlipsa/anaconda2/envs/2.6-42-g24f85dc/lib/python2.7/site-packages/vtk /home/danlipsa/anaconda2/envs/2.6-42-g24f85dc/bin/vtkpython server/server.py -p 9000

Make sure you replace my conda dir with yours.

@jbeezley
Copy link
Contributor

Setting the PYTHONPATH should be unnecessary if you are running with vtkpython rather than just python.

@chaosphere2112
Copy link
Contributor

Had not heard of vtkpython. I'll give that a shot.

@chaosphere2112
Copy link
Contributor

@jbeezley Nope, that doesn't work at all:

$ vtkpython
vtk version 7.1.0
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site

I'm going to give the manual pythonpath a try.

@danlipsa
Copy link
Contributor Author

danlipsa commented Oct 11, 2016

@chaosphere2112 @jbeezley Note, I am using vtkpython as well. Not sure why this needs the PYTHONPATH as well. It may be a conda thing.

@jbeezley
Copy link
Contributor

That's probably a problem with the vtk build in conda then. vtkpython is intended to add all necessary paths (LD_LIBRARY_PATH and PYTHONPATH) automatically.

@chaosphere2112
Copy link
Contributor

So, the process as I believe I have interpreted:

  1. npm install
  2. npm run demo &
  3. PYTHONPATH=/path/to/my/env/blahblahblah/vtk python server/server.py -p 9000 (which appears to correctly set up python for vtkweb)

at which point I open http://localhost:8080/demo in my browser, and nothing happens; console says ReferenceError: $ is not defined with a link to line 98 of demo.js.

@danlipsa
Copy link
Contributor Author

@jbeezley Do you know what this error is?

@jbeezley
Copy link
Contributor

That sort of error would seem to indicate there was an error thrown while loading the main bundle. There was no error before that point? Was ../dist/vcs.js served by the dev server?

@danlipsa
Copy link
Contributor Author

@chaosphere2112 I think you are missing the 'npm run build' step.

@chaosphere2112
Copy link
Contributor

$ npm run build

> [email protected] build /Users/fries2/Projects/vcs-js
> webpack --progress --colors

Hash: e51d31b561d0a51489da  
Version: webpack 1.13.2
Time: 40ms

ERROR in Entry module not found: Error: Cannot resolve module 'babel' in /Users/fries2/Projects/vcs-js

@chaosphere2112
Copy link
Contributor

$ npm install -g babel
npm WARN deprecated [email protected]: Babel's CLI commands have been moved from the babel package to the babel-cli package
/Users/fries2/anaconda/envs/vtkwebjs/bin/babel -> /Users/fries2/anaconda/envs/vtkwebjs/lib/node_modules/babel/cli.js
/Users/fries2/anaconda/envs/vtkwebjs/bin/babel-external-helpers -> /Users/fries2/anaconda/envs/vtkwebjs/lib/node_modules/babel/cli.js
/Users/fries2/anaconda/envs/vtkwebjs/bin/babel-node -> /Users/fries2/anaconda/envs/vtkwebjs/lib/node_modules/babel/cli.js
/Users/fries2/anaconda/envs/vtkwebjs/lib
└── [email protected] 

@jbeezley
Copy link
Contributor

You don't want a global install of babel, and npm run build should be unnecessary because we are using webpack-dev-server. In any case, babel should be installed through the usual npm install. My first guess is that you are using an older version of npm. I would try npm install -g npm@3, delete node_modules, and try again.

Copy link
Contributor

@chaosphere2112 chaosphere2112 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a few issues with the javascript trying to get it to compile and running the demo.

canvas.plot(clt, gm, 'default', 'vtkweb');
canvasPromise.then(function (canvas) {
var dataSpec = {
file: 'coads_climatology.nc',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was not included in the repo; I used clt.nc and clt here instead; for the vectors, I used u and v from clt.nc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the file. Not sure why this was used in the original cdat_web.
coads_climatology.zip

variables() {
return this.session.client()
.then((client) => client.session.call('file.netcdf.variables', [fileName]));
.then((client) => client.session.call('cdat.file.variables', [fileName]));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The npm run build command complained about this style of arrow function for me; I made it work by converting them to something like (client) => { return client.session.call('cdat.file.variables', [fileName]); }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny how the linter behaves differently for you. @jbeezley Why is that? But I like your version better.

}];
} else {
dataSpec.variables = [];
for (let i = 0; i < dataSpec.variable.length; ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Er... is this loop doing the right thing? The linter yelled at me about the use of ++ at all, let alone preincrement. Won't this not insert variables[0]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that you have variable and variables, so I think it the loop is fine. Not sure about the ++, my linter was happy with it. I guess we should make sure we force the linter version used so that we get consistent results. @jbeezley could you help?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so it is. My mistake.

@chaosphere2112
Copy link
Contributor

The errors I mentioned:

ERROR in ./src/session.js

/Users/fries2/Projects/vcs-js/src/session.js
  33:37  error  Unexpected parentheses around single function argument having a body with no curly braces  arrow-parens
  38:15  error  Unexpected parentheses around single function argument having a body with no curly braces  arrow-parens
  40:40  error  Unexpected parentheses around single function argument having a body with no curly braces  arrow-parens
  87:15  error  Unexpected parentheses around single function argument having a body with no curly braces  arrow-parens

✖ 4 problems (4 errors, 0 warnings)


ERROR in ./src/file.js

/Users/fries2/Projects/vcs-js/src/file.js
  11:15  error  Unexpected parentheses around single function argument having a body with no curly braces  arrow-parens

✖ 1 problem (1 error, 0 warnings)


ERROR in ./src/vtkweb/index.js

/Users/fries2/Projects/vcs-js/src/vtkweb/index.js
  32:57  error  Unary operator '++' used  no-plusplus
  40:58  error  Unary operator '++' used  no-plusplus

✖ 2 problems (2 errors, 0 warnings)

@danlipsa
Copy link
Contributor Author

@chaosphere2112 Searching for no-plusplus says to replace ++ with += which is fine. I think you have a newer version of eslint.

@chaosphere2112
Copy link
Contributor

@danlipsa I'm running v3.7.1, apparently.

@danlipsa
Copy link
Contributor Author

danlipsa commented Oct 13, 2016

@chaosphere2112 I have 3.3.1. This is downloaded by npm install I think, so it should be a way to fix the version.

@jbeezley
Copy link
Contributor

@danlipsa, if you run npm update, it will update all of your local packages to the most recent version. What happened here is eslint was updated in kw-web-suite, which pulled in some minor rule changes. You can try pinning the version of kw-web-suite to prevent that from happening in the future.

@danlipsa
Copy link
Contributor Author

Thanks @jbeezley. @chaosphere2112 Do you want me to update the PR and fix the errors with the new lint?

@chaosphere2112
Copy link
Contributor

@danlipsa Please; once you do, I'll merge and get started on my work.

@danlipsa
Copy link
Contributor Author

@chaosphere2112 Done.

@chaosphere2112
Copy link
Contributor

👍 Thanks!

@chaosphere2112 chaosphere2112 merged commit 43394e8 into master Oct 13, 2016
@chaosphere2112 chaosphere2112 deleted the add-vtkweb branch October 13, 2016 17:33
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.

4 participants