pp-mo / ncdata

Free and efficient exchange of data between netcdf files, Xarray and Iris
https://ncdata.readthedocs.io/en/latest/index.html
BSD 3-Clause "New" or "Revised" License
10 stars 2 forks source link

A neater way to add attrs #71

Closed pp-mo closed 4 months ago

pp-mo commented 6 months ago

~For now, just a placeholder, since some working out + testing required.~ WIP Now functionally complete, and tested.
But it will now be simpler to await #70, to avoid forcing a rebase of that. ALSO

The objective is to replace e.g. :

NcVariable(
    "var_z", dimensions=("z"), data=np.arange(N_Z),
    attributes=[
        NcAttribute("a", 1),
        NcAttribute("units", "m")
    ]
),

with the simpler ...

NcVariable(
    "var_z", dimensions=("z"), data=np.arange(N_Z),
    attributes={"a": 1, "units": "m"}
),