Skip to main content

Hi,


I’m using WCS request in Python to query PlanetScope data that I recently ordered. I can see the data in EO Browser, however, when I run a request in Python, I receive zero arrays as a response. I can, however, iterate via timestamps, so I think the query goes thorough (so the polygon intersect with purchased imagery), however, it won’t actually return correct values. As an input, I feed correct instance and collection IDs, as well as am referring to a pre-defined layer (True Color).


Any idea of what might be the issue here?


Thanks!


Edit: I’ve just ran a similar request for SPOT data where I only substituted instance and collection IDs, and it went through without issues, so I would assume there is some sort of issue with PlanetScope?


Edit2: Below is an example of WCS request I’m using:



config_ps = SHConfig()

INSTANCE_ID_ps = ‘d46e3de6-2ee5-masked’

config_ps.instance_id = INSTANCE_ID_ps

collection_id_ps= ‘25c2052c-3cd6-masked’

layer_ps = ‘1_TRUE-COLOR’


wcs_ps_request = WcsRequest(

data_collection=DataCollection.define_byoc(collection_id_ps),

layer=layer_ps,

bbox=aoi_bbox,

time = ‘latest’,

resx=‘3m’,

resy=‘3m’,

config=config_ps

)


I also tried following the OGC tutorial from scratch, without introducing any changes on my side.


I have both SPOT and PlanetScope imagery covering the same geometry. When I run the below snippet for SPOT first:


from sentinelhub import SHConfig, WmsRequest, CRS, BBox, DataCollection
import numpy as np

config = SHConfig()
INSTANCE_ID = 'a82a0b53-c664-masked'
config.instance_id = INSTANCE_ID

byoc_bbox = BBox(bbox=[ masked geometry ], crs=CRS.WGS84)
collection_id = '181c0898-fb32-masked'
layer = '1_TRUE-COLOR'

byoc_request = WmsRequest(
data_collection=DataCollection.define_byoc(collection_id),
layer=layer,
bbox=byoc_bbox,
width=512,
config=config
)

byoc_data = byoc_request.get_data()

print ('Shape: ', byoc_data[-1].shape)
print ('Unique values ', np.unique(byoc_data[-1]))

I get the response below, and everything as expected:


image


And then I run the above snippet for PlanetScope by only substituting Instance ID and Collection ID values, while keeping everything else, incl. the geometry the same (incl. layer, as both instances contain the same layer).


from sentinelhub import SHConfig, WmsRequest, CRS, BBox, DataCollection
import numpy as np

config = SHConfig()
INSTANCE_ID = 'e0820ab0-d983-masked'
config.instance_id = INSTANCE_ID

byoc_bbox = BBox(bbox=[ masked geometry ], crs=CRS.WGS84)
collection_id = '25c2052c-3cd6-masked'
layer = '1_TRUE-COLOR'

byoc_request = WmsRequest(
data_collection=DataCollection.define_byoc(collection_id),
layer=layer,
bbox=byoc_bbox,
width=512,
config=config
)

byoc_data = byoc_request.get_data()

print ('Shape: ', byoc_data[-1].shape)
print ('Unique values ', np.unique(byoc_data[-1]))

An this is the response:


image


So I get the response, it’s just empty/all zeros. This makes me think the issue might possibly be on your side? Alternatively, are there any adjustments that I need to make on my side to be able to query PlanetScope imagery specifically (until now I was under impression the process was quite standardized across BYOC)?


I’ve actually looked into this more, and one wild guess that I have at this stage is that perhaps, there might be some sort of desync between exact timestamps for a given tile across your different systems that is affecting only PlanetScope data, and not SPOT?


For instance, below is one of the tiles from PlanetScope that you can find in my PlanetScope collection:


image


It’s timestamp is 2021-09-15 17:39:49 according to above, while in the filename I also see this:


20210915_173949_69_1…


Which probably refers to milliseconds, so roughly ~690 milliseconds?


In Python, I see OGC service returns the exact timestamp below for this tile:


2021-09-15 17:39:49.697836


I then try to run a sample WMS request - which is similar to what the sentinelhub py package generates based on the input from a user - in the browser:



https://services.sentinel-hub.com/ogc/wms/d46e3de6-2ee5-*masked*?REQUEST=GetMap&CRS=CRS:84&BBOX=*masked*?&LAYERS=1_TRUE-COLOR&WIDTH=512&HEIGHT=511&FORMAT=image/png&TIME=2021-09-15T17%3A39%3A49.697836Z%2F2021-09-15T17%3A39%3A49.697836Z



It does return an image in fact, but a blank one - similarly to what I get in Python.


Then, I substitute the time parameter in the query:



TIME=2021-09-15T17%3A39%3A49.697836Z%2F2021-09-15T17%3A39%3A49.697836Z



With the following:



&TIME=2021-09-15T17%3A39%3A49.697999Z%2F2021-09-15T17%3A39%3A49.698000Z




https://services.sentinel-hub.com/ogc/wms/d46e3de6-2ee5-*masked*?REQUEST=GetMap&CRS=CRS:84&BBOX=*masked*?&LAYERS=1_TRUE-COLOR&WIDTH=512&HEIGHT=511&FORMAT=image/png&TIME=2021-09-15T17%3A39%3A49.**697999**Z%2F2021-09-15T17%3A39%3A49.**698000**Z



And it finally returns the correct image with actual content!


So my guess would be there might perhaps be some sort of desync between timestamps for a given tile from PlanetScope somewhere across your systems? I.e. perhaps including microseconds in the “catalogue” that returns a list of tiles and their properties and another timestamp, perhaps without microseconds, in the system that consumes these OGC requests like above?


Hi,

Thank you for reporting this issue and for figuring out the exact problem. It seems that we are not handling microseconds precision correctly. Our developers are looking into it and will let you know once the issue is fixed.

In the mean time, you can bypass the issue by switching to a combination of Process API and Catalog API requests as described in this example. This allows you to download the same stack of satellite data. In order to make it work correctly you have to remove microseconds from timestamps obtained from Catalog API before passing them to Process API request (i.e. SentinelHubRequest).


Hi, this walkaround solution that you suggested seems to working (there’s another issue I’m experiencing now, but will post that as a separate topic). Please do let me know once the issue with WMS is solved. Thanks!


Hi,

The issue has just now been fixed on Sentinel Hub service, microsecond precision has been dropped. Your code using WmsRequest should now work correctly.


Reply