Hi Frederick,
so it seems I have two new issues regarding the use of Python + pencil-code:
o using "import pencil_old" (Python 2.7):
There seem to be issues here as well:
===
In [1]: run ../../pyscripts/pc_plot_particles_PVARX_2.7
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/cfs/klemming/nobackup/c/csandin/pencil-code/christer/pyscripts/
pc_plot_particles_PVARX_2.7.py in <module>()
14
15 # Particle positions:
---> 16 pdata=pc.read_pvar('PVAR41')
17 #pdata=pc.read_pvar()
18 hmax = 0
/cfs/klemming/nobackup/c/csandin/pencil-code/python/pencil_old/files/read_pvar.pyc in read_pvar(*args, **kwargs)
27 using pc_copyvar to copy and subsequently rename the reduced particle files for new runs
28 """
---> 29 return pcpvar(*args, **kwargs)
30
31 class pcpvar(object):
/cfs/klemming/nobackup/c/csandin/pencil-code/python/pencil_old/files/read_pvar.pyc in __init__(self, varfile, datadir, proc, verbose, reduce_to)
46 nprocs=len(procdirs)
47 ipars,pvars = collect_class_pdata(pfile=varfile,datadir=datadir,nprocs=nprocs,
---> 48 verbose=verbose,reduce_to=reduce_to)
49 else:
50 ipars,pvars = read_class_npvar_red(datadir=datadir,proc=proc,
/cfs/klemming/nobackup/c/csandin/pencil-code/python/pencil_old/files/read_pvar.pyc in collect_class_pdata(pfile, datadir, nprocs, verbose, reduce_to)
208 for i in procs:
209 if (not i==procs[-1]):
--> 210 dom_ipar,dom_pvar, written_parts = read_class_npvar_red(pfile=pfile,datadir=datadir,proc=i,reduce_to=reduce_to,verbose=verbose)
211 if (reduce_to>0):
212 parts_to_write -= written_parts
/cfs/klemming/nobackup/c/csandin/pencil-code/python/pencil_old/files/read_pvar.pyc in read_class_npvar_red(datadir, pfile, proc, verbose, reduce_to, set_reduce)
94 set_reduce=-1):
95
---> 96 dims = pc.read_dim(datadir,proc)
97 pdims = pc.read_pdim(datadir)
98 npar_loc = read_npar_loc(datadir=datadir,pfile=pfile,proc=proc)
AttributeError: 'module' object has no attribute 'read_dim'
===
o using "import pencil" (Python 3.6):
It appears that some routines rely on the IDL Python bridge to read the data.
What is good to know is which version of IDL one needs to look at these data.
Because, currently used Python versions are only available in recent versions
of IDL. For example, IDL version 8.5.1 contains files for Python versions 2.7
(pencil_old) and 3.4 (which is obsolete).
Here is some of the output I get when trying to read particle data using
"import pencil":
===
In [5]: ?pdata
Type: ParticleData
String form: <pencil.read.pvar.ParticleData object at 0x7fe0a57dd0f0>
File: /cfs/klemming/nobackup/c/csandin/pencil-code/python/pencil/read/pvar.py
Docstring:
Read PVAR files from Pencil Code using IDL.
Uses IDL<->Python Bridge, this must be activated manually!
!! WARNING: SHAPE IS AS IN IDL: (X, Y, Z) !!
Args:
- datadir specify datadir, default False
- sim specify simulation from which you want to read
- varfile put 'PVARXYZ' or just number here, 'VAR' will be replaced by 'PVAR' autom.
- npar_max maximal number of particles to be read in
- proc read from single proc, set number here
- swap_endian change if needed to True, default False
- quiet verbosity, default False
If needed add manually to this script:
- rmv, irmv, trmv, oldrmv are used for ???
- solid_object is used for ???
- theta_arr is used for ???
- savefile is used for ???
Init docstring:
Read PVAR files from Pencil Code using IDL.
Uses IDL<->Python Bridge, this must be activated manually!
===
Hmm...where do I start?
Best Wishes and thanks for any help,