announcements: updated QGIS plugin; python script to interrogate survex source data files
Warren Family
warrenfamily at fastmail.com
Thu Oct 26 23:19:43 BST 2023
Couple of announcements here (separate from the previous emails about
co-ordinate systems):
The new v1.3.1 of the QGIS .3d import plugin fixes a problem reported by
Olly: following a format change in survex versions 1.4.x the EPSG
number was not being picked up from the .3d file when it was requested,
on importing the .3d file into QGIS. The fix has now propagated to the
QGIS plugin repository so the simplest way to upgrade here is within
QGIS itself: go to Plugins -> Manage and Install Plugins .., and install
or re-install the 'Import .3d file' plugin. Alternatively follow the
instructions at https://github.com/patrickbwarren/qgis3-survex-import.
I've also taken the opportunity to update the DowProv cave survey
example and add a comment on the EPSG number problem just discussed.
Next, I made a python script to interrogate survex data files, starting
from a top level .svx file and reading lines from .svx files in logical
order following the *include statements. This can be used to extract
keywords, or just search for patterns (grep-like, for those who know the
venerable unix tool). It's a stand-alone script that can be used at the
command line, or within a python script or jupyter notebook: see
https://github.com/patrickbwarren/python3-survex-analyzer.
For example, to find all the *cs, *declination and *fix commands in the
DowProv cave example one would use (unix command line):
$ ./svx_keywords.py -ck cs,declination,fix DowProv/DowProv
DowProv/DowProv.svx:41::*cs OSGB:SD
DowProv/DowProv.svx:45::*cs out EPSG:25830 ; ETRS89 UTM zone 30N (E, N)
DowProv/DowProv.svx:52::*declination auto 97480 72608 225
DowProv/DowCave/DowCave.svx:15::*fix dow1.1 98378 74300 334
DowProv/ProvidencePot/ProvidencePot.svx:12::*fix ppot1.1 99213 72887 401
DowProv/HagDyke.svx:7::*declination 0 degrees
DowProv/HagDyke.svx:14::*fix W 98981 73327 459
(the -c option here gives a colorized output, like grep).
To find all the references to '*fix' (followed by a space) in any line, use:
$ ./svx_keywords.py -cg '\*fix ' DowProv/DowProv
DowProv/DowCave/DowCave.svx:15::*fix dow1.1 98378 74300 334
DowProv/ProvidencePot/ProvidencePot.svx:12::*fix ppot1.1 99213 72887 401
DowProv/ProvidencePot/ppot1.svx:21::; *fix 1 99213 72887 400 ; moved to
master file
DowProv/HagDyke.svx:14::*fix W 98981 73327 459
(again colorized output following the -c option).
Note that line 21 in ppot.svx where the *fix was commented out is picked
up here, in contrast to the above. The argument '\*fix ' is a standard
python regular expression, in quotes to avoid being interpreted by the
shell.
I've tested it quite extensively against the Easegill-Pippikin data set
(435 .svx files), and the Leck-Masongill data set (446 files), with all
their foibles, and it works well for them. I haven't been able to test
it on Windows though, so if anyone can provide feedback on that
platform, it would be greatly appreciated!
Suggestions for additional features, bug reports, etc welcomed :-).
Patrick
More information about the Survex
mailing list