Created
December 3, 2020 02:09
-
-
Save raphaeldussin/6681d03339975050e7b38f4c1e8cb081 to your computer and use it in GitHub Desktop.
function for the roms2zarr tutorial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def remove_all_small_variables(ds): | |
| """ remove all the variables that have less than 3 dimensions | |
| Parameters: | |
| ds (xarray.Dataset): ROMS dataset | |
| """ | |
| for v in ds.variables: | |
| if v not in ['Cs_r', 'Cs_w', 'hc', 'Vtransform', 'ocean_time']: | |
| ds = ds.drop_vars(v) if len(ds[v].dims) < 3 else ds | |
| return ds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment