Comments (3)
Thanks a lot for creating this issue, and sorry that you have to be a guinea pig.
The Klein Gordon demo requires matplotlib and h5py-parallel to work. The latter is in my channel on anaconda cloud and I should really make it a dependency. Will do that. For now, try to uninstall h5py and install h5py-parallel. Or restart by doing
conda create --name shenfun -c conda-forge -c spectralDNS python=3.6 shenfun h5py-parallel matplotlib
from shenfun.
Ok, thanks, the code ran successfully.
I ran into a second issue which has more to do with my inexperience with hdf5 data.
As an oceanographer I am used to deal with netcdf and reading an hdf5 file is not straitghforward for me.
My guess is that you have somewhere code that does just that but I did not find it easily
but it would be nice if it was more visible.
Anyway I came up with a simple script in order to explore the output files:
import h5py
import matplotlib.pyplot as plt
import sys, time
def print_attrs(name, obj):
print(name)
for key, val in obj.attrs.items():
print(' %s: %s'.format(key, val))
if len(sys.argv) > 1:
# open file and print variables
fname = sys.argv[1]
f = h5py.File(fname, 'r')
if len(sys.argv) == 2:
f.visititems(print_attrs)
else:
# go within data tree
g=f
for i in range(2,len(sys.argv)):
g=g[sys.argv[i]]
print(g)
if i==len(sys.argv)-1:
flag=True
for key, val in g.items():
if isinstance(val, h5py.Dataset):
flag=False
if len(val.shape)==2:
gname=g.name[1:].replace('/','_')+'_'
plt.figure()
plt.imshow(val)
#print(val[:,:])
plt.title(gname+' '+key)
plt.savefig(gname+key+'.png')
plt.close()
elif len(val.shape)==3:
print('Data is 3D')
elif len(val.shape) == 1:
print('Data is 1D')
if flag:
g.visititems(print_attrs)
f.close()
from shenfun.
I only use hdf5 to visualise in parallel. In the end of KleinGordon.py there is a script that generates an xdmf file. This file (which uses pointers into the hdf5 file) can be opened by paraview for visualisation. For plotting in python it is really not necessary to go through the hdf5 format. Just plot the numpy arrays. Of course, in parallel this becomes a bit problematic:-)
from shenfun.
Related Issues (20)
- Dx not working with 1D mixed function space HOT 4
- Issue on Stokes equations with doubly periodic boundary conditions. HOT 2
- Error when evaluating derivatives for nonstandard domain HOT 7
- Installation problem: error in "cimport fastgl_wrap" HOT 2
- Old shenfun script for 2D Poisson equation dosn't work with new version HOT 2
- 1d poisson HOT 1
- Bug in FunctionSpace with bc as dictionary HOT 4
- Solve DGL with non-constant (discrete) variable? HOT 5
- AttributeError: 'tuple' object has no attribute 'copy' HOT 1
- Install problem HOT 1
- problems in solving 2D Allen Cahn equation HOT 2
- Two questions in the demo MixedPoisson.py HOT 7
- How to compute the numerical solution on the general points HOT 4
- 1. Solver for multidimensional problem 2. Product with variable coefficients HOT 4
- Two questions about the Legendre-Galerkin method for the Cahn-Hilliard equation HOT 2
- How to compute the integral about the nonlinear term in the Navier-Stokes equation? HOT 2
- How to assemble the right-hand side vector? HOT 3
- Understanding the chebyshev solver in poisson2ND.py HOT 3
- Time dependent boundary conditions in segments for Rayleigh-Benard 2D HOT 2
- Implementing the one-dimensional Kuramoto-Sivashinsky system HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shenfun.