diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2023-10-24 00:43:49 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2023-10-24 00:43:49 +0200 |
commit | c60e26e55b565809862b90803a60f413ba7a9fdb (patch) | |
tree | 85f8ac6cd88f6448ee80d768fbfa115c7ae68f18 /list-observations | |
parent | db1d23c1a4286fc3b78acac436a82b4eecb32b5b (diff) |
list-observations: Allow substring match in --taxon.
Useful for `--taxon=ticka,blÄslav,spindling` for instance.
Diffstat (limited to 'list-observations')
-rwxr-xr-x | list-observations | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/list-observations b/list-observations index 0a9764c..91aeeec 100755 --- a/list-observations +++ b/list-observations @@ -213,9 +213,11 @@ while feature is not None: vernacularName = getField(feature, 'VernacularName') if vernacularName is None: raise Exception('Missing name') - if args.taxon is not None and vernacularName.lower() not in args.taxon: - feature = layer.GetNextFeature() - continue + if args.taxon is not None: + name = vernacularName.lower() + if not any([sub in name for sub in args.taxon]): + feature = layer.GetNextFeature() + continue protectedByLaw = feature.GetField('ProtectedByLaw') if args.protected and (protectedByLaw is None or not protectedByLaw): |