Open cOsprey opened 8 months ago
The reference system is not defined correctly in your dataset. Please refer to the cf conventions. The quickest solution to get your dataset supported by xcube is to rename the attribute "crs" to "crs_wkt". Also, in the dataset you have many dimensionless variables which I assume should be attributes.
I don't have any attributes in the dataset, I added the crs attribute, defined crs as epsg:32654. But still I am getting same error when I try to run /datasets on the api page, I am getting same error. Is there any example to generate my own cube from an existing xarray dataset ? I exported the dataset in zarr format and I can serve it in xcube viewer and on the api page also.
@cOsprey, your data variables should have an attribute named grid_mapping
with the value being the (coordinate) variable that encodes the CRS, usually called crs
or spatial_ref
.
The variable that encodes the CRS is usually empty or an integer scalar with value zero. Important are only its attributes. They must be encoded using the CF-conventions.
Using pyproj, you can create CF-compliant CRS attributes like so:
import pyproj
import xarray as xr
ds.coords["crs"] = xr.DataArray((), attrs=pyproj.CRS(crs).to_cf())
for var in ds.data_vars.values():
var.attrs["grid_mapping"] = "crs"
I am creating a data cube for Sentinel 1 RTC for VV & VH polarization. I am trying to serve it using xcube. I am getting error "ValueError: cannot find any grid mapping in dataset". The dataset has time,x, and y dimensions. There are other data coordinates also. Small part of the datacube is here.
Please let me know what I am missing and how to proceed? Any required parameters for the datacube required to serve?