Question regarding .rio.set_spatial_dims(x_dim="lon", y_dim="lat", inplace=False) #860
Unanswered
JiyongLeeGit
asked this question in
Q&A
Replies: 1 comment
-
|
There is no attribute |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to simply reproject xarray data_array (lon & lat in deg) to UTM Zone 14N using the following code. I have got an error message saying that 'RasterArray' object has no attribute 'spatial_dims'
========== source code ==========
import xarray as xr
import rioxarray
print(f'xarray version: {xr.version}')
print(f'rioxarray version: {rioxarray.version}')
fdir_vic = '../../data/processed/vic/'
fname_vic = 'AORC_VIC4_runoff_202303.nc'
ds_vic = xr.open_dataset(fdir_vic + fname_vic)
da_runoff = ds_vic['runoff'].isel(time = 0)
print(da_runoff)
da_runoff = da_runoff.rio.set_spatial_dims(x_dim = 'lon', y_dim = 'lat')
print(f"Spatial Dimensions: {da_runoff.rio.spatial_dims}")
da_runoff = da_runoff.rio.write_crs("EPSG:4326", inplace=False)
da_runoff_utm = da_runoff.rio.reproject("EPSG:32614")
========== output ==========

Beta Was this translation helpful? Give feedback.
All reactions