You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When trying to use resample_in_space to convert Sentinel-2 data from EPSG:4326 to EPGS:3035 a ValueError: new_grid_mapping_from_dataset occurs when trying to get a GridMappingfrom dataset in `xcube.core.resampling.resample_in_space()
To Reproduce
The following script, produces the error:
from xcube.core.store import new_data_store
from xcube.core.resampling import resample_in_space
import pyproj
# create sentinelhub datastore
store = new_data_store("sentinelhub")
# selection parameters
data_id = "S2L2A"
bbox = [9.6, 47.4, 9.8, 47.6]
tile_size = [1024, 1024]
time_range = ("2020-06-01", "2020-07-01")
variable_names = ["B03", "B04"]
# get data in EPSG:4326
spatial_res = 0.00018
ds_4326 = store.open_data(
data_id,
variable_names=variable_names,
bbox=bbox,
spatial_res=spatial_res,
time_range=time_range,
tile_size=tile_size,
)
print(ds_4326)
# get data in EPSG:3035
transformer = pyproj.Transformer.from_crs("EPSG:4326", "EPSG:3035", always_xy=True)
pmin = transformer.transform(bbox[0], bbox[1])
pmax = transformer.transform(bbox[2], bbox[3])
bbox_3035 = [pmin[0], pmin[1], pmax[0], pmax[1]]
spatial_res_3035 = 20
ds_3035 = store.open_data(
data_id,
variable_names=variable_names,
bbox=bbox_3035,
spatial_res=spatial_res_3035,
time_range=time_range,
tile_size=tile_size,
crs="EPSG:3035",
)
print(ds_3035)
# resample the data
ds_resample = resample_in_space(ds_4326.isel(time=4), ref_ds=ds_3035.isel(time=4))
print(ds_resample)
Expected behavior
The function should convert the projection and resample to the grid mapping of the reference dataset.
The text was updated successfully, but these errors were encountered:
Describe the bug
When trying to use
resample_in_space
to convert Sentinel-2 data from EPSG:4326 to EPGS:3035 aValueError: new_grid_mapping_from_dataset
occurs when trying to get aGridMapping
from dataset in `xcube.core.resampling.resample_in_space()To Reproduce
The following script, produces the error:
Expected behavior
The function should convert the projection and resample to the grid mapping of the reference dataset.
The text was updated successfully, but these errors were encountered: