S2 Resampling on a subset not supported?

I’m trying to minimize processing time / memory / disk requirements by working on a subset, but S2 Resampling Processor doesn’t seem to like subsets. Similar issue was noted among many things in this post: Resampling, mosaicing and subsetting workflow for Sentinel-2

Steps for testing:

  1. Open any S2 MSI2LA product (S2B_MSIL2A_20190403T095029_N0211_R079_T34VFH_20190403T124934)
  2. Open any band and zoom-in to any part of the image
  3. Raster -> Subset. Leave all parameters unchanged (it will use extent of displayed product view by default)
  4. Optical -> Geometric -> S2 Resampling processor. Choose subset from previous step as an input. Do not change any other parameters and just hit Run.

Expected outcome:
A resampled version of S2 data subset.

Actual outcome:
„Invalid S2 source product“ error.

SNAP 7.0.3 with all mask loading enabled in S2 tbx settings.
Product Version = SNAP (Build 201609300101)
Operating System = Linux version 4.18.0-13-generic running on amd64
Java; VM; Vendor = 1.8.0_202; Java HotSpot™ 64-Bit Server VM 25.202-b08; Oracle Corporation
Runtime = Java™ SE Runtime Environment 1.8.0_202-b08

Have you tried saving the output of the subset first? Mostly, the subset is simply a logical product but not saved.

No, saving does not help. I even tested saving in default format, closing SNAP and then opening just .dim file of subset product — same outcome.

No rush, as Biophysical processor also doesn’t like subsets (all output values are 0).

What do you mean by default format?

What else have you selected at first try?

Is there any chance this could be added to a future development list?

Being able to subset before using S2 Resampling is quite useful as it can be a very intensive on computer resources compared to the original multi-sensor Resampling (at 10m I have exceeded 100gb ram). However the S2 Resampling does better for S2 compared to the original hence its addition to SNAP.

Subsetting of multi-size S2 products is already supported since SNAP 7.0

Sorry subsetting works fine but you cannot resample using “S2 Resample” after subsetting an S2 image.

sorry, I misunderstood your point then.

When I make a subset and try to resample it, I get this error:

Is this your issue?

Yes, exactly this (as described in the first post of this thread).

yes that’s the one :slight_smile: .
Is this software issue ie that order of operation can be added at a later data or a technical issue that you can never perform these operations in this order?

I don’t know what’s the cause, but maybe this can be added as a ticket for the developers

It seems strange that one can’t subset the data before further processing like resampling and atmospheric correction. These are large datasets, where processing time would be improved by not having to use the whole dataset

In GPT is working, I am always subsetting before resampling using the “Resample” operator.

Are you referring to the “Resample” operator which works fine or the “S2Resamping” operator (much better results for S2) mentioned above?

Ana was most likely referring to the generic Resample operator.
The S2Resampling operator can indeed not resample subsetted products which would be a good feature what you have already said.

I’ve created an issue for this.

3 Likes

Hi Marco,

I think this still doesn’t work! Is that right?,

There’s also other issue generally in Resample operator, with *.xml, GUI, in case of resample the whole scene, the results is a cropped scene into a small part, it’s also applied for creating biophysics and resulted layer from BandMath, and sun_zenith as well, following is an example, However running same operators one by one leads to a correct output,

image

Yes, the issue [SIITBX-433] S2Resampling can’t handle S2 data other format as SAFE - JIRA (atlassian.net) is not yet solved.

Can you show an example of the cropped result compared with the input?
Is it the subset you define for Write(2) or a different region?

The small rectangle in the upper left corner is the result,

image

the subset with regard to Write2() is the operator of subset the reectance bands (B2, B3,
B4, B5, B6, B7, B8A, B11, B12)

This is the xml file

Okay, it is just the upper-left quatre. Mmmh … Strange.

Writing multiple files is not a common use case. There could be an unknown issue.
Have you tried from the command-line?

The xml file would be helpful. It is not attached.

Actually not,
While I completed all the S2 preprocesses, and then reaching the Sharpen S3 LST, I fount the problem I already explained above, the goal is creating step by step easy way of SEN_ET, that’s why I didn’t run gpt, from command line,

Yes sorry for that, please find it here, the same thing is applied if an operator subset would be added up for sun_zenith!

S2_PREPROCESSING.xml (4.2 KB)