I'm cleaning a large dataset using xarray. Various variable attributes get set throughout the code, but not always in the same order. I'm wondering if its possible to manually reorder the attributes for all variables at the end of the code, such that they're always in the same order.
For example, if various lines of code set:
ds['hurs'].attrs['auxilliary_variables'] = "hurs_qc"
ds['hurs'].attrs['long_name'] = "relative_humidity"
ds['hurs'].attrs['standard_name'] = "relative_humidity"
ds['hurs'].attrs['units'] = "percent"
How can I then reorganize these attributes in the following order: long_name, standard_name, units, auxilliary_variables?