Skip to content

Instantly share code, notes, and snippets.

@raphaeldussin
Created December 3, 2020 02:26
Show Gist options
  • Save raphaeldussin/e82ff7fde9ced1b784a88e140f23b519 to your computer and use it in GitHub Desktop.
Save raphaeldussin/e82ff7fde9ced1b784a88e140f23b519 to your computer and use it in GitHub Desktop.
function for roms2zarr tutorial
def rename_dims(ds):
""" rename dimensions
Parameters:
ds (xarray.Dataset): ROMS dataset
"""
ds = ds.rename({'xi_rho': 'xh', 'xi_v': 'xh', 'xi_u': 'xq', 'xi_psi': 'xq',
'eta_rho': 'yh', 'eta_v': 'yq', 'eta_u': 'yh', 'eta_psi': 'yq',
'ocean_time': 'time'
})
return ds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment