Skip to content

Instantly share code, notes, and snippets.

@raphaeldussin
Created December 3, 2020 02:33
Show Gist options
  • Save raphaeldussin/9d72b4f6e4da6113d9c443ffbea680ba to your computer and use it in GitHub Desktop.
Save raphaeldussin/9d72b4f6e4da6113d9c443ffbea680ba to your computer and use it in GitHub Desktop.
function for roms2zarr tutorial
def add_coords(ds):
""" set coordinate variables as xarray coordinates
Parameters:
ds (xarray.Dataset): ROMS dataset
"""
ds = ds.set_coords(['Cs_r', 'Cs_w', 'hc', 'h', 'Vtransform', 'time',
'lon_rho', 'lon_v', 'lon_u', 'lon_psi',
'lat_rho', 'lat_v', 'lat_u', 'lat_psi'])
return ds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment