Subset error: gridHeight >=2

in the last months I have always used subset without problem but right now, after a month without opening SNAP, I’m having problem using subset because it gives me “gridHeight >=2” error. The fact is that it shows this error only if I try to use subset in my region of interest, if I use subset in another zone of the image it works without problem.

I installed SNAP in two different computers and right now in both I have the same error.

I have already tried to clean the cache because to me it seems there’s something in the memory that stop the process when it is used in that region but it didn’t work. I also tried uninstalling SNAP and installing it again but it gives me always the same error only for that region of the image. I sent the images to another user to check if they are the problem but on another pc it does not report the error.

Do you have any suggestion?
Thanks for the help.

This sounds like as if the overlap of the product boundary with the region you specify is very small.
Did the others you have sent the images to also used the same region?
Can you increase your region of interest a bit?

Yes, the region that I need is really small but in the past I hadn’t problem subsetting it in other images.

Also yes, the others used the coordinates I gave them for the subset without errors. Actually I installed SNAP on the second computer because the first one started reporting this error and I thought it was a problem of my pc. With the second computer I worked without problem for a period and then it started giving me the same error as the first computer.

I have just tried to increse the region of interest and the subset works but I really need the small region because I have to put it in another programme.
Thank you.

It’s strange that the result is varying over time.
Are you using Sentinel-2 data?
This error only occurs when tie-point data is present in the product. Two pixels in both directions are necessary for the interpolation of the tie-points.
But Sentinel-2 does not have tie-points.

Yes I’m sure they are Sentinel-2 data. I downloaded them from Copernicus Open Access Hub: mission sentinel-2, satellite platfrom S2A/B, product type S2MSI2A.

This is the reason I don’t understand why it is not working. Also because I tried to subset the images with which I worked in the past and now I cannot subset them anymore. At first I thought it was my computer but now having two computers with the same error I don’t know what it could be.

I don’t know if this can help but it is the error that occurr:

java.lang.IllegalArgumentException: gridHeight >= 2
at com.bc.ceres.core.Assert.argument(
at org.esa.snap.core.datamodel.TiePointGrid.(
at org.esa.snap.core.datamodel.TiePointGrid.(
at org.esa.snap.core.datamodel.TiePointGrid.(
at org.esa.snap.core.datamodel.TiePointGrid.createSubset(
at org.esa.snap.core.dataio.ProductSubsetBuilder.addTiePointGridsToProduct(
at org.esa.snap.core.dataio.ProductSubsetBuilder.createProduct(
at org.esa.snap.core.dataio.ProductSubsetBuilder.readProductNodesImpl(
at org.esa.snap.core.dataio.AbstractProductReader.readProductNodes(
at org.esa.snap.core.dataio.AbstractProductBuilder.readProductNodes(
at org.esa.snap.core.dataio.ProductSubsetBuilder.createProductSubset(
at org.esa.snap.core.dataio.ProductSubsetBuilder.createProductSubset(
at org.esa.snap.core.datamodel.Product.createSubset(
[catch] at org.esa.snap.rcp.subset.CreateSubsetAction.createSubset(
at org.esa.snap.rcp.subset.CreateSubsetAction.actionPerformed(
at org.openide.awt.InjectorExactlyOne.actionPerformed(
at org.openide.awt.ContextAction$Performer.actionPerformed(
at org.openide.awt.ContextManager.actionPerformed(
at org.openide.awt.ContextAction.actionPerformed(
at org.openide.util.actions.ActionInvoker$
at org.openide.util.actions.ActionInvoker.doPerformAction(
at org.openide.util.actions.ActionInvoker.invokeAction(
at org.openide.awt.GeneralAction$BaseDelAction.actionPerformed(
at javax.swing.AbstractButton.fireActionPerformed(
at javax.swing.AbstractButton$Handler.actionPerformed(
at javax.swing.DefaultButtonModel.fireActionPerformed(
at javax.swing.DefaultButtonModel.setPressed(
at javax.swing.AbstractButton.doClick(
at com.jidesoft.plaf.vsnet.VsnetMenuItemUI.doClick(
at com.jidesoft.plaf.vsnet.VsnetMenuItemUI$MouseInputHandler.mouseReleased(
at java.awt.Component.processMouseEvent(
at javax.swing.JComponent.processMouseEvent(
at java.awt.Component.processEvent(
at java.awt.Container.processEvent(
at java.awt.Component.dispatchEventImpl(
at java.awt.Container.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.LightweightDispatcher.retargetMouseEvent(
at java.awt.LightweightDispatcher.processMouseEvent(
at java.awt.LightweightDispatcher.dispatchEvent(
at java.awt.Container.dispatchEventImpl(
at java.awt.Window.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.EventQueue.dispatchEventImpl(
at java.awt.EventQueue.access$500(
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue$
at java.awt.EventQueue$
at Method)
at java.awt.EventQueue.dispatchEvent(
at org.netbeans.core.TimableEventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(

Hi there,
I have the same issue and it has only become a problem in the last month or two as well, and now we have multiple areas exhibiting this problem.
I am using latest snappy add-in with python 3.6.
Basically it appears on some products where smaller subsets (I think) will fail with the gridHeight>=2 error these areas are still many square km, so not that small.
I have extracted out problem subsets and tiles and experimented but the failure seems fairly random to me, after increasing the size to some arbitrary amount it suddenly starts working. As we have an automation approach on multiple AOI this is a problem, especially given most products work fine on the original area.

I have a sample script below where you can swap out the footprints and the products and see the error either happening or not happening, and in all cases the subsets are within the full boundary and not particularly small.

Any suggestions would be appreciated.

Thanks. (2.3 KB)

import snappy

from snappy import (ProductIO, ProductUtils, ProgressMonitor, WKTReader, HashMap, Rectangle, GPF)

jpy = snappy.jpy

# your product location

location = "f:/tiles"


#productName = ""  


productName = ""

product = ProductIO.readProduct(f"{location}/{productName}")

#outerFootprint = aq.getFullWktFromProduct(product)  # removed this dependency but the result is pasted below for reference

outerFootprint = 'POLYGON((172.2160 -42.4457,173.5913 -42.4457,173.5913 -43.4116,172.2160 -43.4116,172.2160 -42.4457))'

# subset

#broken - test case 1: using our required subset which fails

footprint = "POLYGON((172.6390010317605 -43.39579965983345,172.6390010317605 -43.344306818076774,172.6958284962738 -43.344306818076774,172.6958284962738 -43.39579965983345,172.6390010317605 -43.39579965983345))"

#works - this one works and is slightly bigger

#footprint = "POLYGON((172.61475357016883 -43.302184842665156,172.69852432212195 -43.302184842665156,172.69852432212195 -43.36810997853914,172.61475357016883 -43.36810997853914,172.61475357016883 -43.302184842665156))"

#broken - slightly smaller than above but breaks with the same error

#footprint = 'POLYGON((172.63397964438758 -43.32316878539379,172.6957777400907 -43.32316878539379,172.6957777400907 -43.36910829381515,172.63397964438758 -43.36910829381515,172.63397964438758 -43.32316878539379))'

# not sure that we need to resample first, but it doesn't seem to make any difference to the error

parameters = HashMap()    

parameters.put('referenceBand', 'B2')

resampled = GPF.createProduct('Resample', parameters, product)


parameters.put('geoRegion', footprint)

# ERRROR:  org.esa.snap.core.gpf.OperatorException: gridHeight >= 2

region = GPF.createProduct('Subset', parameters, resampled)  # can swap out resampled for product here, makes no difference to the error.

b = region.getBand('B2')

if b == None:

    print("Band B2 is missing")


    width = b.getRasterWidth()

    height = b.getRasterHeight()

    print(f'New region is {width} by {height}')

This is a known issue: [SNAP-1507] Subset cannot be created if tie-point grid is sparse
But I’m surprised that this happens even after resampling.
If you don’t need the tie-points you can add an empty list as parameter for tiePointGrids for the subset step.
parameters.put('tiePointGrids', ',')
An empty string is not working, this is evaluated to ‘no information’ and then all tie-point grids are included. But this empty list seems to work.

1 Like

Excellent, thanks this solved my issue.

1 Like

I am facing the same issue working in GPT not snappy. How should I implement :

parameters.put('tiePointGrids', ',') in my subset gpt graph?


If you change
it should work

@marpet thanks, that error does not appear anymore but now i have

Error: Failed to read the data for level 0 and rectangle java.awt.Rectangle[x=0,y=0,width=38,height=128].

I see it has been reported before. Is there a solution?

Only option I can suggest is to use the S2Resampling, if you use resampling in your graph.
Maybe you can split the graph in two graphs and run them one after the other

I have tried with S2resampling but it is extremly slow. Is this normal? Maybe I am missing something to speed it up? The parameters I am setting on that case are 10 m and Nearest.

I have tried to skip the subset process even if data volume is much bigger but when I run only resample in my graph I get the same error too.

Any suggestions? Is this a general bug affecting everybody?

I’m not sure if it affects everybody. But at least some people with at least some data products.
But in house we process quite a lot S2 data and in general it works.

For comparison, could you please share a prouduct ID which you have succesfully processed and the gpt graph and SNAP version you have used. My processing steps are resample → subset only

Just to discard if its my SNAP installation or a data issue

I just used this graph: S2_S2Resampling_Subset.xml (1.0 KB)
This is the command line call:
gpt "H:\_graphXML\S2_S2Resampling_Subset.xml" -PsourceFile="H:\SENTINEL2\S2B_MSIL1C_20220619T163839_N0400_R126_T15RYN_20220619T184913.SAFE" -PtargetPath="H:\_temp\S2A_MSS2B_MSIL1C_20220619T163839_Res20_subset.dim"

I am running into this issue as well. I’m using GPT to Resample, Subset and BandMath S2 imagery. My graph had the line


so I changed it to


and it worked. Thank you very much for the tip!

This is the size of the area I was trying to subset to:


I had the same problem and changed:
and it worked! Thank you!!


I had the same problem - a subset that worked before was not possible to process any more. In the GUI, I unchecked all boxes in “Tie-Point Grid Subset” and it worked.

1 Like