Microsoft Planetary Computer Pro에는 일부 NetCDF 자산을 시각화하는 데 사용할 수 있는 타일러가 포함되어 있습니다.
NetCDF 시각화 가능성 확인
Microsoft Planetary Computer에 수집할 수 있는 모든 NetCDF 데이터 세트가 Planetary Computer Pro의 시각화 타일러와 호환되는 것은 아닙니다. 데이터 세트에는 시각화할 X 및 Y 축, 위도 및 경도 좌표, 공간 차원 및 경계가 있어야 합니다. 예를 들어 위도와 경도가 변수이지만 좌표가 아닌 데이터 세트는 Planetary Computer Pro의 타일러와 호환되지 않습니다.
NetCDF 데이터 세트를 시각화하기 전에 다음을 사용하여 요구 사항을 충족하는지 확인할 수 있습니다.
필요한 종속성 설치
pip install xarray[io] rioxarray cf_xarray다음 함수를 실행합니다.
import xarray as xr import cf_xarray import rioxarray def is_dataset_visualizable(ds: xr.Dataset): """ Test if the dataset is compatible with the Planetary Computer tiler API. Raises an informative error if the dataset is not compatible. """ if not ds.cf.axes: raise ValueError("Dataset does not have CF axes") if not ds.cf.coordinates: raise ValueError("Dataset does not have CF coordinates") if not {"X", "Y"} <= ds.cf.axes.keys(): raise ValueError(f"Dataset must have CF X and Y axes, found: {ds.cf.axes.keys()}") if not {"latitude", "longitude"} <= ds.cf.coordinates.keys(): raise ValueError("Dataset must have CF latitude and longitude coordinates, " f"actual: {ds.cf.coordinates.keys()}") if ds.rio.x_dim is None or ds.rio.y_dim is None: raise ValueError("Dataset does not have rioxarray spatial dimensions") if ds.rio.bounds() is None: raise ValueError("Dataset does not have rioxarray bounds") left, bottom, right, top = ds.rio.bounds() if left < -180 or right > 180 or bottom < -90 or top > 90: raise ValueError("Dataset bounds are not valid; they must be within [-180, 180] and [-90, 90]") if ds.rio.resolution() is None: raise ValueError("Dataset does not have rioxarray resolution") if ds.rio.transform() is None: raise ValueError("Dataset does not have rioxarray transform") print("✅ Dataset is compatible with the Planetary Computer tiler API.")