Coder Social home page Coder Social logo

joergbuchwald / vtuinterface Goto Github PK

View Code? Open in Web Editor NEW
15.0 3.0 9.0 12.92 MB

Python-Interface for reading and writing VTU files and exactracting time series data from PVD/VTU files

License: BSD 3-Clause "New" or "Revised" License

Python 43.88% Jupyter Notebook 56.12%
series-data vtu vtk pvd python julia pvd-files vtu-files timesteps

vtuinterface's Introduction

DOI VTUinterface codecov DOI

VTUinterface

VTUinterface is a python package for easy accessing VTU/PVD files as outputed by Finite Element software like OpenGeoSys. It uses the VTK python wrapper and linear interpolation between time steps and grid points to access any points in space and time within the simulation domain.

VTUinterface together with ogs6py can be viewed in action here:

IMAGE ALT TEXT HERE

0. Installation

Note: VTUinterface requires the vtk wrapper for python. Alternatively, a version based on MESHIO is also under development. clone the repository and use pip to install the package

# pip install [--user] https://github.com/joergbuchwald/VTUinterface/archive/refs/heads/master.zip

1. Documentation for VTUinterface

You can find the documentation under https://joergbuchwald.github.io/VTUinterface-doc/

2. Quick start

CAUTION: naming style of methods has changed (2021-05-20)

Basic Usage (python)

Although, a python package, VTUinterface is tested to work through PyCall under julia as well:

Basic Usage (julia)

Unittests can be run via

# python tests/test_vtuinterface.py

from the project root directory.

3. FAQ/Troubleshooting

Installation:

  • If the vtk whell can't be found on PyPI you can checkout pyvista/pyvista#2064 for unofficial wheels.

As the input data is triangulated with QHull for the linear interpolation it might fail at boundaries or if a wrong input dimension is given. Possible solutions:

  • In order for interpolation to work correctly providing the correct dimension (set via dim keyword) of the problem is crucial.
  • As the dim keyword specifies also the coordinates to use, VTUinterface assumes that dim=1 refers to the x coordinate and dim=2 implies that the problem lies in the xy-plane by default. This can be changed by specifying one_d_axis for one dimension or two_d_planenormal for two dimensions.
  • For some meshes it might help to adjust the number of points taken into account by the triangulation, which can be done using the nneighbors keyword. Default value is 20.
  • Especially along boundaries, linear interpolation with the QHULL method often fails, this can be resolved by using nearest neighbor interpolation.
  • Alternatively, you can change now the interpolation_backend from scipy to vtk and try out different interpolation kernels.

vtuinterface's People

Contributors

chleh avatar dominik-kern avatar eqrisi avatar joergbuchwald avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vtuinterface's Issues

JOSS review suggestions

This looks like it may useful for many people.

Like joergbuchwald/ogs6py#17, I have some suggestions

  • Some documentation on how to run the tests to make sure everything is working would be good
  • examples/vtu_read_example.py - throws an error AttributeError: 'VTUIO' object has no attribute 'get_point_data'
  • The images don't appear in the documentation, e.g. https://joergbuchwald.github.io/VTUinterface-doc/basic_usage_python.html#reading-point-set-data-from-pvd-files doesn't display images for me
  • I do get some performance warnings that you might want to consider
    vtuIO.py:102: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()` df["r_"+str(i)] = (df[x]-val[x]) * (df[x]-val[x]) + (df[y]-val[y]) * (df[y]-val[y])
  • There is a typo in the fourth bullet point in 3. FAQ/Troubleshooting: ...this can be resolved bei using...
  • The changelog references ogs6py, possible cut and paste error.

Otherwise, the documentation is good, particularly the API class documentation.

Note: I didn't try this in julia.

Refs openjournals/joss-reviews#3673

How to install VTUinterface for Julia?

Hello Jörg,

I'm interested in using your package from Julia. But I have no experience in installing/using Python packages with Julia.
So I did in a Julia REPL

julia> using Pkg  
julia> Pkg.build("PyCall")

which worked. Then I tried to use Conda to install VTUinterface and I got an error message

julia> Conda.add("VTUinterface")
PackagesNotFoundError: The following packages are not available from current channels:
  - vtuinterface

Thus, I went on and tried to use Conda.pip to install VTUinterface from github

julia> Conda.pip("install", "git+https://github.com/joergbuchwald/VTUinterface")
[ Info: Running `pip install git+https://github.com/joergbuchwald/VTUinterface` in root environment
Collecting git+https://github.com/joergbuchwald/VTUinterface
  Cloning https://github.com/joergbuchwald/VTUinterface to c:\users\xyz\appdata\local\temp\pip-req-build-n65kf05f
Collecting lxml
  Downloading lxml-4.6.1-cp38-cp38-win_amd64.whl (3.5 MB)
     |████████████████████████████████| 3.5 MB 2.2 MB/s
Collecting vtk
  Downloading vtk-9.0.1-cp38-cp38-win_amd64.whl (38.4 MB)
     |████████████████████████████████| 38.4 MB 1.0 MB/s
Collecting pandas
  Downloading pandas-1.1.4-cp38-cp38-win_amd64.whl (8.9 MB)
     |████████████████████████████████| 8.9 MB 6.4 MB/s 
ERROR: Could not find a version that satisfies the requirement setup (from VTUinterface==0.6) (from versions: none)
ERROR: No matching distribution found for setup (from VTUinterface==0.6)
ERROR: failed process: Process(setenv(`'C:\Users\xyz\.julia\conda\3\Scripts\pip.exe' install git+https://github.com/joergbuchwald/VTUinterface`,

I interpret this, I may be wrong, as Conda.pip does not find "setup" from your setup.py file
install_requires=["lxml", "vtk", "pandas", "setup"],

There I got stuck. I tried

julia> Conda.add("setup")
[ Info: Running `conda install -y setup` in root environment
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:
  - setup

but this fails too.
I know that this is more an installation problem and most probably not a problem
of your package ... but maybe you could give me a hint?

Thanks

rd

Installation instructions and example data

Some comments:

  1. You can simplify installation instructions to just this line:
pip install [--user] https://github.com/joergbuchwald/VTUinterface/archive/refs/heads/master.zip
  1. When following the README_python.md the file examples/square2d_random.vtu is missing in the repo. It would be nice if you would provide it (although you mention that it can be generated with another tool).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.