drop: Remove variables, days, months, years or time steps from a dataset
This will remove stated variables from files in the dataset.
Possible arguments: var, year, month, day
Note: this uses partial matches. So years, month, variable etc. will also work
Each kwarg works as follows:
- var: str or list
A variable or list of variables to select. This method will accept wild cards. So using ‘var*’ would select all variables beginning with ‘var’.
- daylist, range or int
Day(s) to drop.
- monthlist, range or int
Month(s) to drop.
- yearlist, range or int
Year(s) to drop.
- timelist, range or int
Time steps to to drop. This can include negative indices.
If you wanted to remove a single variable ‘var1’ from a dataset data, you would do the following:
>>> ds.drop(variable = 'var')
If you wanted to remove a list of variables, you would do the following:
>>> ds.drop(variable = ['var1', 'var2', 'var2'])
If you wanted to remove the 29th Feburary you would do the following:
>>> ds.drop(month = 2, day = 29)