java.lang.RuntimeException: Cannot construct DataBuffer

Please see the message below I have while mosaicing two resampled scenes.

java.lang.RuntimeException: Cannot construct DataBuffer.

at com.sun.media.jai.util.DataBufferUtils.constructDataBuffer(Unknown Source)

at com.sun.media.jai.util.DataBufferUtils.createDataBufferFloat(Unknown Source)

at javax.media.jai.ComponentSampleModelJAI.createDataBuffer(Unknown Source)

at javax.media.jai.RasterFactory.createWritableRaster(Unknown Source)

at javax.media.jai.PlanarImage.createWritableRaster(Unknown Source)

at javax.media.jai.SourcelessOpImage.computeTile(Unknown Source)

Caused: org.esa.snap.core.gpf.OperatorException: Cannot construct DataBuffer.

at org.esa.snap.core.gpf.internal.OperatorExecutor$GPFImagingListener.errorOccurred(OperatorExecutor.java:381)

at com.sun.media.jai.util.SunTileScheduler.sendExceptionToListener(Unknown Source)

at com.sun.media.jai.util.SunTileScheduler.scheduleTile(Unknown Source)

at javax.media.jai.OpImage.getTile(Unknown Source)

at org.esa.snap.core.gpf.common.reproject.WarpFromSourceCoordinates.warpSparseRect(WarpFromSourceCoordinates.java:63)

at javax.media.jai.Warp.mapDestRect(Unknown Source)

at org.esa.snap.core.gpf.common.reproject.WarpFromSourceCoordinates.mapDestRect(WarpFromSourceCoordinates.java:108)

at javax.media.jai.WarpOpImage.backwardMapRect(Unknown Source)

at javax.media.jai.GeometricOpImage.mapDestRect(Unknown Source)

at javax.media.jai.WarpOpImage.computeTile(Unknown Source)

at com.sun.media.jai.util.SunTileScheduler.scheduleTile(Unknown Source)

at javax.media.jai.OpImage.getTile(Unknown Source)

at javax.media.jai.PlanarImage.getData(Unknown Source)

at javax.media.jai.RenderedOp.getData(Unknown Source)

at org.esa.snap.core.image.VirtualBandOpImage.addDataToReferredRasterDataSymbols(VirtualBandOpImage.java:307)

at org.esa.snap.core.image.VirtualBandOpImage.computeTile(VirtualBandOpImage.java:235)

at com.sun.media.jai.util.SunTileScheduler.scheduleTile(Unknown Source)

at javax.media.jai.OpImage.getTile(Unknown Source)

at javax.media.jai.PlanarImage.getData(Unknown Source)

at javax.media.jai.PlanarImage.getExtendedData(Unknown Source)

at com.sun.media.jai.opimage.MosaicOpImage.computeTile(Unknown Source)

at com.sun.media.jai.util.SunTileScheduler.scheduleTile(Unknown Source)

at javax.media.jai.OpImage.getTile(Unknown Source)

at javax.media.jai.PlanarImage.getData(Unknown Source)

at javax.media.jai.RenderedOp.getData(Unknown Source)

at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64)

at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:449)

at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:435)

at org.esa.snap.core.gpf.internal.OperatorImage.computeRect(OperatorImage.java:75)

at javax.media.jai.SourcelessOpImage.computeTile(Unknown Source)

at com.sun.media.jai.util.SunTileScheduler.scheduleTile(Unknown Source)

at javax.media.jai.OpImage.getTile(Unknown Source)

at com.sun.media.jai.util.RequestJob.compute(Unknown Source)

[catch] at com.sun.media.jai.util.WorkerThread.run(Unknown Source)

Please have a look here: I’m getting the error “Cannot construct DataBuffer”, “GC overhead limit exceeded” or “Java Heap Space”. What can I do?

1 Like

like me ,i had the same problem what we are doing to do?

the FAQ entry tells you what’s wrong, please read it.

1 Like

thank alot

I DIDNOT HAVE ANY RESULT but I did all the choices i don’t know what? thanks

You should tell a bit more what you are doing.
What is the operation you are doing when you see the problem?
What is your system configuration?
If the suggestion in the FAQ do not help you it is very likely that your computer is not powerful enough. Upgrading your RAM might help.

thank very much , with my greetings my problem was ram my computer 4 gega byte only it was too slaw to respond

if i want to get anew computer please can you help me about what the best properties about specifications for the computer that i must buy in order to suit the work of snap
what about the ram , memory ,etc ?

In general, the more the better. :slight_smile:
But we gave some suggestion in the FAQ:

1 Like

with my greetings
i am sooooo happy for my work with sapp application

Hi,
When I plot a band of Sentinel SAR data after processing using ‘LinearToFromdB’, an error ocurred: RuntimeError: java.lang.RuntimeException: Cannot construct DataBuffer.
File “”, line 7, in plotBand
band.readPixels(0, 0, w, h, band_data)

My code is : band = product.getBand(bandname)
w = band.getRasterWidth()
h = band.getRasterHeight()
print(w, h)
band_data = np.zeros(w * h, np.float32)
band.readPixels(0, 0, w, h, band_data)

How to solve this error?
Thanks!

Have you checked the link to the FAQ?

To use less memory, you can process the data line by line for example.
There are examples available:

I opened the above link and read it, but i still don’t know how to plot a band line by line

You want to display the image?
Maybe this is helpful:
sentinel/SNAP-Python_Tutorial_1.ipynb at master ¡ techforspace/sentinel (github.com)

This tutorial ‘Python Examples’ can be found in our Tutorials – STEP (esa.int).

1 Like

Thank you very much!

Can sentinel 2 level 1C data be preprocessed using snappy? such as atmospheric correction

Yes, should be possible. But if you want to use sen2cor you don’t need to use snappy. It is probably better to use sen2cor directly.

1 Like

Many thanks!