How to read cgns file contain mesh in python?
I found one package Pymesh but this package only deal with (read/write 2D and 3D mesh in .obj, .ply, .stl, .mesh).
Does anyone knows any package?
If the CGNS file is written with hdf5 (instead of the older ADF versions) you can open them with the python libraries h5py or tables. I use these to read my CGNS files and access them like any other hdf5 file. The same could be said for matlab or any other language... if you can read hdf5 you can read CGNS. I believe CGNS versions 3+ default to hdf5.
PyCGNS libraries for CGNS end-users and Python application developpers. Here is link - http://pycgns.sourceforge.net/
meshio now has initial support for CGNS.
Related
I'd like to know if it's possible to read/write GML files (or even KML files) using Fiona.
Fiona documents don't specify what drivers we can use. I read some answers about the drivers that are avalaible but I still haven't figured out the right answer.
These two different sentences print a different number of drivers. The first one doesn't include GML o KML (in fact there are very few formats supported).
print(fiona.supported_drivers)
vs
print('\n'.join(sorted(fiona.drivers().drivers())))
I know how to do it using GDAL/OGR but I want to do the same using Fiona if it's possible.
In order to read both KML and GML file formats the OGR binaries distributed with the Fiona implementation you're using need to be compiled against libexpat or Xerces (XML parsers). If these libraries exist in the same installation where the ogr.dll (Windows), ogr.so (Linux) used by Fiona is, then read support is most probably available. If no, then only write support will be available.
I've just found out that the newest version of Fiona added support to read and write GML files.
I have successfully installed Python and GDAL with guidance from this link
Installation instructions
I've seen some web tools that can convert to and fro the formats I mentioned above. I decided to install ogr2ogr locally. I need some simple instructions to bring up the command tool and convert my files. Most important is the switch to preserve properties or id of the geometries.
According to the GDAL webpage for the GeoJSON driver, GDAL supports reading TopoJSON as of OGR 1.11. It says nothing about writing TopoJSON, so I am assuming writing is not supported.
From the TopoJSON readme, the binary geo2topo will convert GeoJSON to TopoJSON in-place. It looks like that is the tool you should be using, not ogr2ogr.
The workflow would therefore be as follows:
shapefile translated to GeoJSON with ogr2ogr
GeoJSON updated to TopoJSON with geo2topo
i have a 7zip compressed file with .bup extension, after extracting this file using 7zip utility it creates a folder which contains two files....i would like to do the same thing with PyLZMA, can all the files be extracted into a folder using PyLZMA (decompression)?, could you let me know how can that be done?, i new to this so any detailed help will be really helpful.
The Python 3.3 module has lzma support built in and comes with examples
I've tried to find a software for pdf to chm conversion to convert my pdf e-books to chm, but I ended up disappointed.
So, as a pythonian, I decided to create my own program to convert pdf files to chm, however, all pdf/chm libraries I found are python2 libraries.
Are there python 3 libraries to handle pdf/chm files?
If you want to write CHM, then afaik only Free Pascal (and therefore Delphi with minimal effort) has a free CHM generator library.
All other tools use the Microsoft commandline tool behind the scenes.
For reading there is chmlib, I assume there is some python wrapper for it somewhere.
Is there any way to import SPSS dataset into Python, preferably NumPy recarray format?
I have looked around but could not find any answer.
Joon
SPSS has an extensive integration with Python, but that is meant to be used with SPSS (now known as IBM SPSS Statistics). There is an SPSS ODBC driver that could be used with Python ODBC support to read a sav file.
Option 1
As rkbarney pointed out, there is the Python savReaderWriter available via pypi. I've run into two issues:
It relies on a lot of extra libraries beyond the seemingly pure-python implementation. SPSS files are read and written in nearly every case by the IBM provided SPSS I/O modules. These modules differ by platform and in my experience "pip install savReaderWriter" doesn't get them running out of the box (on OS X).
Development on savReaderWriter is, while not dead, less up-to-date than one might hope. This complicates the first issue. It relies on some deprecated packages to increase speed and gives some warnings any time you import savReaderWriter if they're not available. Not a huge issue today but it could be trouble in the future as IBM continues to update the SPSS I/O modules to deal new SPSS formats (they're on version 21 or 22 already if memory serves).
Option 2
I've chosen to use R as a middle-man. Using rpy2, I set up a simple function to read the file into an R data frame and output it again as a CSV file which I subsequently import into python. It's a bit rube-goldberg but it works. Of course, this requires R which may also be a hassle to install in your environment (and has different binaries for different platforms).
gretl claims to import SPSS and export in a variety of formats, as does the R statistical suite. I've never dealt with SPSS data so cannot speak to their relative merits.
You could have Python make an external call to spssread, a Perl script that outputs the content of SPSS files in the way you want.
Maybe this will help:
Python reader + writer for spss sav files (Linux, Mac & Windows)
http://code.activestate.com/recipes/577811-python-reader-writer-for-spss-sav-files-linux-mac-/
To be clear, the SPSS ODBC driver does not require an SPSS installation.
Maybe this will be helpful for someone:
http://sourceforge.net/search/?q=python+SPSS
good luck!
Michal