Metadata Editor is not writing ENVI-style lists correctly

Issue #622 resolved
Andreas Janz created an issue

In the ENVI domain, lists are wrapped by {} brackets, e.g.:

<MDI key="wavelength">{0.46, 0.465, 0.47, ... }

After changing such lists in the Metadata Editor and save, the brackets are gone. This introduces problems in following algorithms!

<MDI key="wavelength">123.456, 0.465, 0.47, ...

Comments (4)

  1. Benjamin Jakimow

    This regex allows for relaxed parsing of ENVI list values, no matter they start or end with braces. List values could even include braces (nam{me), though I think this is not ENVI style any more

    import re
    text2parse= '{    42.23  ,  na{me   }'
    re.split('\s*,\s*', re.sub('(^\s*{\s*|\s*}\s*$)', '', text2parse))
    ['42.23', 'na{me']
    

    ))

  2. Andreas Janz reporter

    Thanks for the workaround, but you really should write the new list in the original format. Its not good to switch formats in between.

  3. Log in to comment