Xarray
print_ds_var_list(ds, phrase=None)
Prints all variables in ds which contain phrase in the variable name or variable long_name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
Dataset to investigate variables of. |
required |
phrase
|
Optional[str]
|
Key phrase to search for in variable info. |
None
|
Source code in climdyn_tools/utils/xarray.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
set_attrs(var, overwrite=True, **kwargs)
Set attributes of a given variable.
Examples:
set_attrs(ds.plev, long_name='pressure', units='Pa')
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
var
|
DataArray
|
Variable to set attributes of. |
required |
overwrite
|
bool
|
If |
True
|
**kwargs
|
str
|
Attributes to set. Common ones include |
{}
|
Returns:
| Type | Description |
|---|---|
DataArray
|
|
Source code in climdyn_tools/utils/xarray.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |