When trying to mask a NetCDF (a daily time series of 31 days) with the code below, I get the following error related to the part of writing the CRS to the rio NetCDF data:
CRSError: The WKT could not be parsed. OGR Error code 6
Here is the code I am using (taken from snowman2's answer here: How to mask NetCDF time series data from a shapefile in Python?):
import rioxarray
import xarray
from shapely.geometry import mapping
ERA5_daily = xarray.open_dataarray('ERA5_VIMD_2018_08_Daily.nc')
ERA5_daily.rio.set_spatial_dims(x_dim="longitude", y_dim="latitude", inplace=True)
ERA5_daily.rio.write_crs("epsg:4326", inplace=True)
shapefile = geopandas.read_file('Cluster_34586.shp', crs="epsg:4326")
clipped = ERA5_daily.rio.clip(shapefile.geometry.apply(mapping), shapefile.crs, drop=False)
Does anyone know how to fix it?
python -c "import rioxarray; rioxarray.show_versions()"
? What is the CRS?Traceback (most recent call last): File "<ipython-input-65-54d7e150b1f6>", line 1, in <module> rioxarray.show_versions() AttributeError: module 'rioxarray' has no attribute 'show_versions'
ncdump -h file.nc
?