Support for Sen2Cor 2.8.0

Issue #2 new
Christian Bauer created an issue

Dear Sam!

We are strongly interested to use your processing with Sen2Cor 2.8. Due to changes in Sen2Cor and the corresponding GIPP.xml multiple changes in preprocess.py are required. Is is foreseen by your side to handle versions and to support the newly released Sen2Cor 2.8?

One of the issues is that from sen2cor v2.8 on the “Output_Dir” variable is converted into a command line option and does not exist in GIPP any more.

We were already looking into it, and would hack a quick solution into the script, based on “if version < x.x.x“. Unfortunately Sen2Cor and the GIPP do not provide version strings (apart from help/processing output).

getting version directly via
sys.path.append(os.path.abspath("/path/to/sen2cor/lib/python2.7/site-packages/"))
from sen2cor import L2A_Config
L2A_Config.processorVersion
does not work, because it cannot be imported easily (the config fails to change file permissions... m)
so take the output of the script and parse version Number from there?

That is what we currently try to do.

If there are already plans for a proper API/version handling it could be done right…

Comments (3)

  1. Samuel Bowers repo owner

    Hi Christian,

    Thanks for letting me know! Indeed, that’s a tricky problem. I’ll take a look at it this week.

    It may not be the perfect solution, but perhaps a re-write for sen2cor 2.8.0 would be the most straightforward solution. Could you think of any reason that over the long term a user might prefer to work with an old version of sen2cor? If there’s no reliable way to access a version number, perhaps a command line argument could fill in, though I feel that’s very sub-optimal.

    On version handling, it’s very much on the to-do list. The spec of this tool has continued to change until relatively recently, I’m working on a ‘final draft' now, and thereafter hope to switch to a more regular pattern of updates/maintenance.

    Sam

  2. Samuel Bowers repo owner

    Hi Christian,

    Brief update on this, looks like the GIPP files weren’t the only thing that changed 😰. I’m going to have to give this more thought, dropping support for 2.5.5 would mean older Sentinel-2 data couldn’t be supported.

    I’ve also not found a (sensible) way of getting a version from sen2cor, and even if I did that wouldn’t be the end of the issue. I’d rather not hack in a solution, so I’ll take a few more days to think about it.

    Sam

  3. Samuel Bowers repo owner

    Update done. If you git pull to update, everything should work as-is, following a few tweaks:

    i) You’ll need to update sen2cor to 2.8.0, and re-run setup.py

    ii) I’ve taken the opportunity to move the command line interface to …/sen2mosaic/cli/*.py, if you’re using the ‘s2m’ shortcut you’ll need to update your .bashrc file. Scripts should work as before.

    iii) If you still want to process anything with sen2cor 2.5.5, this can be specified as an argument in preprocess.py, but for most user requirements I’d think this unlikely.

    If you find any bugs with this new setup, let me know.

    Sam

  4. Log in to comment